Ignore unknown slash commands in groups not explicitly directed at us

This commit is contained in:
Laura Hausmann 2023-01-09 15:08:10 +01:00
parent d520976c6d
commit 6b26effc29
Signed by: zotan
GPG key ID: D044E84C5BE01605

View file

@ -72,6 +72,9 @@ async Task BotOnMessageReceived(ITelegramBotClient botClient, Message message) {
command = firstword.Replace($"@{me.Username}", "").TrimStart('/');
// remove command (and optional username) from message text
query = message.Text?[firstword.Length..];
// ignore unknown slash commands in groups not explicitly directed at us
if (!iBotCommands.Contains(command) && message.Chat.Type != ChatType.Private && !firstword.Contains($"@{me.Username}"))
return;
}
else {
// are we sure the bot is being asked?