DiscordJS

and the Interaction API

By Thomas Galligan

Writing a Discord Bot is a great opportunity to learn to code, or learn to use your coding abilities and see what you can achieve

Why Javascript?

Javascript has been the most commonly-used programming language for the 9th year in a row, so resources to get help and learn will be out there, and if you run into a problem, someoene else has (probably) already fixed it.

About the Discord API

Almost everyone who's used Discord has interacted with a bot at some point. They can provide instrumental uses in certain communities... Such as...

Recently, Discord have decided they want to change the way bots work

Previously, a bot would listen to every message in every guild it is invited to, whereas now, special "interactions" are formed between a user and a bot

The most common of which is the "slash command"

The good about Slash Commands

They provide an interface to allow one to see how to run the command, as they are writing the command

The bad about Slash Commands

They make it more difficult to do more traditional discord bot functions, like simple messsage scanning, censoring etc...

Intro to Slashing

Slash commands need to be registered, to provide a user interface to use a command that can store parameters

screenshot of slash command user interface

Parameter Data Types

What can you do with a Discord bot?

Make a game

Myuu

This bot implements a Pokemon game system wherein you "catch" pokemon, and can trade and compete in PVP and many other features

But not all bots are simply just bots alone.

Both of the (current) Netsoc discord bots have an API as well as a discord bot interface

Now lets look at a bad example of a Discord Bot