From 91791e99c7cf3d253c3270f5f6f6db6a08f8cb45 Mon Sep 17 00:00:00 2001 From: Anon Date: Thu, 2 Mar 2023 20:04:24 +0100 Subject: [PATCH] Restricted usage of quit/exit commands in the TelegramBridge chat bot due to Telegram caching causing problems --- MinecraftClient/ChatBots/TelegramBridge.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/MinecraftClient/ChatBots/TelegramBridge.cs b/MinecraftClient/ChatBots/TelegramBridge.cs index eac48542..1f952412 100644 --- a/MinecraftClient/ChatBots/TelegramBridge.cs +++ b/MinecraftClient/ChatBots/TelegramBridge.cs @@ -345,6 +345,17 @@ namespace MinecraftClient.ChatBots { var command = text[1..]; + if (command.ToLower().Contains("quit") || command.ToLower().Contains("exit")) + { + await botClient.SendTextMessageAsync( + chatId: chatId, + replyToMessageId: message.MessageId, + text: "This command has been disabled due to Telegram caching causing issues, please stop your client manually.", + cancellationToken: _cancellationToken, + parseMode: ParseMode.Markdown); + return;; + } + CmdResult result = new(); PerformInternalCommand(command, ref result);