mirror of
https://github.com/HugeFrog24/go-telegram-bot.git
synced 2026-03-02 08:24:34 +00:00
Proceed with role management
This commit is contained in:
14
main.go
14
main.go
@@ -52,14 +52,24 @@ func main() {
|
||||
go func(cfg BotConfig) {
|
||||
defer wg.Done()
|
||||
|
||||
// Create Bot instance with RealClock
|
||||
// Create Bot instance without TelegramClient initially
|
||||
realClock := RealClock{}
|
||||
bot, err := NewBot(db, cfg, realClock)
|
||||
bot, err := NewBot(db, cfg, realClock, nil)
|
||||
if err != nil {
|
||||
log.Printf("Error creating bot %s: %v", cfg.ID, err)
|
||||
return
|
||||
}
|
||||
|
||||
// Initialize TelegramClient with the bot's handleUpdate method
|
||||
tgClient, err := initTelegramBot(cfg.TelegramToken, bot.handleUpdate)
|
||||
if err != nil {
|
||||
log.Printf("Error initializing Telegram client for bot %s: %v", cfg.ID, err)
|
||||
return
|
||||
}
|
||||
|
||||
// Assign the TelegramClient to the bot
|
||||
bot.tgBot = tgClient
|
||||
|
||||
// Start the bot
|
||||
log.Printf("Starting bot %s...", cfg.ID)
|
||||
bot.Start(ctx)
|
||||
|
||||
Reference in New Issue
Block a user