Pronto logo

Pronto

Namespace

handlers

Methods

static

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

static

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

static

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

static

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

static

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

static

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

static

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

static

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 by config.ids.DEFAULT_GUILD will be returned instead
  • 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

static

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

static

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

static

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

static

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>
    false

    Whether 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

static

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