This Discord bot was an experiment with the OpenAI TTS API, where users would be able to join voice channels and hear messages sent in specified text channel. The bot also included a few other commands related to TTS functions, like /tts [text]
which would generate speech from a given prompt using the OpenAI or Google APIs.
- Create a bot at https://discord.dev/ and get a Bot Token.
- Install Python 3.12.2, create a
venv
, and install the dependencies listed atrequirements.txt
. - Initialize a MongoDB database using either MongoDB Atlas or another suitable cloud/local platform.
- Get an OpenAI API key at https://platform.openai.com
- (optional) Get Google Cloud Application Default Credentials (ADC) and load it into your working environment. Running this bot in a Google Compute Engine VM is recommended.
- Create a
.env
file with the three secrets you have acquired listed as so:
OPENAI_API_KEY=sk-...
DISCORD_TOKEN=MTI...
MONGODB_URL==mongodb+srv://...
- Update the
client.user.id
and following IDs at line 55 to match your environment. - Replace line 1239's user snowflake with your own Discord snowflake, so you can sync the bot's commands.
- Activate the
venv
and runpython main.py
to initialize the bot. - Add the bot to your server with a provided OAuth 2 URL back at https://discord.dev
- DM the bot
!sync
to sync the command tree with the Discord API.
Developed by Geneplore AI
Copyright (C) 2025 Geneplore AI
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.