From 5b5f8317ec320634e0c797e9a1c222faf90d5600 Mon Sep 17 00:00:00 2001 From: polymorpher Date: Sun, 1 Oct 2023 02:29:19 -0700 Subject: [PATCH] allow prefix-command for analytics --- src/bot.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/bot.ts b/src/bot.ts index 8ceab7f0..06059527 100644 --- a/src/bot.ts +++ b/src/bot.ts @@ -54,6 +54,7 @@ import { VoiceTranslateBot } from './modules/voice-translate' import { TextToSpeechBot } from './modules/text-to-speech' import { VoiceToTextBot } from './modules/voice-to-text' import { now } from './utils/perf' +import { hasPrefix } from './modules/open-ai/helpers' Events.EventEmitter.defaultMaxListeners = 30 @@ -132,6 +133,10 @@ bot.use(async (ctx: BotContext, next: NextFunction): Promise => { break } } + const prefix = hasPrefix(ctx.message?.text ?? '') + if (!command && prefix) { + command = prefix + } await next() transaction.finish() if (ctx.transient.analytics.module) {