mirror of
https://github.com/flibusta-apps/book_bot.git
synced 2025-12-06 07:25:36 +01:00
Add bot debugger
This commit is contained in:
@@ -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);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user