This project was developed as part of the FAC - FAC30A (Founders and Coders) curriculum. The aim of the project was to create a Discord Chat Bot with OpenAI integrated with the server.
The project is built using JavaScript, Node/Nodemon, Discord.js, OpenAI and Jest as a testing library, reflecting FAC's commitment to foundational technologies. Despite facing challenges, such as a change in personnel during development, the team successfully navigated through obstacles.
The development process was not without its share of challenges. Adapting to personnel changes and the need for knowledge transfer created additional complexities. The team had to find efficient ways to maintain project continuity amidst time constraints and differing levels of experience among collaborators.
Example of Discord with OpenAI installed:
To install this project on your local machine please follow these steps:
- For a free API Key at OpenAI Platform.
- Create a bot on Discord Developers.
- Assign the permissions you want the bot to have (ensure you select
bot
andapplications.commands
) and generate a URL - Invite your bot to the server you manage by pasting the generated link
- Copy the Discord Bots 'Channel ID' by right clicking on general in the server menu and adding the Channel ID to the messageHandler.js file, in the Channels array around Line 10.
- Clone the repo
git clone https://github.com/fac30/bahja-isaac-nas-discord-chatbot.git
- Install NPM packages
npm install
- Enter your API and Discord Token in a
.env
file, please refer to.env-example
for reference - Launch your bot in the terminal so it goes online
node index.js
Prior to using the Bot you have the option to run the tests in the programme to verify it is working as expected, enter the following in the terminal:
node test
The expected results should be as follows:
Once the server is running please interact with the Bot via the text field of the server.
Thanks to the following contributors:
We also used the following resources to understand how to use OpenAI's API and Discord.js to create an AI chat bot. This includes official documentation:
- Discord.js official documentation
- OpenAI API documentation