This is a simple Discord bot that uses the OpenAI GPT-4 API to generate responses to user messages. The bot can respond to messages when mentioned or when the !ask command is used. It also allows for managing the bot's persona using the !persona command.
- Python 3.8+
- discord.py
- openai
- python-dotenv
-
Clone this repository.
-
Install the required dependencies by running
pip install -r requirements.txt. -
Set up a new Discord bot and retrieve its token. You can follow this guide if you need help.
-
Set up an OpenAI account and retrieve your API key.
-
Create a
.envfile in the project directory from the.env-sampleprovided and replace the api keys. -
Run the bot using
python bot.py.
- Send a message mentioning the bot or use the
!askcommand to ask a question or provide input to the bot. - Use the
!personacommand to display the current bot persona. - Use the
!persona your_new_personacommand to change the bot persona.