This is a Discord bot created using the Python programming language and the Discord API. The bot uses the OpenAI API to respond to commands in the Discord chat.
- Python 3.x
- discord.py
- openai
- Clone the repository
git clone https://https://github.com/mmdmirh/ChatGPT-DiscordBot.git
- Navigate to the repository
cd <repository>
- Create a virtual environment (optional)
python -m venv venv
- Activate the virtual environment (optional)
On Windows:
venv\Scripts\activate
On Linux and macOS:
source venv/bin/activate
- Install the required packages
pip install -r requirements.txt
- Create a
.env
file in the repository root and add the following variables:
OPENAI_API_KEY=<your OpenAI API key>
DISCORD_BOT_TOKEN=<your Discord bot token>
- Run the bot
python mybot.py
The bot will respond to the following command in the Discord chat:
- !gpt : The bot will generate a response using OpenAI's language generation model. The prompt should be written after the !gpt command.
Please feel free to contribute to this project by submitting pull requests or reporting issues.