Created a timeout for starting webhook mode to allow traefik to expose the webhook server and assign an SSL cert.
All checks were successful
Main / build-and-push-docker-image (20.x) (push) Successful in 3m11s

This commit is contained in:
2025-10-20 23:53:37 -04:00
parent 57b64e9b5e
commit bfc0f1e59a

View File

@@ -65,28 +65,31 @@ async function startWebhook(config: WebhookConfig) {
await bot.init();
// start server
const info = await serverManager.start();
logger.info({
msg: "Server started",
url: info.url
});
const info = await serverManager.start().then(async info => {
logger.info({
msg: "Server started",
url: info.url
});
// set webhook
await bot.api.setWebhook(config.botWebhook, {
allowed_updates: config.botAllowedUpdates,
secret_token: config.botWebhookSecret
});
logger.info({
msg: "Webhook was set",
url: config.botWebhook
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
});
});
}, 25000);
});
}
try {
if (config.isWebhookMode)
await setTimeout(() => {
if (config.isWebhookMode) startWebhook(config);
}, 20000);
if (config.isWebhookMode) await startWebhook(config);
else if (config.isPollingMode) await startPolling(config);
} catch (error) {
logger.error(error);