mirror of
https://github.com/tgdrive/teldrive.git
synced 2025-01-09 00:29:57 +08:00
fix updates form messages
This commit is contained in:
parent
b22303c555
commit
1ec038fe4b
1 changed files with 11 additions and 2 deletions
|
@ -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")
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue