Skip to content

Commit

Permalink
added voicecn & voicees
Browse files Browse the repository at this point in the history
  • Loading branch information
theofandrich committed Oct 2, 2023
1 parent 79656ad commit 116b9ed
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/google-cloud/gcTextToSpeechClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type { CredentialBody } from 'google-auth-library/build/src/auth/credenti

export interface TextToSpeechParams {
text: string
languageCode: 'en-US' | 'yue-Hant-HK' | 'ru-RU'
languageCode: 'en-US' | 'yue-Hant-HK' | 'ru-RU' | 'cmn-CN' | 'es-ES'
gender: 'MALE' | 'FEMALE'
}

Expand Down
18 changes: 18 additions & 0 deletions src/modules/text-to-speech/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ enum SupportedCommands {
VOICEHK = 'voicehk',
VOICEHKF = 'voicehkf',
VOICERU = 'voiceru',
VOICECN = 'voicecn',
VOICEES = 'voicees'

}

export class TextToSpeechBot implements PayableBot {
Expand Down Expand Up @@ -68,6 +71,21 @@ export class TextToSpeechBot implements PayableBot {
const text = this.getTextFromMessage(ctx)
await this.onTextToSpeech(ctx, { text, gender: 'FEMALE', languageCode: 'ru-RU' })
}

if (ctx.hasCommand(SupportedCommands.VOICERU)) {
const text = this.getTextFromMessage(ctx)
await this.onTextToSpeech(ctx, { text, gender: 'FEMALE', languageCode: 'ru-RU' })
}

if (ctx.hasCommand(SupportedCommands.VOICECN)) {
const text = this.getTextFromMessage(ctx)
await this.onTextToSpeech(ctx, { text, gender: 'MALE', languageCode: 'cmn-CN' })
}

if (ctx.hasCommand(SupportedCommands.VOICEES)) {
const text = this.getTextFromMessage(ctx)
await this.onTextToSpeech(ctx, { text, gender: 'MALE', languageCode: 'es-ES' })
}
}

public async onTextToSpeech (ctx: OnMessageContext, params: TextToSpeechParams): Promise<void> {
Expand Down

0 comments on commit 116b9ed

Please sign in to comment.