Notify creator on bot startup and enhance config

Added a startup notification to the creator with the current bot version. Refactored ADMIN_IDS to a List, introduced CREATOR_ID and SOURCE_VERSION constants in Config, and improved environment variable handling.
This commit is contained in:
2025-11-07 21:04:02 +07:00
parent b67aa4f77f
commit cced06fda9
2 changed files with 17 additions and 3 deletions
@@ -1,6 +1,10 @@
package com.miti99.storescraperbot;
import static com.miti99.storescraperbot.config.Config.CREATOR_ID;
import static com.miti99.storescraperbot.config.Config.SOURCE_VERSION;
import com.miti99.storescraperbot.bot.StoreScrapeBot;
import com.miti99.storescraperbot.bot.StoreScrapeBotTelegramClient;
import com.miti99.storescraperbot.config.Config;
import com.miti99.storescraperbot.repository.AdminRepository;
import lombok.extern.log4j.Log4j2;
@@ -15,6 +19,8 @@ public class Main {
try (var botsApplication = new TelegramBotsLongPollingApplication()) {
botsApplication.registerBot(Config.TELEGRAM_BOT_TOKEN, StoreScrapeBot.INSTANCE);
log.info("StoreScrapeBot successfully started!");
StoreScrapeBotTelegramClient.INSTANCE.sendMessage(
CREATOR_ID, "Bot started! Version <code>%s</code>".formatted(SOURCE_VERSION));
Thread.currentThread().join();
} catch (Exception e) {
log.error("Error while running bot", e);