- Python 85.8%
- Dockerfile 14.2%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| .github/workflows | ||
| .env | ||
| .gitignore | ||
| Dockerfile | ||
| LICENSE | ||
| main.py | ||
| README.md | ||
| requirements.txt | ||
discord-voice-message-transcriber
Discord.py bot that transcribes voice messages using OpenAI Whisper
Get Started
To use the bot, you will first need to install Python. Python 3.10 is recommended as it's the easiest to set up. 3.11 also works and can provide some speedup, but you may need to install a pre-release version of numba using pip install --pre numba.
You can install the needed dependencies by doing pip install -r requirements.txt.
You will also need a bot token (acquirable at the Discord Developer Portal), which you will need to add to the .env file after BOT_TOKEN=. Make sure your bot has the Message Content intent, or it won't be able to read any voice messages.
Finally, in the config.ini file, you can change some settings that alter how the bot works. You will need to add your User ID in the admin > users variable, just so you can control the bot via commands later. Alternately, you can also input a Role ID in admin > role to allow users with a specific role to control the bot, but this requires the Server Members intent.
Once you have successfully started the bot, send "!synctree" in a channel the bot can see in order to get context menu functionality + slash commands working.
Docker
Build an image with docker build -t discord-voice-message-transcriber . (run from repository folder).
It builds and runs well on both arm64 (m1 tested) and amd64 platforms without additional flags.
Run it with
docker run -it \
-e BOT_TOKEN="..." \
-e ADMIN_USERS="..." \
-e TRANSCRIBE_ENGINE="..." \
-e TRANSCRIBE_APIKEY="..." \
-e TRANSCRIBE_AUTOMATICALLY="..." \
-e TRANSCRIBE_VMS_ONLY="..." \
-e ADMIN_USERS="..." \
-e ADMIN_ROLE="..." \
-e WHISPER_MODEL="..." \
discord-voice-message-transcriber
WHISPER_MODEL available values: tiny, base, small, medium, large, tiny.en, base.en, small.en, medium.en and etc... more: https://github.com/openai/whisper Default WHISPER_MODEL is 'base'
Only BOT_TOKEN variable is required, also I recommend to specify either ADMIN_USERS or ADMIN_ROLE to be able to control bot.
So fast start will be look like:
docker run -it \
-e BOT_TOKEN="token" \
discord-voice-message-transcriber
Contribute & Other Stuff
Sorry for the spaghetti code, I frankly have no idea how to do voice recognition efficiently.
Feel free to make pull requests to improve stuff for the next person.
If you encounter any issues with the code, leave them in the issue tracker and someone might fix it for you.
The code is licensed under the MIT license, which probably means you can do whatever with it, so have fun :)