An Introduction to Discord Bots

by Edvard Berlusconi

Discord is a real-time messaging platform that is often referred to as an all-in-one voice and that chat platform for gamers. Since its interface is sophisticated and easy to use, and it has extensive features, Discord has become increasingly popular even among people who have little interest in video games.

One of the most interesting features of Discord is its support for programmable bots that can help integrate Discord with the outside world and provide individuals with a more engaging experience. Bots are widespread on Discord and they can provide various services such as games, moderation assistance, music, Internet searches, payment processing, and so on. In this article, you will be able to read about the Discord user interface and its WebSocket APIs and REST for bots. Let’s take a look:

Discord User Interface

source:digitaltrends.com

Before discussing anything else, it is important to understand how the user interacts with Discord and how it presents itself to the users. The way it presents itself to bots is similar. In fact, the Discord apps are built on the same APIs that the bots use. Technically, it is possible to run a bot inside the regular user account with some modifications, but this is not allowed according to Discord’s terms of service. It is required to run a bot in a bot account. Let’s break down the interface:

  1. Server List – a server is similar to a Slack workspace and it represents a group of people who can interact with each other within one, two, or more channels in the server. A server is managed by the creator or whatever staff they choose to manage it. The creator is the one that defines the rules, the structure of the channels, and manages users.
  2. Channel List – channels can be divided into several categories. In the API server, the categories can include information, general, and libs. Each channel works like a chat room where people can talk about the topic of the channel.
  3. Channel View – the channel view is where you can see what people have been talking about. Also, the server managers can choose to lock the chat, hence, regular users might not be able to write messages. According to the experts from probot.io, the administrators can also choose to use the channel as a bulletin board to post important information.
  4. User List – the users are organized into different categories and their names are labeled in different colors. This is due to the roles they have. A role describes what category the users appear under, what their name color needs to be, and what permissions they have in a server.
  5. Text Input – this is where you can type and send messages – if you are allowed to.

The Discord API

source:variety.com

The Discord API consists of two separate parts – the REST and WebSocket APIs. The WebSocket API is used for receiving events from Discord in real-time, while the REST API is used for performing actions inside the Discord.

  1. The WebSocket API – this is used for receiving events such as message creation and deletion, user kick or ban events, user permission update, and so on. A bot will use the WebSocket API for identifying itself, manage voice connections, request a connection, and other fundamental things.
  2. The REST API – this is used by bots to perform most of the actions like sending messages, banning users, and updating the user permissions. The REST API can also be used to ask for information, but, bots usually rely on the WebSocket API instead and cache the information they received from the WebSocket events.

Conclusion

Discord is now one of the biggest real-time communication platforms used worldwide. While the Discord bots are mostly the foray for hobbyists, we might see commercial opportunities increase as the demand for these service increase.

Leave a Comment

Solve : *
7 − 3 =