-
Notifications
You must be signed in to change notification settings - Fork 1
Authorized Developer Documentation (JavaScript)
This page is meant as a reference for authorized developers of ratzBot.
Discord.JS is used to help develop ratzBot.
ratzBot was developed to record information by appending data to specific files (which are excluded from public releases.) This is a list of files excluded and their main purpose:
./exclude/approvedmessage.ratz
| Messages that were banned by ratzBot, but have been approved for viewing by administration.
./exclude/bannedmessages.ratz
| Messages that were banned by ratzBot for relating to blocked topics.
./exclude/bannedusers.ratz
| Users banned from messaging channels.
./exclude/errors.ratz
| Errors returned by ratzBot; includes error codes and error types.
./exclude/removedauthmessages.json
| Messages that were removed from un-authorized users.
./exclude/users.ratz
| Users that have been authorized to message channels.
./exclude/eventuserlist.ratz
| Users that have joined an active event.
./exclude/adverts.json
| Advertisement data for the advertisement system.
ratzBot checks messages in Discord by using if
statements. For example:
if (message.content.toString() == "/ratz showcommands") {
// Do something
}
ratzBot will check each chat message and see if it equals /ratz showcommands
and if it does, it will run the code given within the statement. Some commands also require user-preference values; for example:
if (message.content.startsWith("/ratz steamuserinfo ") {
var result = message.content.slice(20);
// Do something
}
This will let ratzBot know that it is a command with user-preference values and will then slice
out the command itself and leave just the user value (which will later be used within the code execution.)
ratzBot welcomes members and says goodbye to members using a specific structure of code. Using the guildMemberAdd
and guildMemberRemove
events from Discord.JS, we can execute certain pieces of code when someone enters or leaves the server. For example:
const Discord = require("discord.js");
const bot = new Discord.Client();
bot.on("guildMemberAdd", (member) => {
// Do something when someone enters the server
}
bot.on("guildMemberRemove", (member) => {
// Do something when someone leaves the server
}
ratzBot authenticates with the Discord servers by using a login-token (or client key) given by our authorized application on Discord's website. Logging into their servers requires us to run the bot.login()
function provided by the Discord.JS library. For example:
const Discord = require("discord.js");
const bot = new Discord.Client();
var client_key = // A login-token
bot.login(client_key);
This block of code will log ratzBot onto Discord's servers by using the login-token that is defined as the client_key
variable.
Commands labeled DM
are only accessible via DM-Channels
Files labeled DEPRECATED
are no longer used in newer versions
Command | Present Since |
---|---|
/ratz showcommands | v2.2.6 |
/ratz steamuserinfo | v2.2.6 |
/ratz slimedog | v2.2.6 |
/ratz discorduserinfo | v2.2.6 |
/ratz botinfo | v2.2.6 |
/ratz releaseinfo | v2.3.0 |
/ratz play | v2.4.0 |
/ratz stop | v2.4.0 |
/ratz btcinfo | v2.5.0 |
/ratz ratcoininfo | v2.5.0 |
/ratz laststream | v2.5.1 |
/ratz gituserinfo | v2.6.0-RC |
/ratz gitrepoinfo | v2.6.0-RC |
/ratz joinactiveevent | v2.7.0-RC |
/ratz showactiveevent | v2.7.0-RC |
[DM] /ratz getremovedmessages | v3.1.0 |
/ratz machineinfo | v4.0.0-Alpha |
File | Present Since |
---|---|
approvedmessage.ratz | v2.2.6 |
bannedmessages.ratz | v2.2.6 |
bannedusers.ratz | v2.2.6 |
errors.ratz | v2.2.6 |
users.ratz | v2.2.6 |
[DEPRECATED] removedauthmessages.ratz | v2.4.1 |
eventuserlist.ratz | v2.7.0-RC |
removedauthmessages.json | v3.1.0 |
adverts.json | v3.1.0 |
Timestamps for Beta, Alpha, and Release Candidate testing.
Version | Starts | Ends |
---|---|---|
v2.6.0-RC | 7/16/18 | 7/17/18 |
v2.7.0-RC | 7/20/18 | 7/22/18 |
v3.0.0-Beta | 7/22/18 | 7/25/18 |
v4.0.0-Alpha | 2/1/19 | N/A |
Copyright (c) Gavin Isgar 2017-2019