feat: Implement multi-voice support and management
Refactor the TTS handling to support multiple, user-selectable voices. This replaces the previous single-voice system. Key changes: - Introduce VoiceManager to handle loading and managing voices from a dedicated oices/ directory. - Add slash commands (/voice list, /set, /current, /refresh) for users to manage their personal TTS voice. - Implement on-demand voice loading to improve startup time and memory usage. - Remove the old ts_handler.py and single voice .wav files in favor of the new system. - Update configuration to specify a voices directory instead of a single file path.
This commit is contained in:
@@ -7,7 +7,8 @@ load_dotenv()
|
||||
class Config:
|
||||
DISCORD_TOKEN: str = os.getenv("DISCORD_TOKEN", "")
|
||||
TEXT_CHANNEL_ID: int = int(os.getenv("TEXT_CHANNEL_ID", "0"))
|
||||
VOICE_WAV_PATH: str = os.getenv("VOICE_WAV_PATH", "./voice.wav")
|
||||
VOICES_DIR: str = os.getenv("VOICES_DIR", "./voices")
|
||||
DEFAULT_VOICE: str | None = os.getenv("DEFAULT_VOICE", None)
|
||||
|
||||
@classmethod
|
||||
def validate(cls) -> list[str]:
|
||||
@@ -17,6 +18,6 @@ class Config:
|
||||
errors.append("DISCORD_TOKEN is not set")
|
||||
if cls.TEXT_CHANNEL_ID == 0:
|
||||
errors.append("TEXT_CHANNEL_ID is not set")
|
||||
if not os.path.exists(cls.VOICE_WAV_PATH):
|
||||
errors.append(f"Voice WAV file not found: {cls.VOICE_WAV_PATH}")
|
||||
if not os.path.exists(cls.VOICES_DIR):
|
||||
errors.append(f"Voices directory not found: {cls.VOICES_DIR}")
|
||||
return errors
|
||||
|
||||
Reference in New Issue
Block a user