mirror of
https://github.com/HugeFrog24/go-telegram-bot.git
synced 2026-03-02 00:14:34 +00:00
Upd deps
This commit is contained in:
16
main.go
Executable file → Normal file
16
main.go
Executable file → Normal file
@@ -47,19 +47,13 @@ func main() {
|
||||
return
|
||||
}
|
||||
|
||||
// Initialize TelegramClient with the bot's handleUpdate method
|
||||
tgClient, err := initTelegramBot(cfg.TelegramToken, bot.handleUpdate)
|
||||
if err != nil {
|
||||
ErrorLogger.Printf("Error initializing Telegram client for bot %s: %v", cfg.ID, err)
|
||||
return
|
||||
}
|
||||
// Start the bot in a separate goroutine
|
||||
go bot.Start(ctx)
|
||||
|
||||
// Assign the TelegramClient to the bot
|
||||
bot.tgBot = tgClient
|
||||
// Keep the bot running until the context is cancelled
|
||||
<-ctx.Done()
|
||||
|
||||
// Start the bot
|
||||
InfoLogger.Printf("Starting bot %s...", cfg.ID)
|
||||
bot.Start(ctx)
|
||||
InfoLogger.Printf("Bot %s stopped", cfg.ID)
|
||||
}(config)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user