Add bot debugger

This commit is contained in:
2022-08-06 21:09:26 +03:00
parent 376fd7aa35
commit e9a14fe570

View File

@@ -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<Telegraf> {
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);
});