This repository contains the code for a Discord bot that integrates with OpenAI's GPT-3.5 model. The bot responds to prompts, answers questions, and includes some additional features like basic interactions and commands.
- Slash Commands: Supports various commands such as
/hello
,/ping
,/prompt
,/help
,/invite
, and/shutdown
. - AI-Powered Responses: Uses OpenAI's GPT-3.5 to generate responses based on user prompts.
- Simple Setup: Customizable and ready for deployment with minimal configuration.
- Guild Syncing: Slash commands are synced for specific Discord guilds, ensuring faster availability.
- Interaction Handling: Handles basic user interactions and displays helpful responses.
- Python 3.8+
- OpenAI API Key
- Discord Bot Token
- Libraries:
discord.py
openai
- Clone the repository:
git clone https://github.com/yourusername/discord-ai-bot.git cd discord-ai-bot
This repository contains the code for a Discord bot that integrates with OpenAI's GPT-3.5 model. The bot responds to prompts, answers questions, and includes some additional features like basic interactions and commands.
- Slash Commands: Supports various commands such as
/hello
,/ping
,/prompt
,/help
,/invite
, and/shutdown
. - AI-Powered Responses: Uses OpenAI's GPT-3.5 to generate responses based on user prompts.
- Simple Setup: Customizable and ready for deployment with minimal configuration.
- Guild Syncing: Slash commands are synced for specific Discord guilds, ensuring faster availability.
- Interaction Handling: Handles basic user interactions and displays helpful responses.
- Python 3.8+
- OpenAI API Key
- Discord Bot Token
- Libraries:
discord.py
openai
- Clone the repository:
git clone https://github.com/yourusername/discord-ai-bot.git cd discord-ai-bot
- Install the required dependencies
pip install -r requirements.txt
- Replace the placeholder
YOUR-BOT-TOKEN
with your actual Discord bot token inbot.py
:BOT_TOKEN = "YOUR-BOT-TOKEN"
- Replace the placeholder YOUR-OPEN-AI-API-KEY with your OpenAI API key in openai_client.py:
API_KEY = "YOUR-OPEN-AI-API-KEY"
- Update the GUILD_ID to your server's guild ID in bot.py:
GUILD_ID = 000000000000000000 # replace with your guild id
- Make sure to keep your bot token and API key secure and never share them publicly.
This way, each step is clearly defined, and the code changes are presented in a neat, readable format. The use of code blocks and numbered instructions makes the section more visually appealing and easier to follow.
python bot.py