diff --git a/backend/app/telegram/telegram.go b/backend/app/telegram/telegram.go index 69e8083..cbe9b66 100644 --- a/backend/app/telegram/telegram.go +++ b/backend/app/telegram/telegram.go @@ -205,6 +205,13 @@ func handleMessage(bot *telego.Bot, message telego.Message) { voice_type = "note" case message.Document != nil: voice_type = "document" + + if !strings.HasPrefix(message.Document.MimeType, "audio/") { + log.Warnf("Ignoring non-audio document message in chat %s, mimetype: %s", chatIDString, message.Document.MimeType) + + bot.SendMessage(tu.Message(chatID, "I don't support non-audio documents yet, stay tuned for updates.").WithMessageThreadID(message.MessageThreadID)) + return + } } config.CONFIG.DataDogClient.Incr("telegram.voice_message_received", []string{"type:" + voice_type, "channel_type:" + message.Chat.Type}, 1)