Reuse existing image instead of uploading every time new
This commit is contained in:
parent
36db6b9385
commit
c65c1bdd69
@ -145,12 +145,7 @@ func ProcessUpdate(bc BotController, update tgbotapi.Update) {
|
|||||||
msg.ReplyMarkup = kbd
|
msg.ReplyMarkup = kbd
|
||||||
bc.bot.Send(msg)
|
bc.bot.Send(msg)
|
||||||
} else {
|
} else {
|
||||||
filename := "./" + img + ".jpg"
|
msg := tgbotapi.NewPhoto(update.Message.Chat.ID, tgbotapi.FileID(img))
|
||||||
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.Caption = bc.GetBotContent("start")
|
msg.Caption = bc.GetBotContent("start")
|
||||||
msg.ReplyMarkup = kbd
|
msg.ReplyMarkup = kbd
|
||||||
bc.bot.Send(msg)
|
bc.bot.Send(msg)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user