Skip to content

Commit

Permalink
fix updates form messages
Browse files Browse the repository at this point in the history
  • Loading branch information
divyam234 committed Nov 6, 2023
1 parent b22303c commit 1ec038f
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions services/upload.service.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,18 @@ func (us *UploadService) UploadFile(c *gin.Context) (*schemas.UploadPartOut, *ty

updates := res.(*tg.Updates)

message, ok := updates.Updates[1].(*tg.UpdateNewChannelMessage).Message.(*tg.Message)
var message *tg.Message

if !ok || message.ID == 0 {
for _, update := range updates.Updates {
channelMsg, ok := update.(*tg.UpdateNewChannelMessage)
if ok {
message = channelMsg.Message.(*tg.Message)
break
}

}

if message.ID == 0 {
return errors.New("failed to upload part")
}

Expand Down

0 comments on commit 1ec038f

Please sign in to comment.