-
Notifications
You must be signed in to change notification settings - Fork 0
Setup guide
-
You need a Discord account, then you have to access to the Discord Developer Portal
-
Then you will need to create a new application, you must give it a name, but you can change the name later
-
Now in the Bot menu you will click Add Bot, there you can select an icon for the bot or change it username, after this you will click View Token, this token its your secret token to get access via the API, you must save this Token and you shouldn't share it publicly
-
Then in the OAuth2 submenu you must search for the URL Generator submenu, there you will need the permissions required for you app, the you will need to check "bot" and "applications.commands", then when you check those option you will get a new window called "BOT PERMISSIONS", in this windows you have to check the permissions, if you are going to edit the code of the bot and add other features you must check which permissions would be required and check it at this point, the minimum permissions are:
- Read Messages/View Channels
- Send Messages
- Send TTS Messages
- Embed Links
- Attach Files
-
After checking the permissions you will have a discord link, this discord will allow you to associate your discord bot with your discord server, paste that link into your browser and add your bot into the server where you are going to test it
- Now it's time to create an OpenAI API Key, to do this you should have an OpenAI Developer Account, then in the View API Keys you can create a new secret key, you must save this secret key and you shouldn't share it publicly
-
Create a new replit and clone this repository or fork this Replit
-
Create a copy of
example_config.ymland rename it asconfig.ymlopen it and configure the bot (A full guide of the config file can be found here):
bot:
token: "YOUR_DISCORD_KEY" # Paste here the token you got from Discord Developer Portal
use_audio: False
open_ai:
token: "YOUR_OPEN_AI_KEY" # Paste here the OpenAI secret key you got from OpenAI platform
role: "You are a helpful assistant." # Change here chatbot's role, this will change it's behavior answering questions
-
Now press Run, the first time the Replit execute the poetry package manager will install the required libraries so it will take a while
-
Now check in your Discord server using the command
your_prefix.hello
-
Install
Python 3.9.16using the Python page -
Clone the repository, you can either download the repository as a .zip and unzip, or clone the repository using git:
git clone https://github.com/02loveslollipop/DiscordGPTChatBot.git- Install FFmpeg:
winget install ffmpeg- Create a copy of
example_config.ymland rename it asconfig.ymlopen it and configure the bot (A full guide of the config file can be found here):
bot:
token: "YOUR_DISCORD_KEY" # Paste here the token you got from Discord Developer Portal
open_ai:
token: "YOUR_OPEN_AI_KEY" # Paste here the OpenAI secret key you got from OpenAI platform
role: "You are a helpful assistant." # Change here chatbot's role, this will change it's behavior answering questions- Now in the root of the repository execute this command to update all the required libraries:
pip -r requirements.txt- Then execute the python script in the root of the repository:
python main.py- Now check in your Discord server using the command
your_call_sign.hello
- Install Python 3.9 in the Ubuntu instance, as this isn't the last release we are going to get it from the deadsnakes PPA:
sudo apt update
sudo apt install software-properties-common -y
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt install python3.9 -y
sudo apt install python3-pip -y
sudo apt install ffmpeg -y-
Then we are going to check if we installed the correct version, it should say
Python 3.9.xx -
Clone the repository:
git clone https://github.com/02loveslollipop/DiscordGPTChatBot.git- Create a copy of
example_config.ymland rename it asconfig.yml:
cp example_config.yml config.yml- Open
config.ymland configure the bot (A full guide of the config file can be found here):
bot:
token: "YOUR_DISCORD_KEY" # Paste here the token you got from Discord Developer Portal
open_ai:
token: "YOUR_OPEN_AI_KEY" # Paste here the OpenAI secret key you got from OpenAI platform
role: "You are a helpful assistant." # Change here chatbot's role, this will change it's behavior answering questions- Now execute this command to update all the required libraries:
sudo su
pip install -r /path/to/your/repo/requirements.txt
exit- After that let's create a service so every time the system reboot it starts again the script:
sudo nano /etc/systemd/system/discord.service- In the file write this script, and then save it:
[Unit]
Description=Discord bot service
After=multi-user.target
[Service]
User=root
Type=simple
WorkingDirectory=/home/CHANGE_TO_YOUR_USER/DiscordGPTChatBot/
ExecStart=/usr/bin/python3 main.py
[Install]
WantedBy=multi-user.target- Reload the Systemd daemon to recognize the new service:
sudo systemctl daemon-reload- Enable the service:
sudo systemctl enable discord.service- Start the service:
sudo systemctl start dicord.service- Now check in your Discord server using the command
your_call_sign.hello