Translation
Message translation using DeepL and audio transcription using Groq Whisper. The cog provides slash commands and context menus (right-click on a message).
This cog requires a DeepL API key configured in the dashboard. Audio transcription additionally requires a Groq API key. Keys are encrypted (Fernet) and stored per-guild.
Context Menus
Translate Message
Translates message text to the user's preferred language.
How to use: Right-click on a message → Apps → Translate Message
Behavior:
- Extracts text from the message (content + embed title/description/fields/footer)
- Checks the user's language preference
- If no preference → displays a modal with a language code field
- Translates via DeepL API
- Returns the translation as an ephemeral message
Limits: Max 5000 characters of text to translate
Errors:
- Message has no text to translate
- Missing DeepL API key
- Invalid key (HTTP 403)
- API limit exceeded (HTTP 456)
- Timeout / network error
Transcribe & Translate
Transcribes an audio attachment and translates the transcription.
How to use: Right-click on a message with an audio attachment → Apps → Transcribe & Translate
Behavior:
- Finds the first audio/video attachment in the message
- Checks the user's language preference
- If no preference → modal with language code
- Downloads the audio file
- Sends to Groq Whisper API → transcription
- Translates transcription via DeepL → result
- Returns embed with two fields: original transcription + translation
Supported formats: .ogg, .mp3, .wav, .m4a, .flac, .webm, .mp4
Size limit: 25 MB
Errors:
- No audio attachment
- File too large (>25 MB)
- Missing Groq API key
- Transcription or translation error
Slash Commands
/setlang
Sets the preferred translation language (saved globally, works on all servers).
| Parameter | Type | Required | Description |
|---|---|---|---|
| (none) | — | — | Displays language selection menu |
Permissions: Everyone
Example: /setlang → select language from dropdown
Behavior:
- Displays dropdown with language list (paginated, max 25 per page)
- ◀/▶ buttons for navigating between pages
- After selection → saves preference in
user_language_prefsdatabase - Edits original message with confirmation
Success: "Language set to: [name] ([code])"
/languages
Displays a list of all supported translation languages.
| Parameter | Type | Required | Description |
|---|---|---|---|
| (none) | — | — | — |
Permissions: Everyone
Example: /languages
Success: Ephemeral embed with a list of ~30 languages in format `CODE` — Name
Supported Languages
| Code | Language | Code | Language | |
|---|---|---|---|---|
| BG | Bulgarian | LT | Lithuanian | |
| CS | Czech | LV | Latvian | |
| DA | Danish | NB | Norwegian | |
| DE | German | NL | Dutch | |
| EL | Greek | PL | Polish | |
| EN-GB | English (British) | PT-BR | Portuguese (BR) | |
| EN-US | English (American) | PT-PT | Portuguese (EU) | |
| ES | Spanish | RO | Romanian | |
| ET | Estonian | RU | Russian | |
| FI | Finnish | SK | Slovak | |
| FR | French | SL | Slovenian | |
| HU | Hungarian | SV | Swedish | |
| ID | Indonesian | TR | Turkish | |
| IT | Italian | UK | Ukrainian | |
| JA | Japanese | ZH | Chinese | |
| KO | Korean |
Configuration
The cog requires API keys configured in the dashboard:
| Key | Description | Required |
|---|---|---|
deepl_api_key | DeepL key (Free or Pro) | Yes |
groq_api_key | Groq key (for Whisper) | Only for transcription |
The bot automatically detects the DeepL key type:
- Keys ending with
:fx→ Free API (api-free.deepl.com) - Others → Pro API (
api.deepl.com)
The decrypted DeepL key is cached for 30 minutes in bot memory to avoid repeated decryption.