Telegram, limit the quit/exit command

Telegram, limit the quit/exit command
This commit is contained in:
Anon 2023-03-26 12:35:45 +00:00 committed by GitHub
commit 2f1da9e8c9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 128 additions and 2040 deletions

View file

@ -345,6 +345,17 @@ namespace MinecraftClient.ChatBots
{ {
var command = text[1..]; 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(); CmdResult result = new();
PerformInternalCommand(command, ref result); PerformInternalCommand(command, ref result);

File diff suppressed because it is too large Load diff

View file

@ -2034,4 +2034,7 @@ Logging in...</value>
<data name="cmd.dig.cancel" xml:space="preserve"> <data name="cmd.dig.cancel" xml:space="preserve">
<value>Cancel mining the block located at {0}.</value> <value>Cancel mining the block located at {0}.</value>
</data> </data>
<data name="bot.TelegramBridge.quit_disabled" xml:space="preserve">
<value>This command has been disabled due to Telegram caching causing issues, please stop your client manually.</value>
</data>
</root> </root>