The PFA Discord Bot GPT is a Discord bot that uses the GPT-3 language model to generate text and answer your questions in an informative way.
This project aims to help learn DevOps by automating the CI/CD process. The project uses GitHub Actions to trigger workflows that build and deploy the app to GitHub Registry, DockerHub, and Azure Container Service.
For development, you will only need Node.js and a node global package installed in your environement.
-
Just go on official Node.js website and download the installer. Also, be sure to have
git
available in your PATH,npm
might need it (You can find git here). -
You can install nodejs and npm easily with apt install, just run the following commands.
$ sudo apt install nodejs $ sudo apt install npm
-
You can find more information about the installation on the official Node.js website and the official NPM website.
If the installation was successful, you should be able to run the following command.
$ node --version
v16.18.1
$ npm --version
9.2.0
If you need to update npm
, you can make it using npm
! Cool right? After running the following command, just open again the command line and be happy.
$ npm install npm -g
$ git clone git@github.com:ENET-Com-22/pfa-discord-bot-gpt.git
$ cd pfa-discord-bot-gpt
//Check the current branch
$ git branch
//Switch to "dev" branchif the current branch is not "dev"
$ git checkout dev
$ npm install
Make a copy of .env-tamplate and rename it to .env
.
Next, you need to fill enviroment vars inside .env with your own APIs keys.
- DISCORD_TOKEN - Discord Developer Portal
- OPENAI_ORG - OpenAI Organization settings
- OPENAI_KEY - OpenAI API keys
To make a Discord bot, you need to create a discord application through Discord Developer Portal:
-
Click on
New Application
button -
Give your application a name , check the terms of servive box and then
Create
. -
In
Bot
section, name your bot and make sure the following options are enabled:- PUBLIC BOT
- MESSAGE CONTENT INTENT
-
Go to
OAuth2
section thenURL Generator
. You need to checkbot
in scopes andAdministrator
in permissions (it's not recemmeded to grant adminstrator permission to a bot, we're doing so for demo purposes). Copy the generated URL at bottom of the page and run it on your browser. You'll be prompted to select your Discord server where you want to add your bot. -
In
General
section underOAuth2
, regenerate an new "CLIENT SECRET" key by clicking onReset secret
. Copy the new client secret key to your.env
as DISCORD_TOKEN.
You need to have an OpenAi account in order to access their API.
-
Login or create a new account on https://platform.openai.com/overview
-
Create a new secret key for the bot (https://platform.openai.com/account/api-keys). Once generated, copy and paste it in
.env
as OPENAI_KEY -
Finally, to fill the last environment variable OPENAI_ORG, just go to
settings
then copy your Organization ID.
$ npm start
The bot will now be available in your Discord server.