diff options
| author | salmonik <salmonik@tuta.io> | 2026-09-05 19:35:21 +0200 |
|---|---|---|
| committer | salmonik <salmonik@tuta.io> | 2026-09-05 19:35:21 +0200 |
| commit | 8e868894cbcaf421c263f3555af4d29bef653420 (patch) | |
| tree | a6b6f1de5caeef59367e52a8b7cfa6c2cd9f201d /src/commands/ai.rs | |
| parent | remove ` from TTS and make events use lang.rs (diff) | |
| download | senator-sperma-8e868894cbcaf421c263f3555af4d29bef653420.tar.gz senator-sperma-8e868894cbcaf421c263f3555af4d29bef653420.zip | |
feat: piper now not a subprocess, cache system for TTS
Diffstat (limited to '')
| -rw-r--r-- | src/commands/ai.rs | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/commands/ai.rs b/src/commands/ai.rs index 61fb471..5dd98cb 100644 --- a/src/commands/ai.rs +++ b/src/commands/ai.rs | |||
| @@ -30,15 +30,14 @@ pub async fn senator( | |||
| 30 | }) | 30 | }) |
| 31 | .ok_or_else(lang::err_not_in_voice)?; | 31 | .ok_or_else(lang::err_not_in_voice)?; |
| 32 | 32 | ||
| 33 | let (audio_data, _) = | 33 | let audio_data = ctx.data().tts.synthesize(&response).await?; |
| 34 | crate::tts::synthesize(&ctx.data().config, &ctx.data().http_client, &response).await?; | ||
| 35 | 34 | ||
| 36 | let call = ctx | 35 | let call = ctx |
| 37 | .data() | 36 | .data() |
| 38 | .voice_manager | 37 | .voice_manager |
| 39 | .connect(guild_id, channel_id) | 38 | .connect(guild_id, channel_id) |
| 40 | .await?; | 39 | .await?; |
| 41 | let input = crate::voice::decode_audio(&audio_data)?; | 40 | let input = crate::tts::pcm_bytes_to_input(audio_data); |
| 42 | let mut call_lock = call.lock().await; | 41 | let mut call_lock = call.lock().await; |
| 43 | if call_lock.current_channel().is_some() { | 42 | if call_lock.current_channel().is_some() { |
| 44 | call_lock.play_input(input); | 43 | call_lock.play_input(input); |
