Skip to content

Commit

Permalink
allow prefix-command for analytics
Browse files Browse the repository at this point in the history
  • Loading branch information
polymorpher committed Oct 1, 2023
1 parent 8618ef9 commit 5b5f831
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/bot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -132,6 +133,10 @@ bot.use(async (ctx: BotContext, next: NextFunction): Promise<void> => {
break
}
}
const prefix = hasPrefix(ctx.message?.text ?? '')
if (!command && prefix) {
command = prefix
}
await next()
transaction.finish()
if (ctx.transient.analytics.module) {
Expand Down

0 comments on commit 5b5f831

Please sign in to comment.