feat(telegrambot.ts): use Nest logger

This commit is contained in:
Aleksandr Bukhalo 2020-01-12 01:58:34 +03:00
parent 9606daaf63
commit 2617c19af9

View File

@ -1,4 +1,4 @@
import { Injectable, Inject } from '@nestjs/common' import { Injectable, Inject, Logger } from '@nestjs/common'
import { ModuleRef } from '@nestjs/core' import { ModuleRef } from '@nestjs/core'
import Telegraf, { ContextMessageUpdate } from 'telegraf' import Telegraf, { ContextMessageUpdate } from 'telegraf'
import { flatten, head } from 'lodash' import { flatten, head } from 'lodash'
@ -15,6 +15,7 @@ import { InvalidConfigurationException } from './InvalidConfigurationException'
@Injectable() @Injectable()
export class TelegramBot { export class TelegramBot {
private readonly logger = new Logger(TelegramBot.name, true);
private readonly sitePublicUrl?: string private readonly sitePublicUrl?: string
private readonly bot: Bot private readonly bot: Bot
private ref: ModuleRef private ref: ModuleRef
@ -54,7 +55,7 @@ export class TelegramBot {
this.bot.telegram this.bot.telegram
.setWebhook(url) .setWebhook(url)
.then(() => console.log(`Webhook set success @ ${url}`)) .then(() => Logger.log(`Webhook set success @ ${url}`))
return this.bot.webhookCallback(`/${path}`) return this.bot.webhookCallback(`/${path}`)
} }