This Python Discord bot uses the ChatGPT 3.5 Turbo API to generate text and images based on user input.
You need to have your Discord bot set up on the Discord Developer Portal with all intents and necessary permissions enabled, and your OpenAI API key ready.
You can create and configure a Discord bot at https://discord.com/developers/applications, and you can find your personal OpenAI API key at https://platform.openai.com/account/api-keys.
Permissions for the Discord bot:
Everything under "Text Permissions"
Scopes for the Discord bot:
Just "bot."
Make sure to enable all intents for the Discord bot.
- Clone this repository:
git clone https://github.com/SyntaxWarrior30/Python-Discord-Bot.git
- Enter the Discord bot's current working directory:
cd ChatGPT-Discord-Bot
- Install the required dependencies:
pip install -r requirements.txt
- Input your Discord bot token and ChatGPT API key in the .env file:
token={Your Discord bot token}
api_key={Your ChatGPT API key}
- Run the bot:
python main.py
This bot's prefix for text is "!" and its prefix for images is "/". Prefix for text is unnecessary in DM channels.
Use the following commands to interact with the bot:
!chat [prompt] - Generates a response to the given prompt using ChatGPT 3.5 Turbo API.
/image [prompt] - Generates and sends an image based on the given prompt using ChatGPT 3.5 Turbo API.