mirror of
https://github.com/Maks1mS/nestjs-telegraf.git
synced 2024-12-25 07:24:39 +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
|
this.bot.telegram
|
||||||
.setWebhook(`${this.sitePublicUrl}/${path}`)
|
.setWebhook(url)
|
||||||
.then(() => console.log('Webhook set success'))
|
.then(() => console.log(`Webhook set success @ ${url}`))
|
||||||
|
|
||||||
return this.bot.webhookCallback(`/${path}`)
|
return this.bot.webhookCallback(`/${path}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
public startPolling() {
|
public startPolling() {
|
||||||
try {
|
this.bot.telegram.deleteWebhook().then(
|
||||||
this.bot.startPolling()
|
() => this.bot.startPolling(),
|
||||||
} catch (e) {
|
() => {
|
||||||
// okay, never mind
|
// okay, never mind
|
||||||
}
|
},
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
private createHandlers(): Handler[] {
|
private createHandlers(): Handler[] {
|
||||||
|
Loading…
Reference in New Issue
Block a user