Methods
channelPairing(oldState, newState)
Parameters
-
oldState
Discord.VoiceState
The <VoiceState> before the update
-
newState
Discord.VoiceState
The <VoiceState> after the update
Source
commandError(msg, errorMsg, commandError, footeropt)
Parameters
-
msg
Discord.Message
Erroneous command message
-
errorMsg
string
Error message to display
-
commandError
string
The error text to display for the command
-
footer
string
<optional>
Optional supplementary footer
Source
commandHandler(msg)
Parameters
-
msg
Discord.Message
The <Message> that emitted the <Client>#message event
Source
confirmWithReaction(msg, dm, confirm, cancel)
Parameters
-
msg
Discord.Message
Command/reaction message
-
dm
Discord.Message
Direct message to attach confirmation emojis to
-
confirm
function
Callback function to execute on confirmation
-
cancel
function
Callback function to execute on cancel
Source
createEmbed(prompt, colouropt) → {Discord.MessageEmbed}
Parameters
-
prompt
string
The prompt to display as the embed description
-
colour
Discord.ColorResolvable
<optional>
The colour to set the embed to
Returns
-
Discord.MessageEmbed
The created embed
Source
createGuild(guild) → {Promise.<Typings.GuildConfiguration>}
handlers.createGuild()
performs the initialisation process for a guild by creating/finding the default channels defined by config.defaults
, and creates and returns a new <GuildConfiguration> document if it does not already exist
Parameters
-
guild
Discord.Guild
The <Guild> to initialise
Returns
-
Promise.<Typings.GuildConfiguration>
The guild's <GuildConfiguration> document
Source
debugError(guildnullable, error, errorMsg, fieldTitleopt, fieldContentopt)
Parameters
-
guild
Discord.Guild
<nullable>
The guild the member shares with the bot
-
error
Error
The error object
-
errorMsg
string
A string to display as an error message
-
fieldTitle
string
<optional>
A title for an optional additional embed field
-
fieldContent
string
<optional>
The field content for the optional embed field
Source
deleteMsg(msg)
Parameters
-
msg
Discord.Message
The message to delete
Source
directCommandError(msg, typeopt)
Parameters
-
msg
Discord.Message
The erroneous command message
-
type
'NO_PERMISSION'
|'HAS_ROLE_MENTION'
|'NO_DIRECT'
|'MULTIPLE_GUILDS'
<optional>
The reason for the command error
Source
embedScaffold(guildnullable, destination, description, colour, type, fieldTitleopt, nullable, fieldContentopt, nullable, errorFieldopt)
Parameters
-
guild
Discord.Guild
<nullable>
The guild the member shares with the bot
-
destination
Discord.TextBasedChannels
|Discord.User
|Discord.GuildMember
The TextBasedChannel to send the embed to
-
description
string
The description of the embed to be created
-
colour
Discord.ColorResolvable
The colour of the embed to be created
-
type
'MESSAGE'
|'DIRECT'
|'DEVELOPER'
|'DEBUG'
The intended purpose of the embed
-
fieldTitle
string
<optional> <nullable>
A title for an optional embed field
-
fieldContent
string
<optional> <nullable>
Embed field content
-
errorField
string
<optional>
An optional additional error message to append to the end of the description
Source
emojiReact(msg, emoji)
Parameters
-
msg
Discord.Message
The message to react to
-
emoji
Discord.EmojiIdentifierResolvable
The emoji to react with
Source
errorReact(msg)
Parameters
-
msg
Discord.Message
The message to error react to
Source
findGuildConfiguration(guildopt, changesopt) → {Promise.<Typings.GuildConfiguration>}
handlers.findGuildConfiguration()
queries the MongoDB database for the guild's <GuildConfiguration> if it exists, or will first call handlers.createGuild()
to create the <GuildConfiguration>
Parameters
-
guild
Discord.Guild
<optional>
The <Guild> to find the <GuildConfiguration> for
-
If
undefined
, the <GuildConfiguration> of the default guild defined byconfig.ids.DEFAULT_GUILD
will be returned instead
-
If
-
changes
Partial.<Typings.GuildConfiguration>
<optional>
A Partial<GuildConfiguration> object of the values to update within the <GuildConfiguration>
Returns
-
Promise.<Typings.GuildConfiguration>
The guild's <GuildConfiguration>, or the
config.ids.DEFAULT_GUILD
's <GuildConfiguration>
Source
getRoleError(msg) → {Promise.<'ERROR'>}
Parameters
-
msg
Discord.Message
The command message
Returns
-
Promise.<'ERROR'>
An error!
Source
lessonInstructions(channelId, guild)
Parameters
-
channelId
Discord.Snowflake
-
guild
Discord.Guild
Source
lessonReminders(guild)
Parameters
-
guild
Discord.Guild
Source
manageAttendance(reaction, user)
Parameters
-
reaction
Discord.MessageReaction
The reaction object
-
user
Discord.User
The <User> that applied the guild or reaction emoji
Source
overwriteCommands(guild) → {Promise.<Typings.GuildConfiguration>}
Parameters
-
guild
Discord.Guild
Returns
-
Promise.<Typings.GuildConfiguration>
Source
permissionsCheck(memberRoles, id, command) → {boolean}
handlers.permissionsCheck()
verifies whether a <User> has the adequate permissions to access a specified <Command>, as per the truth table at https://imgur.com/a/iwiKpsG
Parameters
-
memberRoles
Discord.Collection.<Discord.Snowflake, Discord.Role>
The Collection<Snowflake, Role> of the <GuildMember>
-
id
Discord.Snowflake
The <User.id> of the user to check permissions for
-
command
Typings.BaseCommand
The <BaseCommand> object to check permissions against
Returns
-
boolean
Whether the <User> has the adequate permissions to access the <Command>
Source
permissionsHandler(msg, command) → {Promise.<(boolean|'ERROR')>}
Parameters
-
msg
Discord.Message
The command message
-
command
Typings.BaseCommand
The <BaseCommand> object to check permissions against
Returns
-
Promise.<(boolean|'ERROR')>
If user has permissions or
ERROR
Source
purgeChannel(msgs, channel, collectoropt)
Parameters
-
msgs
Discord.Collection.<Discord.Snowflake, Discord.Message>
|Array.<Discord.MessageResolvable>
|number
Messages to delete
-
channel
Discord.GuildTextBasedChannel
Channel to purge
-
collector
Discord.ReactionCollector
<optional>
An optional reaction collector to stop
Source
removeGuild(guild)
Parameters
-
guild
Discord.Guild
The guild to delete from the database
Source
sendDirect(user, options, guildChannelnullable, toDebugopt) → {Promise.<(void|Discord.Message)>}
Parameters
-
user
Discord.User
|Discord.GuildMember
|Discord.DMChannel
User to send to
-
options
string
|Discord.MessagePayload
|Discord.MessageOptions
Message options
-
guildChannel
Discord.GuildTextBasedChannel
<nullable>
A guild channel that the user has access to, to send an error in case cannot send DM
-
toDebug
boolean
<optional>
falseWhether to send the error message to debugging rather than the user in a guild channel
Returns
-
Promise.<(void|Discord.Message)>
Message if it was sent
Source
sendMsg(destination, options) → {Promise.<(void|Discord.Message)>}
Parameters
-
destination
Discord.GuildTextBasedChannel
Destination channel
-
options
string
|Discord.MessagePayload
|Discord.MessageOptions
Message payload/options
Returns
-
Promise.<(void|Discord.Message)>
The message if it was successfully sent
Source
successReact(msg)
Parameters
-
msg
Discord.Message
The message to success react to
Source
unsubmittedLessons(guild)
Parameters
-
guild
Discord.Guild
The guild to update lessons for
Source
updateUnsubmitted(reaction, user)
Parameters
-
reaction
Discord.MessageReaction
The reaction object
-
user
Discord.User
The <User> that applied the guild or reaction emoji
Source
upsertCommands(guild) → {Promise.<Typings.GuildConfiguration>}
Parameters
-
guild
Discord.Guild
Returns
-
Promise.<Typings.GuildConfiguration>
Source
verifyBotPermissions(guild, changesopt)
Parameters
-
guild
Discord.Guild
The <Guild> to verify permissions for
-
changes
Array.<Discord.PermissionString>
<optional>