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();
// 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);