DEV Community 👩‍💻👨‍💻

Cover image for What should you concern about developing a Discord Bot (Jet Brawley)
Chee Yong
Chee Yong

Posted on • Originally published at brawley.js.org

What should you concern about developing a Discord Bot (Jet Brawley)

Introduction

Hey everyone, I'm the developer of Jet Brawley & few other Discord Bots. Today, I'd like to share with everyone about my personal experience as a bot developer, as well as things that you need to know before or during the process of developing your Discord Bot.
from Discord Blog
As a disclaimer, this is not a tutorial on creating a Discord Bot. I wrote this post to help those who are serious about creating a unique and useful Discord Bot.

Prerequisites

  • Device
    from Apple Newsroom
    Yes, you can use a phone or tablet to code, but you should always avoid using them as it significantly slow down the development process.

  • Codespaces
    Coding
    There are many coding IDEs out there, avoid using notepad or normal text editor for programming.

  • Skills
    The level of your coding skills & how experienced you are with programming isn't the top priority of creating an awesome Discord Bot but don't get me wrong, you do need to have a fairly decent grasp of a programming language in order to get started.

Those who had never create a Discord Bot before, you should start playing around with the Discord API libraries of the programming language that you're going to use.

Idea

Idea
Don't get started from nowhere.

So, you are trying to create a unique & useful bot, here's a few ideas that you should forget about.

  1. Features that an existing bot offers (or similar features) unless you're able to improve it on your own way that can attract new users that are looking for a bot that offers that specific feature)

  2. Things that don't make sense. You should be clear of what bots on Discord can and can't do.

Sketch/list down your ideas

You've had lots of ideas in mind, now just list them out like a todo list.

Here's an example:

- [news] command
  - Make a request to example.com and fetch the latest news
  - In embed form
  - Include links to the post
- [getnews] command
  - Make a request to example.com/getnews and fetch the specific news article
  - an option to choose category and search parameter option that is required
Enter fullscreen mode Exit fullscreen mode

Getting Started

from Discord App Discovery
First, you'll have to find out privileges that your bot needs. For instance, the message content privilege is required in order to read messages. (Tip: the use of message content privilege should be avoided for command purpose)
Open Library
Finally, learn how to use the library and creating an application on Discord (this process should be easy). It shouldn't be too complex if you're familiar with the programming language.
In order to simplify the process, you should probably develop a bot with the programming language that you are most familiar with. (To give yourself a challenge, you can try developing your Discord bot with a programming language that you're not familiar with, that's a way of improving your skills)

I'd always encourage programmers to write down another todo list, make a planning for the development process of your bot. Don't worry as I will walk you through the process.

  1. Libraries that you need for your project (bot). Try to list down every library that you'll be using for your project. Try to include what you're going to use them for. Example:
- discord.js // interact with Discord API
- axios // Make http request to example.com, fetch the API
- mongoose // Store user data 
Enter fullscreen mode Exit fullscreen mode
  1. Explaining what you are trying to do. You've listed out the commands that you're going to work on, now make it clearer, almost like documenting what you're trying to do with your own way. For Example:
- When a user runs /news
    1. Reply with the thinking message 
    2. Fetch example.com/news
    3. Create an embed
       - Title: Example news
       - Description: Today's news
       - Fields: an array of objects (name: the article name, value: the article brief)
    4. Edit the message 

- When a user runs /help
    1. Create an embed
    2. A guide on how to use the bot
    3. reply interaction

Enter fullscreen mode Exit fullscreen mode

Yes, I know, this sounds like an extra work, but this really comes in handy if you're working on a complex and challenging project. But it is definitely a good practice.

Coding

Coding

  1. Use code formatting tools. This makes your code more user readable.
  2. Explain your code. Adding a comment to explain or describe about your code does allow you to debug your project with less hesitation.
  3. Keep it clean & organized. Your code/files should be organized in a way that makes it easy for you to find a piece of code. Here's an example: Organized
  4. Remove unused code. Some code editors tell if a function or variable is not in used, you should probably get rid of them.

Best Practices

  • Keep your bot up to date. Update your libraries, keep improving your bot
  • User feedback. Take note on every feedbacks from users, try to improve them
  • Remove unused registered slash commands
  • Test your bot before deploying as a production
  • Adding features. Adding features to your bot will attract more users
  • Get your bot verified.

Thanks for reading !!

This is my very first post, hope everyone had learned something new.
Feel free to leave a comment down below !

Check out Jet Brawley

Top comments (0)

Become a Moderator Do you want us to help make DEV a better place?

Fill out this survey and help us by becoming a tag moderator here at DEV.