Skip to content

Commit

Permalink
Telegram, limit the quit/exit command
Browse files Browse the repository at this point in the history
Telegram, limit the quit/exit command
  • Loading branch information
milutinke committed Mar 26, 2023
2 parents 033c615 + 0f77828 commit 2f1da9e
Show file tree
Hide file tree
Showing 3 changed files with 96 additions and 2,008 deletions.
11 changes: 11 additions & 0 deletions MinecraftClient/ChatBots/TelegramBridge.cs
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,17 @@ private async Task HandleUpdateAsync(ITelegramBotClient botClient, Update update
{
var command = text[1..];

if (command.ToLower().Contains("quit") || command.ToLower().Contains("exit"))
{
await botClient.SendTextMessageAsync(
chatId: chatId,
replyToMessageId: message.MessageId,
text: $"{Translations.bot_TelegramBridge_quit_disabled}",
cancellationToken: _cancellationToken,
parseMode: ParseMode.Markdown);
return;;
}

CmdResult result = new();
PerformInternalCommand(command, ref result);

Expand Down
Loading

0 comments on commit 2f1da9e

Please sign in to comment.