diff --git a/src/routing.go b/src/routing.go index dca2f59..f50a528 100644 --- a/src/routing.go +++ b/src/routing.go @@ -509,16 +509,8 @@ func telegramWebhookHandler(c *gin.Context) { ) } - bot, err := tgbotapi.NewBotAPI(b.Token) - if err != nil { - logger.Error(b, err) - c.AbortWithStatus(http.StatusBadRequest) - return - } - var client = v1.New(conn.MGURL, conn.MGToken) client.Debug = config.Debug - bot.Debug = config.Debug if update.Message != nil { nickname := update.Message.From.UserName @@ -593,7 +585,7 @@ func telegramWebhookHandler(c *gin.Context) { if snd.Message.Text == "" { setLocale(update.Message.From.LanguageCode) - err := setAttachment(bot, update.Message, client, &snd, b.Token) + err := setAttachment(update.Message, client, &snd, b.Token) if err != nil { logger.Error(client.Token, err.Error()) c.AbortWithStatus(http.StatusBadRequest) @@ -1015,7 +1007,7 @@ func textMessage(cid int64, mb string, quoteExternalID string) (chattable tgbota return } -func setAttachment(bot *tgbotapi.BotAPI, attachments *tgbotapi.Message, client *v1.MgClient, snd *v1.SendData, botToken string) error { +func setAttachment(attachments *tgbotapi.Message, client *v1.MgClient, snd *v1.SendData, botToken string) error { var ( items []v1.Item fileID string