diff --git a/internal/app/app.go b/internal/app/app.go index b220a70..1ea12fc 100644 --- a/internal/app/app.go +++ b/internal/app/app.go @@ -52,6 +52,7 @@ func (a *App) loadCron() error { a.settings.System.TimeZone, a.settings.DailyScripture.Schedule), a.scripture) + fmt.Println("using schedule:", fmt.Sprintf("TZ=%s %s", a.settings.System.TimeZone, a.settings.DailyScripture.Schedule)) a.cron.Start() fmt.Println("cron started") @@ -97,7 +98,7 @@ func (a *App) scripture() { for _, chat := range chats { fmt.Println("chat:", chat) - vv, err := a.db.Verses().RandomVerseForChat(chat.ID) + vv, err := a.db.Verses().RandomVerseRotateTx(chat.ID) if err != nil { fmt.Println("error retrieving random verse:", err) fmt.Println("chat ID:", chat.ID) diff --git a/internal/app/bot.go b/internal/app/bot.go index b27c386..dad7c14 100644 --- a/internal/app/bot.go +++ b/internal/app/bot.go @@ -14,6 +14,7 @@ import ( "github.com/mymmrac/telego" th "github.com/mymmrac/telego/telegohandler" tu "github.com/mymmrac/telego/telegoutil" + "go.destrealm.net/logging/v3" ) type bot struct { @@ -42,7 +43,12 @@ func NewBot(ctx context.Context, conf *settings.Settings) *bot { } func (b *bot) init() { - tgbot, err := telego.NewBot(b.settings.Service.BotToken, telego.WithDefaultDebugLogger()) + logger := logging.Logger().Get("bot") + logger.SetLevel(logging.Debug) + + tgbot, err := telego.NewBot(b.settings.Service.BotToken, + telego.WithLogger(logger)) + //telego.WithDefaultDebugLogger()) if err != nil { panic(err) } @@ -140,7 +146,7 @@ func (b *bot) SetCommands(ctx context.Context) (err error) { commands, err := b.tgbot.GetMyCommands(ctx, &telego.GetMyCommandsParams{}) fmt.Println(commands) if len(commands) > 0 { - if b.settings.Debug.Commands.Reset || b.settings.Debug.Commands.Clear { + if b.settings.Debug.Commands.Reset { b.tgbot.DeleteMyCommands(ctx, &telego.DeleteMyCommandsParams{ Scope: &telego.BotCommandScopeAllChatAdministrators{ Type: "all_chat_administrators", @@ -153,7 +159,7 @@ func (b *bot) SetCommands(ctx context.Context) (err error) { } return } - if b.settings.Debug.Commands.Clear { + if !b.settings.Debug.Commands.Register { return } b.tgbot.SetMyCommands(ctx, &telego.SetMyCommandsParams{