From 1ec038fe4b37e0f06fa931773d4c33635f460d13 Mon Sep 17 00:00:00 2001 From: divyam234 Date: Mon, 6 Nov 2023 17:19:49 +0530 Subject: [PATCH] fix updates form messages --- services/upload.service.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/services/upload.service.go b/services/upload.service.go index 8fcd78f..b3d951b 100644 --- a/services/upload.service.go +++ b/services/upload.service.go @@ -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") }