fix: unsilence all error returns from SQL Exec, Bot API calls, and migrations
This commit is contained in:
@@ -61,7 +61,9 @@ func main() {
|
||||
if url := os.Getenv("BOT_WEBHOOK_URL"); url != "" {
|
||||
startWebhook(ctx, b, h, url)
|
||||
} else {
|
||||
b.DeleteWebhook(ctx, &tgbot.DeleteWebhookParams{})
|
||||
if _, err := b.DeleteWebhook(ctx, &tgbot.DeleteWebhookParams{}); err != nil {
|
||||
slog.Warn("failed to delete webhook", "error", err)
|
||||
}
|
||||
go dailyReportScheduler(ctx, h, dbStore)
|
||||
slog.Info("bot started",
|
||||
"allowed_users", len(allowedUsers),
|
||||
@@ -105,6 +107,7 @@ func checkDailyReports(ctx context.Context, h *bot.Handler, store *db.Store) {
|
||||
|
||||
loc, err := time.LoadLocation(u.Timezone)
|
||||
if err != nil {
|
||||
slog.Error("invalid timezone for user, skipping report", "chat_id", u.ChatID, "timezone", u.Timezone, "error", err)
|
||||
continue
|
||||
}
|
||||
localNow := now.In(loc)
|
||||
|
||||
@@ -13,7 +13,9 @@ import (
|
||||
|
||||
// startWebhook registers the webhook with Telegram and starts the HTTPS/HTTP listener loop.
|
||||
func startWebhook(ctx context.Context, b *tgbot.Bot, h *bot.Handler, webhookURL string) {
|
||||
b.DeleteWebhook(ctx, &tgbot.DeleteWebhookParams{})
|
||||
if _, err := b.DeleteWebhook(ctx, &tgbot.DeleteWebhookParams{}); err != nil {
|
||||
slog.Warn("failed to delete webhook", "error", err)
|
||||
}
|
||||
|
||||
if _, err := b.SetWebhook(ctx, &tgbot.SetWebhookParams{URL: webhookURL}); err != nil {
|
||||
slog.Error("set webhook", "error", err)
|
||||
|
||||
Reference in New Issue
Block a user