An up to date Discord Bot that generates replies using ChatGPT official API. Both browser and browserless options available as well as using the the new Microsoft Edge/Bing GPT which is ChatGPT with internet access! Aimed to be as simple as possible so that people can set it up and modify on their own with ease.
bot.py
uses the official OpenAI API I highly recommend you using this one, it does however cost money (uses your tokens).
bot2.py
uses unofficial API and you risk having your account being banned, I take no responsibility for what happens to your account if you use this bot.
bot3.py
EdgeGPT requires an account with access to Sydney to use.
/chat (message) [new_conversation (optional)] [temperature (optional)]
- Talk to chatGPT and get a response. You can adjust the temperature from 0-1 which controls how random the output is, by default it is 0.75. New conversations can be started via setting the new_conversation option to True
/rollback [amount]
- Go back a set amount of conversation steps in your message history
/chat (message) [conversationID (optional)] [parentID (optional)] [new_conversation (optional)]
Talk to chatGPT and get a response. ConversationID and parentID are optional parameters that allow you to continue a previous conversation if you'd like, keep in mind you must have both to continue a previous conversation. New conversations can be started via setting the new_conversation option to True
/rollback [amount]
- Go back a set amount of conversation steps in your message history
/delete-conversation [conversationID] [delete_all (optional)]
- Delete a conversation, set delete_all to true to delete all conversations
/chat (message) [new_conversation (optional)]
Talk to EdgeGPT and get a response that has internet access - you will get references from where the answer gets the information. Set new_conversation to true if you want to start a new conversation.
Install the associated bot.py requirements.txt file
pip install -r requirements.txt
- Create account on OpenAI
- Go to https://platform.openai.com/account/api-keys
- Copy API key
You can get your session token manually from your browser:
- Go to https://chat.openai.com/api/auth/session
- Press F12 to open console
- Go to Application then Cookies
- Copy the session token value in __Secure-next-auth.session-token
- Paste it into
config.json
file
You can modify the code to use email and password if you'd like just follow the guide by acheong08 - chatGPT authentication
- Go to https://discord.com/developers/
- Create a new application and choose a name
- Go to the Bot tab and then click Add Bot
- Copy bot token and put it into the
config.json
file - Make sure you turn on the required intents for the bot e.g. Message Intents
- Invite bot to your server using the OAuth2 URL Generator
- Run
python3 bot.py
to start the bot - A browser will open up and you will need to press verify you are a human button
- Use the commands and have fun!
Released under the GNU GPL v3 license.