Ver Fonte

Silently return when bot.stop() aborts the setup phase

If bot.stop() is called while bot.start() is still in setup (deleteWebhook/
getMe), grammy rejects with 'Aborted delay'. Expected, not an error.
Kenneth Lien há 5 meses atrás
pai
commit
3d8042f259
1 ficheiros alterados com 2 adições e 0 exclusões
  1. 2 0
      external_plugins/telegram/server.ts

+ 2 - 0
external_plugins/telegram/server.ts

@@ -618,6 +618,8 @@ void (async () => {
         await new Promise(r => setTimeout(r, delay))
         continue
       }
+      // bot.stop() mid-setup rejects with grammy's "Aborted delay" — expected, not an error.
+      if (err instanceof Error && err.message === 'Aborted delay') return
       process.stderr.write(`telegram channel: polling failed: ${err}\n`)
       return
     }