From e9a14fe570622a2e5c07e8475e71a403b4571c4e Mon Sep 17 00:00:00 2001 From: Bulat Kurbanov Date: Sat, 6 Aug 2022 21:09:26 +0300 Subject: [PATCH] Add bot debugger --- src/bots/factory/bots/approved/index.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/bots/factory/bots/approved/index.ts b/src/bots/factory/bots/approved/index.ts index eaafb10..9d682fa 100644 --- a/src/bots/factory/bots/approved/index.ts +++ b/src/bots/factory/bots/approved/index.ts @@ -1,5 +1,6 @@ import { Context, Telegraf, Markup, TelegramError } from 'telegraf'; import moment from 'moment'; +import debug from 'debug'; import { BotState } from '@/bots/manager/types'; @@ -24,6 +25,9 @@ import { getAnnotationHandler } from './annotations'; import Sentry from '@/sentry'; +const botDebugger = debug("approvedBot"); + + export async function createApprovedBot(token: string, state: BotState): Promise { const bot = new Telegraf(token, { telegram: { @@ -456,7 +460,7 @@ export async function createApprovedBot(token: string, state: BotState): Promise }); bot.catch((err, ctx: Context) => { - console.log({err, ctx}); + botDebugger.log({err, ctx}); Sentry.captureException(err); });