From 88980bb81c01771b8336f878a661283f5dd9c236 Mon Sep 17 00:00:00 2001 From: akulij Date: Tue, 13 Aug 2024 03:15:59 +0300 Subject: [PATCH] Reuse existing image instead of uploading every time new --- cmd/app/main.go | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/cmd/app/main.go b/cmd/app/main.go index 9b1fbd7..53af2a6 100644 --- a/cmd/app/main.go +++ b/cmd/app/main.go @@ -145,12 +145,7 @@ func ProcessUpdate(bc BotController, update tgbotapi.Update) { msg.ReplyMarkup = kbd bc.bot.Send(msg) } else { - filename := "./" + img + ".jpg" - if _, err := os.Stat(filename); errors.Is(err, os.ErrNotExist) { - url, _ := bc.bot.GetFileDirectURL(img) - DownloadFile(filename, url) - } - msg := tgbotapi.NewPhoto(update.Message.Chat.ID, tgbotapi.FilePath(filename)) + msg := tgbotapi.NewPhoto(update.Message.Chat.ID, tgbotapi.FileID(img)) msg.Caption = bc.GetBotContent("start") msg.ReplyMarkup = kbd bc.bot.Send(msg)