mirror of
https://github.com/Maks1mS/nestjs-telegraf.git
synced 2024-12-24 15:04:38 +03:00
fix: add removing webhook before start pooling
This commit is contained in:
parent
2b2e2fca03
commit
b9d659efef
@ -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[] {
|
||||
|
Loading…
Reference in New Issue
Block a user