From 8021a9561e74a0d512ba6a29c9af441f2ad7935e Mon Sep 17 00:00:00 2001 From: Lucid Date: Tue, 21 Oct 2025 00:38:18 -0400 Subject: [PATCH] Updated setTimeout --- src/main.ts | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/src/main.ts b/src/main.ts index 97e1211..20e147d 100644 --- a/src/main.ts +++ b/src/main.ts @@ -64,6 +64,21 @@ async function startWebhook(config: WebhookConfig) { // to prevent receiving updates before the bot is ready await bot.init(); + const setWebhook = async (): Promise => { + // set webhook + return await bot.api + .setWebhook(config.botWebhook, { + allowed_updates: config.botAllowedUpdates, + secret_token: config.botWebhookSecret + }) + .then(() => { + logger.info({ + msg: "Webhook was set", + url: config.botWebhook + }); + }); + }; + // start server const info = await serverManager.start().then(async info => { logger.info({ @@ -72,19 +87,8 @@ async function startWebhook(config: WebhookConfig) { }); setTimeout(async () => { - // set webhook - await bot.api - .setWebhook(config.botWebhook, { - allowed_updates: config.botAllowedUpdates, - secret_token: config.botWebhookSecret - }) - .then(() => { - logger.info({ - msg: "Webhook was set", - url: config.botWebhook - }); - }); - }, 60000); + await setWebhook(); + }, 10000); }); }