1
0
Fork 0
mirror of https://github.com/muerwre/vk-tg-bot.git synced 2025-04-24 22:46:41 +07:00

#5 fixed logs

This commit is contained in:
Fedor Katurov 2021-05-12 13:50:08 +07:00
parent 2bcf8ff772
commit 46d24cd9dd

View file

@ -23,18 +23,19 @@ export class TelegramApi {
* Probes webhook url and falls back to polling mode on error
*/
public probe = async () => {
if (!this.telegram.webhook.enabled || !this.telegram.webhook.url) {
if (!this.telegram.isWebhookEnabled) {
return;
}
try {
await axios.get(this.telegram.webhook.url);
await axios.get(this.telegram.webhook.url!);
logger.info(
`probing telegram webhook at ${this.telegram.webhook.url} succeeded`
`probing telegram webhook at ${this.telegram.webhook.url}: ok`
);
} catch (e) {
logger.warn(
`probing telegram webhook at ${this.telegram.webhook.url} failed, falling back to polling mode`
`probing telegram webhook at ${this.telegram.webhook.url}: FAILED, falling back to polling mode`
);
await this.telegram.bot.launch();
}