From bfd8c6e6105661298cd4e02ddf62ae67d9653c03 Mon Sep 17 00:00:00 2001 From: almax07082005 Date: Thu, 14 Nov 2024 16:32:44 +0300 Subject: [PATCH] feat: hardcoded blocklist --- .../cardiotelegrambot/service/bot/main/BotService.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/main/java/com/example/cardiotelegrambot/service/bot/main/BotService.java b/src/main/java/com/example/cardiotelegrambot/service/bot/main/BotService.java index 55ab99f..9b6f306 100644 --- a/src/main/java/com/example/cardiotelegrambot/service/bot/main/BotService.java +++ b/src/main/java/com/example/cardiotelegrambot/service/bot/main/BotService.java @@ -9,6 +9,9 @@ import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.stereotype.Service; +import java.util.ArrayList; +import java.util.List; + @Service public class BotService { @@ -17,18 +20,25 @@ public class BotService { private final Command command; private final Logger logger; +// TODO temporary solution + private final List blocked; + @Autowired public BotService(@Qualifier("mainBotBean") TelegramBot bot, Button button, Command command, Logger logger) { this.bot = bot; this.button = button; this.command = command; this.logger = logger; + + this.blocked = new ArrayList<>(); + this.blocked.add(5733496893L); } public void startBot() { bot.setUpdatesListener(updates -> { try { for (Update update : updates) { + if (blocked.contains(update.message().chat().id())) continue; if (update.callbackQuery() != null) executeButton(update); else if (update.message() != null) executeCommand(update); }