Discord Bot Written In Node.js

Jan 2019 - Ongoing
Goals
  • Make an in-house bot that can manage a growing Discord server
  • Account for edge cases and vulnerabilities coming from user input
  • Hosting the bot and keeping it online during all hours

Project Overview

Berrybot is a side project that I work on for fun. I’ve worked on it for months now, adding features as I went along. Eventually, users in the server requested certain features that became implemented. There’s really no limit to what Discord bots can accomplish, making it an ongoing process.

Process

Getting started with Discord bots is fairly simple. You need to hook up the discord API that’s available for your preferred language, then setup a simple starter to get it going. I found a starter script online and modified it to my needs. I started with simple commands since I was just starting to learn. Eventually I hooked up APIs and utilized Node’s power to make several types of API calls.

As data grew, I outsourced data into its own ‘component’ and did the same to group similar sets of commands. After the structure was set up, scaling up was easy since I could add commands and their logic to separate files. Moving forward, keeping code split up keeps the app maintainable without tangling logic.

Technologies Used

Node.js
The only technology required here was Node.js/Javascript. I chose Node because I was familiar with it already, and wanted to further improve my JavaScript skills.

JavaScript libraries
I used axios to accomplish API calls. There are good utility libraries for formatting Discord messages and embeds such as discord-embed-maker.

APIs
Most of the features on this bot use the Reddit API, with a wrapper library called snoowrap. Other than that, there’s some basic APIs for grabbing quotes and other one-off functions.

Need something? Let's get in touch