Class: CommandSetting

Command~ CommandSetting

Stores all settings related to a command.

new CommandSetting( [opts])

Parameters:
Name Type Argument Description
opts Command~CommandSetting <optional>
The options to set, or nothing for default values.
Source:

Members


<protected> _updated :boolean

Have these settings been modified since last save.
Type:
  • boolean
Source:

defaultDisabled

Whether this command is disabled for all by default and requires them to be in the list of enabled IDs. If this is false, the command is enabled for everyone, unless they fall under the 'disabled' list.
Source:

<readonly> disabled :Object

The IDs of all places where this command is currently disabled. Any ID will be mapped to a truthy value. Roles will be mapped to the guild ID and the role ID. Use Command~CommandSetting.set to change these values.
Type:
  • Object
Source:

<readonly> enabled :Object

The IDs of all places where this command is currently enabled. Any ID will be mapped to a truthy value. Roles will be mapped to the guild ID and the role ID. Use Command~CommandSetting.set to change these values.
Type:
  • Object
Source:

<private> isMuted :boolean

Will this command be completely silenced so that no output will be sent. Only applicable when command is disabled.
Type:
  • boolean
Source:

<nullable> myGuild :string

The guild ID of the guild is settings object is for, or null if this instance is not specific to a single guild.
Type:
  • string
Source:

permissions :bigint

Bitfield representation of the required permissions for a user to have to run this command. Same bitfield used by Discord~Permissions.
Type:
  • bigint
Default Value:
  • 0
Source:

validOnlyInGuild :boolean

If the command is only allowed to be used in guilds.
Type:
  • boolean
Source:

Methods


isDisabled(msg)

Check if this command is disabled with the given context.
Parameters:
Name Type Description
msg Discord~Message The message with the current context of which to check if the command is disabled.
Source:
Returns:
0 if not disabled, 2 if disabled is specific to user, 1 if disabled for any other reason.
Type
number

set(value, type, id [, id2])

Enable, disable, or neutralize this command for the associated guild, channel, user, or role.
Parameters:
Name Type Argument Description
value string Whether to set this ID to enabled, disabled, or to whatever the default value is. Allowed values: `enabled`|`disabled`|`default`.
type string The type of ID that is being given. Allowed values: `guild`|`channel`|`user`|`role`.
id string The id to set the value to.
id2 string <optional>
The guild ID if `type` is 'role', of where the role is created.
Source:
Fires:
  • Command.events#event:settingsChanged

toJSON()

Creates a JSON formatted object with the necessary properties for re-creating this object.
Source:
Returns:
Object ready to be stringified for file saving.
Type
object

updated()

Enqueue these settings to be saved to disk.
Source: