Discord.py bot that auto-transcribes voice messages using OpenAI Whisper
  • Python 85.8%
  • Dockerfile 14.2%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Dominik Louven f5492b693f update main
2024-11-30 15:04:24 +01:00
.github/workflows update main 2024-11-30 15:04:24 +01:00
.env fixup env 2024-11-30 13:47:24 +01:00
.gitignore h 2023-04-16 19:53:24 +08:00
Dockerfile set transcribe automatically to true in dockerfile 2024-11-30 13:47:38 +01:00
LICENSE Initial commit 2023-04-16 00:43:05 +08:00
main.py update opensource command 2024-11-30 13:47:59 +01:00
README.md update readme md (whisper model var) 2023-12-06 19:17:50 +04:00
requirements.txt update requirements 2024-11-30 13:47:45 +01:00

discord-voice-message-transcriber

Discord.py bot that transcribes voice messages using OpenAI Whisper

Screenshot 2023-04-15 at 11 38 56 PM

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 :)