mirror of
https://github.com/tiennm99/store-scraper-bot-java.git
synced 2026-05-15 07:53:01 +00:00
4c62fde11f
Renamed the SOURCE_VERSION constant to SOURCE_COMMIT in Config.java and updated its usage in Main.java. The environment variable and related references now consistently use SOURCE_COMMIT to better reflect the tracked value.
30 lines
1.1 KiB
Java
30 lines
1.1 KiB
Java
package com.miti99.storescraperbot;
|
|
|
|
import static com.miti99.storescraperbot.config.Config.CREATOR_ID;
|
|
import static com.miti99.storescraperbot.config.Config.SOURCE_COMMIT;
|
|
|
|
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;
|
|
import org.telegram.telegrambots.longpolling.TelegramBotsLongPollingApplication;
|
|
|
|
@Log4j2
|
|
public class Main {
|
|
|
|
public static void main(String[] args) {
|
|
AdminRepository.INSTANCE.init();
|
|
|
|
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_COMMIT));
|
|
Thread.currentThread().join();
|
|
} catch (Exception e) {
|
|
log.error("Error while running bot", e);
|
|
}
|
|
}
|
|
}
|