Skip to content

A simple no-code yet customizable JavaScript Discord bot using the new language model Chat GPT-4

License

Notifications You must be signed in to change notification settings

Lane-G-Smith/Discord-Bot-Vanilla-JS-GPT-4

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

61 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Discord-Bot-Vanilla-JS-GPT-4


Discord.js

A simple vanilla javascript Discord bot for interacting with the new language model GPT-4 by OpenAI. This bot can serve a variety of different functions by changing a few lines of its internal prompt. No coding skills are required.

Give personality to a virtual friend in your gaming server

Get answers to random trivia from your PC or phone (Discord Mobile)

Create your very own friendly personal assistant

GPT-4 bot installation and deployment Instructions

!!This bot does NOT respond to DMs, it must be in a server with you!!

Get the bot 'shell' from Discord. It's free, and it takes 5 minutes

https://discord.com/developers/applications

Go to OpenAI and open an account

https://platform.openai.com/signup

Install node.js

https://nodejs.org/en/

Install git

https://git-scm.com/downloads

Create a new folder and navigate to it in the terminal to set up git

git init

Navigate to the new git folder in the terminal and clone this repository

https://github.com/Lane-G-Smith/Discord-Bot-Vanilla-JS-GPT-4.git

Navigate to Discord-Bot-Vanilla-JS-GPT-4 folder and install dependencies

npm install

Rename example_.env to .env

Place your secret Discord bot token from the first step into the .env file

TOKEN=your_unique_Discord_bot_token_here

Place your secret OpenAI API key from the second step into the .env file

OPENAI_API_KEY=your_unique_OpenAI_API_key_here

Modify a few lines of the code (46-59, self-explanatory when you look at it) to personalize the functionality

The characteristics of your AI and how to answer questions, example questions, example answers

Set a trigger word that you want to prompt a response (line 39)

replace "Your-Trigger-Word" with whatever you want

To host the bot locally, open the project in the terminal and run node

node index.js

To host the bot locally and keep it running in the background indefinitely, install PM2

npm install pm2 -g

Run your bot locally using pm2 https://pm2.keymetrics.io/

pm2 start index.js

Congratulations, your bot should now be live & confirmation should be logged in the terminal. Use your personal link from the Discord developer portal to invite your bot to a Discord server

https://discord.com/developers/applications

About

A simple no-code yet customizable JavaScript Discord bot using the new language model Chat GPT-4

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published