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
.env
file in the project directory from the.env-sample
provided and replace the api keys. -
Run the bot using
python bot.py
.
- Send a message mentioning the bot or use the
!ask
command to ask a question or provide input to the bot. - Use the
!persona
command to display the current bot persona. - Use the
!persona your_new_persona
command to change the bot persona.