Skip to content

Commit

Permalink
Merge pull request #325 from harmony-one/prefix-as-command
Browse files Browse the repository at this point in the history
allow prefix-command for analytics
  • Loading branch information
theofandrich authored Oct 2, 2023
2 parents ce9b9cb + 5b5f831 commit bc6d1b1
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 bc6d1b1

Please sign in to comment.