fix-startup #77

Merged
werewolfkid merged 13 commits from fix-startup into main 2025-10-21 00:38:49 -04:00
11 changed files with 195 additions and 136 deletions
Showing only changes of commit bfc0f1e59a - Show all commits

View File

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