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:
30
src/main.ts
30
src/main.ts
@@ -64,6 +64,21 @@ 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();
|
||||||
|
|
||||||
|
const setWebhook = async (): Promise<void> => {
|
||||||
|
// 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
|
// start server
|
||||||
const info = await serverManager.start().then(async info => {
|
const info = await serverManager.start().then(async info => {
|
||||||
logger.info({
|
logger.info({
|
||||||
@@ -72,19 +87,8 @@ async function startWebhook(config: WebhookConfig) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
setTimeout(async () => {
|
setTimeout(async () => {
|
||||||
// set webhook
|
await setWebhook();
|
||||||
await bot.api
|
}, 10000);
|
||||||
.setWebhook(config.botWebhook, {
|
|
||||||
allowed_updates: config.botAllowedUpdates,
|
|
||||||
secret_token: config.botWebhookSecret
|
|
||||||
})
|
|
||||||
.then(() => {
|
|
||||||
logger.info({
|
|
||||||
msg: "Webhook was set",
|
|
||||||
url: config.botWebhook
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}, 60000);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user