A Discord bot that generates and plays Korwin-style sentences, combining random text segments into humorous audio clips.
- Generate random sentences by combining text segments from different categories
- Play generated sentences in Discord voice channels
- Automatically joins the voice channel with the most members every 30 minutes to play a random Korwin sentence
- Text-to-speech functionality using ElevenLabs API
- Caching of generated audio for better performance and api usage
-
Clone the repository
-
Install dependencies:
Using pip:
pip install -e .Alternatively, using uv (faster alternative to pip):
uv sync -
Create a
.envfile with the following variables:DISCORD_BOT_TOKEN=your_discord_bot_token GOOGLE_SHEETS_LINK=your_google_sheets_link ELEVEN_LABS_API_KEY=your_elevenlabs_api_key AUTHOR_ID=your_discord_user_id GUILD_ID=your_discord_server_idYou can use the sentence spreadsheet made by me
https://docs.google.com/spreadsheets/d/1w9nfZaAWvT_jBd0zKkj2zD2cV4k0bYS5FMD-UAa76ng/export?gid=0&format=csv
If you want to use a custom one, it must reassemble the format of the one provided above, and the export link must end in/export?gid=0&format=csvNote: The
GUILD_IDis required for the automatic 30-minute Korwin feature. The bot will join the voice channel with the most members in the server specified byGUILD_ID. TheAUTHOR_IDis used for owner-only commands like/bóg. -
Run the bot:
python main.py uv run main.py
You can run the bot using Docker:
-
Build the Docker image:
docker build -t korwinai-discord-bot . -
Run the Docker container with your environment variables:
docker run -d \ -e DISCORD_BOT_TOKEN=your_discord_bot_token \ -e GOOGLE_SHEETS_LINK=your_google_sheets_link \ -e ELEVEN_LABS_API_KEY=your_elevenlabs_api_key \ -e AUTHOR_ID=your_discord_user_id \ -e GUILD_ID=your_guild_id \ --name korwinai-bot \ korwinai-discord-bot -
View logs:
docker logs -f korwinai-bot -
Stop the bot:
docker stop korwinai-bot -
Remove the container:
docker rm korwinai-bot
/korwin: Plays a random sentence from the catalogue in the voice channel/bóg: Plays a custom text-to-speech message (only available to the bot owner)
For development, install the optional development dependencies:
Using pip:
pip install -e ".[dev]"
Alternatively, using uv:
uv sync --all-extras
This will install:
- black for code formatting
- isort for import sorting
This project is licensed under the MIT License.