Skip to content

Commit

Permalink
feat: hardcoded blocklist
Browse files Browse the repository at this point in the history
  • Loading branch information
almax07082005 committed Nov 14, 2024
1 parent 4e3a96b commit bfd8c6e
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand All @@ -17,18 +20,25 @@ public class BotService {
private final Command command;
private final Logger logger;

// TODO temporary solution
private final List<Long> 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);
}
Expand Down

0 comments on commit bfd8c6e

Please sign in to comment.