Updated setTimeout
Some checks are pending
Main / build-and-push-docker-image (20.x) (pull_request) Waiting to run
Some checks are pending
Main / build-and-push-docker-image (20.x) (pull_request) Waiting to run
This commit is contained in:
24
src/main.ts
24
src/main.ts
@@ -64,16 +64,9 @@ async function startWebhook(config: WebhookConfig) {
|
|||||||
// to prevent receiving updates before the bot is ready
|
// to prevent receiving updates before the bot is ready
|
||||||
await bot.init();
|
await bot.init();
|
||||||
|
|
||||||
// start server
|
const setWebhook = async (): Promise<void> => {
|
||||||
const info = await serverManager.start().then(async info => {
|
|
||||||
logger.info({
|
|
||||||
msg: "Server started",
|
|
||||||
url: info.url
|
|
||||||
});
|
|
||||||
|
|
||||||
setTimeout(async () => {
|
|
||||||
// set webhook
|
// set webhook
|
||||||
await bot.api
|
return await bot.api
|
||||||
.setWebhook(config.botWebhook, {
|
.setWebhook(config.botWebhook, {
|
||||||
allowed_updates: config.botAllowedUpdates,
|
allowed_updates: config.botAllowedUpdates,
|
||||||
secret_token: config.botWebhookSecret
|
secret_token: config.botWebhookSecret
|
||||||
@@ -84,7 +77,18 @@ async function startWebhook(config: WebhookConfig) {
|
|||||||
url: config.botWebhook
|
url: config.botWebhook
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}, 60000);
|
};
|
||||||
|
|
||||||
|
// start server
|
||||||
|
const info = await serverManager.start().then(async info => {
|
||||||
|
logger.info({
|
||||||
|
msg: "Server started",
|
||||||
|
url: info.url
|
||||||
|
});
|
||||||
|
|
||||||
|
setTimeout(async () => {
|
||||||
|
await setWebhook();
|
||||||
|
}, 10000);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user