tools.voice_clone module

Voice synthesis tool: text-to-speech via ElevenLabs through Puter.js.

Delegates synthesis to bot.voice.router.synthesize(), which routes through the Puter.js/ElevenLabs shim and returns a path to a generated audio file.

tools.voice_clone.define()[source]

Return the tool definition (name, description, JSON parameters).

Returns:

Tool metadata consumed by the tool registry.

Return type:

dict

async tools.voice_clone.execute(kwargs, context)[source]

Synthesize speech and, when possible, post the audio to the channel.

Calls bot.voice.router.synthesize() with voice_name and text from kwargs. If context carries a channel_id and a usable discord_client, the resulting file is best-effort sent to that Discord channel; failures to send are swallowed.

Parameters:
  • kwargs (dict) – Tool arguments with voice_name and text.

  • context (dict) – Execution context (may include channel_id and discord_client).

Returns:

{"wav_path": <path>} on success, or {"error", "traceback"} on failure.

Return type:

dict