From c2fbaa35bbcdfb58e2dc537a8236b256ee4b9bc4 Mon Sep 17 00:00:00 2001 From: RandomChars <random@chars.jp> Date: Mon, 8 Nov 2021 15:57:22 +0900 Subject: [PATCH] handle documents --- telegram.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/telegram.go b/telegram.go index d2eb7c0..832d7e9 100644 --- a/telegram.go +++ b/telegram.go @@ -165,8 +165,17 @@ func respondTelegram(update tgbotapi.Update) { header, has := telegramMakeHeader(update.Message, false) - if update.Message.Photo != nil { + if update.Message.Document != nil { + if telegramHandleFile(dc, update, update.Message.Document.FileID, update.Message.Caption, + header, has, reference, + &dMessageID, &dChannelID, &dGuildID) { + log.Printf("T%vM%v -> D%vM%s @%s (%v) [document]: %s; caption: %s", + tc.ID, update.Message.MessageID, dc.ID, dMessageID, username, id, update.Message.Document.FileID, update.Message.Caption) + } + return + } + if update.Message.Photo != nil { p := *update.Message.Photo if telegramHandleFile(dc, update, p[len(p)-1].FileID, update.Message.Caption, header, has, reference, @@ -174,7 +183,6 @@ func respondTelegram(update tgbotapi.Update) { log.Printf("T%vM%v -> D%vM%s @%s (%v) [photo]: %s; caption: %s", tc.ID, update.Message.MessageID, dc.ID, dMessageID, username, id, p[len(p)-1].FileID, update.Message.Caption) } - return } -- GitLab