Readme update discord bot

mondadori89 2 years ago committed by Kaveen Kumarasinghe
parent 869a97b5fe
commit ed24ca6e01

@ -1,44 +1,58 @@
# Requirements # Requirements
`pip3 install -r requirements.txt` `pip3 install -r requirements.txt`
OpenAI API Key (https://beta.openai.com/docs/api-reference/introduction) OpenAI API Key (https://beta.openai.com/docs/api-reference/introduction)
Discord Bot Token (https://discord.com/developers/applications) Discord Bot Token (https://discord.com/developers/applications)
You can learn how to add the discord bot to your server via https://www.ionos.co.uk/digitalguide/server/know-how/creating-discord-bot/ You can learn how to add the discord bot to your server via https://www.ionos.co.uk/digitalguide/server/know-how/creating-discord-bot/
Both the OpenAI API key and the Discord bot token needed to be loaded into a .env file in the same local directory as the bot file. Both the OpenAI API key and the Discord bot token needed to be loaded into a .env file in the same local directory as the bot file.
You also need to add a DEBUG_GUILD id and a DEBUG_CHANNEL id, the debug guild id is a server id, and the debug channel id is a text-channel id in Discord. Your final .env file should look like the following: You also need to add a DEBUG_GUILD id and a DEBUG_CHANNEL id, the debug guild id is a server id, and the debug channel id is a text-channel id in Discord. Your final .env file should look like the following:
``` ```
OPENAI_TOKEN="TOKEN" OPENAI_TOKEN="<openai_api_token>"
DISCORD_TOKEN="TOKEN" DISCORD_TOKEN="<discord_bot_token>"
DEBUG_GUILD="974519864045756446" DEBUG_GUILD="974519864045756446" #discord_server_id
DEBUG_CHANNEL="977697652147892304" DEBUG_CHANNEL="977697652147892304" #discord_chanel_id
``` ```
# Usage ## Bot on discord:
`python3.7 bot.py` - Create a new Bot on Discord Developer Portal:
- Applications -> New Application
# Commands - Generate Toker for the app (discord_bot_token)
- Select App (Bot) -> Bot -> Reset Token
`!g` - Display help text for the bot - Toogle PRESENCE INTENT:
- Select App (Bot) -> Bot -> PRESENCE INTENT
`!g converse` - Start a conversation with the bot, like ChatGPT - Add Bot the the server.
- Select App (Bot) -> OAuth2 -> URL Generator -> Select Scope: Bot
`!g end` - End a conversation with the bot. - Bot Permissions will appear, select the desired permissions
- Copy the link generated below and paste it on the browser
`!gp` - Display settings for the model (temperature, top_p, etc) - On add to server select the desired server to add the bot
`!gs <setting> <value>` - Change a model setting to a new value # Usage
`!g <prompt>` Ask the GPT3 Davinci 003 model a question. `python3.7 bot.py`
`!gu` Estimate current usage details (based on davinci) # Commands
`!gs low_usage_mode True/False` Turn low usage mode on and off. If on, it will use the curie-001 model, and if off, it will use the davinci-003 model. `!g` - Display help text for the bot
`!g converse` - Start a conversation with the bot, like ChatGPT
`!g end` - End a conversation with the bot.
`!gp` - Display settings for the model (temperature, top_p, etc)
`!gs <setting> <value>` - Change a model setting to a new value
`!g <prompt>` Ask the GPT3 Davinci 003 model a question.
`!gu` Estimate current usage details (based on davinci)
`!gs low_usage_mode True/False` Turn low usage mode on and off. If on, it will use the curie-001 model, and if off, it will use the davinci-003 model.

1216
bot.py

File diff suppressed because it is too large Load Diff

@ -2,3 +2,4 @@ py-cord==2.3.2
openai==0.25.0 openai==0.25.0
python-dotenv==0.21.0 python-dotenv==0.21.0
transformers==4.25.1 transformers==4.25.1

@ -0,0 +1,7 @@
OPENAI_TOKEN="<openai_api_token>"
DISCORD_TOKEN="<discord_bot_token>"
DEBUG_GUILD="755420092027633774"
DEBUG_CHANNEL="907974109084942396"
Loading…
Cancel
Save