Skip to content

Commit

Permalink
add whisper payment for voice-command
Browse files Browse the repository at this point in the history
  • Loading branch information
fegloff committed Jan 25, 2024
1 parent df01ddd commit 6516219
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/modules/voice-command/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ export class VoiceCommand implements PayableBot {
}

public getEstimatedPrice (ctx: OnMessageContext): number {
return 0
const { voice } = ctx.update.message
const seconds = voice?.duration ?? 0
return seconds * 0.005
}

getCommand (transcribedText: string): string {
Expand Down Expand Up @@ -82,7 +84,7 @@ export class VoiceCommand implements PayableBot {
fs.renameSync(path, filename)
const resultText = await speechToText(fs.createReadStream(filename))

console.log('VoiceCommand prompt detected', resultText)
this.logger.info(`[VoiceCommand] prompt detected: ${resultText}`)

fs.rmSync(filename)
const command = this.getCommand(resultText)
Expand Down

0 comments on commit 6516219

Please sign in to comment.