Skip to content

Commit

Permalink
non-audio documents
Browse files Browse the repository at this point in the history
  • Loading branch information
radiantspace committed May 13, 2024
1 parent 3f78b43 commit 858612f
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions backend/app/telegram/telegram.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit 858612f

Please sign in to comment.