Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions internal/handlers/telegram/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@ which handler to fire off
*/
func updateHandler(tg *Client, updates tgbotapi.UpdatesChannel) {
for u := range updates {
// Don't process any messages that didn't come from the
// chat we're bridging
if u.Message.Chat.ID != tg.Settings.ChatID {
tg.logger.LogDebug("Ignored message from a telegram chat we're not bridging:", tg.Settings.ChatID)
continue
}

switch {
case u.Message == nil:
tg.logger.LogError("Missing message data")
Expand Down Expand Up @@ -66,12 +73,6 @@ func messageHandler(tg *Client, u tgbotapi.Update) {
return
}

// Don't forward messages to IRC that didn't come from the
// chat we're bridging
if u.Message.Chat.ID != tg.Settings.ChatID {
return
}

// Telegram user replied to a message
if u.Message.ReplyToMessage != nil {
replyHandler(tg, u)
Expand Down