A Python bot for chat-to-speech, pronunciation dictionaries, and voice-channel join and leave notifications.
Separate settings and playback queues support use across multiple servers.
Pythondiscord.pyAzure Speech SDKFFmpeg
RECEIVEPROCESSPLAY
Status
Implemented
FIELD
Bots & automation
PERIOD
2025 / DEVELOPED
LAST UPDATED
2026-10-28
Problem
The problem to solve
During voice calls, chat messages and participant changes were easy to miss. Speech and notifications needed to work across servers without sharing audio queues or settings.
DESIGN IN DETAIL
Design and operation
From a message to audible speech
discord.py receives messages, applies custom pronunciations and text preprocessing, and requests speech generation. URLs, emoji, long numbers, and repeated characters are prepared for listening rather than read literally. Generated audio is managed through playback queues with a skip control.
Separate servers without duplicating the bot
Playback queues and workers are separated by server so that one server’s messages do not enter another server’s playback sequence. Notification destinations and settings are also handled per server, combining shared processing with isolated usage contexts.
Extend voice selection and controls in stages
Speech generation moved from gTTS to Azure Speech SDK. Voice selection and slash commands such as /join, /voice, and /status extend the bot beyond reading messages, allowing users to inspect connection and configuration state.
Distinguish connection evidence from continuous availability
November 2025 logs record connections to 11 servers, speech worker startup, and automatic backup execution. Disconnections, DNS errors, and empty-text speech failures also occurred. Connection records are not treated as proof of uninterrupted service; recovery and failure feedback remain improvement areas.
Main workflow
Connect the bot to a voice channel and use the associated chat.
Apply custom pronunciations and preprocessing to incoming text.
Play generated audio through the server’s own queue.
Inspect or change voice and status through commands, and skip playback when needed.
01 / ROLE
Responsibilities
Define features and commands around everyday use
Implement speech, notifications, and dictionaries in Python
Design per-server settings and queue management
Use runtime logs to investigate errors and improve behavior
02 / APPROACH
Design decisions
Handle message and voice-channel events with discord.py
Preprocess URLs, emoji, long numbers, and custom pronunciations
Separate playback queues and workers for each server
Migrate speech generation from gTTS to Azure Speech SDK with voice selection
Add slash commands, status reporting, and settings backups
03 / VERIFICATION
Verification
Historical logs confirm connection, voice-channel joining, and speech worker startup
Logs show join and leave speech, voice selection, and command synchronization across servers
Automatic backup execution appears in runtime logs
Recorded disconnections, DNS failures, and empty-text speech errors informed further fixes
04 / CONSTRAINTS
Constraints
Depends on Discord and speech-service connectivity
Speech latency and queues under bursts of messages
Server-specific settings, permissions, and notification destinations
Outputs
Delivered functionality
An independently developed and iterated bot with historical runtime logs. Current continuous availability has not been verified. Server names, user information, and credentials are omitted.
Delivered
Chat-to-speech and custom pronunciation dictionary
Voice-channel join and leave notifications
Per-server playback queues and settings
Voice selection, slash commands, and status reporting
Settings backups and runtime logs
Next steps
Ongoing improvements
Further improvements
Improve recovery after disconnection
Refine retry handling and feedback when speech generation fails
Tell me what you want to build or the problem you need to solve.
Your current workflow, software environment, and preferred timeline help make the discussion concrete. You can get in touch before the specifications are final.