Ignore unknown slash commands in groups not explicitly directed at us
This commit is contained in:
parent
d520976c6d
commit
6b26effc29
|
@ -72,6 +72,9 @@ async Task BotOnMessageReceived(ITelegramBotClient botClient, Message message) {
|
||||||
command = firstword.Replace($"@{me.Username}", "").TrimStart('/');
|
command = firstword.Replace($"@{me.Username}", "").TrimStart('/');
|
||||||
// remove command (and optional username) from message text
|
// remove command (and optional username) from message text
|
||||||
query = message.Text?[firstword.Length..];
|
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 {
|
else {
|
||||||
// are we sure the bot is being asked?
|
// are we sure the bot is being asked?
|
||||||
|
|
Loading…
Reference in a new issue