From 77c36663e4146a1bb71b05e9c2644418ee86532b Mon Sep 17 00:00:00 2001 From: Samuele Musiani Date: Thu, 25 Jan 2024 13:00:20 +0100 Subject: [PATCH] If the command is not for the bot it does not respond --- bot/bot.go | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/bot/bot.go b/bot/bot.go index 86f794e..9d0d1ad 100644 --- a/bot/bot.go +++ b/bot/bot.go @@ -99,16 +99,14 @@ func handleUnknown(bot *tgbotapi.BotAPI, update *tgbotapi.Update, _ string) bool func handleCommand(bot *tgbotapi.BotAPI, update *tgbotapi.Update) { commandName := strings.ToLower(update.Message.Command()) - if !update.Message.Chat.IsPrivate() { - // Check if the command is for me - commandWithAt := update.Message.CommandWithAt() - atIndex := strings.Index(commandWithAt, "@") - if atIndex != -1 { - forName := commandWithAt[atIndex+1:] + // Check if the command is for me + commandWithAt := update.Message.CommandWithAt() + atIndex := strings.Index(commandWithAt, "@") + if atIndex != -1 { + forName := commandWithAt[atIndex+1:] - if bot.Self.UserName != forName { - return - } + if bot.Self.UserName != forName { + return } }