A Discord bot specifically made for the Metroid Dread Speedrunning Discord server.
To get the bot running, you should set up the following in config.json
:
{
"enabledComponents": ["functionality"], // array of strings, containing enabled bot components
"clientId": "", // client's ID here
"owners": [], // array of strings, containing IDs of discord users who can execute owner only commands (i.e. /eval)
"wikiDomain": "", // wiki URL here (i.e. dreadwiki.hijumpboots.com)
"graphQlDomain": "", // URL for api calls here (i.e. dreadwiki.hijumpboots.com or localhost:4000)
"contributorRole": "", // ID of wiki contributor role here (for /wiki verify)
"srcRole": "", // ID of SRC verified role here (for /src verify)
"moderatorRole": "", // ID of moderator role here (for moderation commands)
"streamsChannel": "", // ID of channel for streams to be posted in
"streamingRole": "", // ID of role for streaming users to be given
"applicationChannel": "", // ID of channel to send teacher applications to here
"positions": [
// array of objects, representing teacher positions. these are in the following format:
// label: position name, description: description of position (use \u200b to leave empty), value: ID of corresponding teacher role
{ "label": "", "description": "", "value": "" },
]
}
The bot components can be: functionality, utility, wiki, moderation, src, streams, bootcamp. Never disable the functionality component.
As well, please generate a Discord token, and if using the wiki component, a Wiki.JS API key. These should go into tokens.json
in the following format:
{
"discordToken": "",
"wikiToken": ""
}
Finally, run databases/dbInit.js
in order to initialize the bot's databases.
Simple command:
const { SlashCommandBuilder } = require('discord.js');
module.exports = {
data: new SlashCommandBuilder(),
component: '',
execute(interaction) {
return new Promise((resolve, reject) => {});
},
// Optional
autocomplete(interaction) {
return new Promise((resolve, reject) => {});
}
};
Command with subcommands/subcommand groups:
const { SlashCommandBuilder, Collection, SlashCommandSubcommandGroupBuilder, SlashCommandSubcommandBuilder } = require('discord.js');
module.exports = {
data: new SlashCommandBuilder(),
component: '',
// Optional if using subcommands
subcommandGroups: new Collection([
['subcommandGroupName', {
data: new SlashCommandSubcommandGroupBuilder(),
component: '',
subcommands: new Collection([
['subcommandName', {
data: new SlashCommandSubcommandBuilder(),
component: '',
execute(interaction) {
return new Promise((resolve, reject) => {});
},
// Optional
autocomplete(interaction) {
return new Promise((resolve, reject) => {});
}
}]
])
}]
]),
// Optional if using subcommandGroups
subcommands: new Collection([
['subcommandName', {
data: new SlashCommandSubcommandBuilder(),
component: '',
execute(interaction) {
return new Promise((resolve, reject) => {});
},
// Optional
autocomplete(interaction) {
return new Promise((resolve, reject) => {});
}
}]
])
};
const { ContextMenuCommandBuilder, ApplicationCommandType } = require('discord.js');
module.exports = {
data: new ContextMenuCommandBuilder(),
component: '',
execute(interaction) {
return new Promise((resolve, reject) => {});
},
};
const { ButtonBuilder, ButtonStyle } = require('discord.js');
module.exports = {
button: () => new ButtonBuilder(),
component: '',
onPressed: (interaction) => return new Promise((resolve, reject) => {});
};
const { ModalBuilder, TextInputBuilder, TextInputStyle, ActionRowBuilder } = require('discord.js');
module.exports = {
modal: () => new ModalBuilder(),
component: '',
onSubmit(interaction) {
return new Promise((resolve, reject) => {});
}
};
const { SelectMenuBuilder } = require('discord.js');
module.exports = {
selectMenu: () => new SelectMenuBuilder(),
component: '',
onSelection: (interaction) => return new Promise((resolve, reject) => {});
};
module.exports = (sequelize, DataTypes) => return sequelize.define();