From a6f21b8cbd8278b8f83c4b941278cf05ce863ea9 Mon Sep 17 00:00:00 2001 From: Bulat Kurbanov Date: Sun, 20 Mar 2022 20:26:50 +0300 Subject: [PATCH] Fix sending file --- src/bots/factory/bots/approved/index.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/bots/factory/bots/approved/index.ts b/src/bots/factory/bots/approved/index.ts index 9b03920..9738016 100644 --- a/src/bots/factory/bots/approved/index.ts +++ b/src/bots/factory/bots/approved/index.ts @@ -169,7 +169,18 @@ export async function createApprovedBot(token: string, state: BotState): Promise registerLanguageSettingsCallback(bot, 'on', CallbackData.ENABLE_LANG_PREFIX); registerLanguageSettingsCallback(bot, 'off', CallbackData.DISABLE_LANG_PREFIX); - bot.hears(new RegExp(`^/d_[a-zA-Z0-9]+_[\\d]+(@${me.username})*$`), async (ctx) => sendFile(ctx, state)); + bot.hears(new RegExp(`^/d_[a-zA-Z0-9]+_[\\d]+(@${me.username})*$`), async (ctx) => { + try { + await sendFile(ctx, state) + } catch (e) { + Sentry.captureException(e, { + extra: { + action: "sendFile", + message: ctx.message.text, + } + }) + } + }); bot.hears(new RegExp(`^/b_an_[\\d]+(@${me.username})*$`), async (ctx: Context) => { if (!ctx.message || !('text' in ctx.message)) {