mirror of
https://github.com/tiennm99/store-scraper-bot-java.git
synced 2026-05-15 11:53:02 +00:00
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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user