fix: add removing webhook before start pooling

This commit is contained in:
Igor Kamyshev 2019-07-26 10:50:31 +03:00
parent 2b2e2fca03
commit b9d659efef

View File

@ -50,19 +50,22 @@ export class TelegramBot {
)
}
const url = `${this.sitePublicUrl}/${path}`
this.bot.telegram
.setWebhook(`${this.sitePublicUrl}/${path}`)
.then(() => console.log('Webhook set success'))
.setWebhook(url)
.then(() => console.log(`Webhook set success @ ${url}`))
return this.bot.webhookCallback(`/${path}`)
}
public startPolling() {
try {
this.bot.startPolling()
} catch (e) {
// okay, never mind
}
this.bot.telegram.deleteWebhook().then(
() => this.bot.startPolling(),
() => {
// okay, never mind
},
)
}
private createHandlers(): Handler[] {