Global

Methods

_identify(token, shard, intents) → {Buffer}

Description:
  • Creates an identify payload for the gateway.

Source:
Parameters:
Name Type Description
token String

The authorization token.

shard Array.<Number>

An array of shard ids which this process is managing.

intents Number

The intents to use.

Returns:
Type
Buffer

cacheChannel(client, data, guildId, nocachenullable) → {VoiceChannel|Thread|TextChannel}

Description:
  • Automatically determines the channel type and caches the channel appropriately.

Source:
Parameters:
Name Type Attributes Default Description
client Client

The client instance.

data Object

The raw channel data from Discord.

guildId String

The id of the guild that the channel belongs to.

nocache Boolean <nullable>
false

Whether the channel should be cached.

Returns:
Type
VoiceChannel | Thread | TextChannel

checkMemberPermissions(roles) → {String}

Description:
  • Returns the permissions of a member based on their roles.

Source:
Parameters:
Name Type Description
roles Array.<Role>

An array of roles to check permissions for.

Returns:

The permissions of the member.

Type
String

checkPermission(memberPermission, permission, adminOverridenullable) → {Boolean}

Description:
  • Checks if a set of permissions contains a specific permission.

Source:
Parameters:
Name Type Attributes Default Description
memberPermission String

The permissions to check.

permission String

The permission to check for.

adminOverride Boolean <nullable>
true

Whether the admin permission should be taken into consideration.

Returns:
Type
Boolean

combinePermissions(…permissions) → {String}

Description:
  • Combines multiple permissions into a single permission.

Source:
Parameters:
Name Type Attributes Description
permissions String <repeatable>

The permissions to combine.

Returns:

The combined permissions.

Type
String

decryptStructure(encryptedMessage, …decryptionKeys) → {Message}

Description:
  • Decrypts a message and returns the message structure for it.

Source:
Parameters:
Name Type Attributes Description
encryptedMessage String

The encrypted message.

decryptionKeys String <repeatable>

The decryption keys to use.

Returns:
Type
Message

decryptText(text, key, iv) → {String}

Description:
  • Decrypts text and returns the plain text.

Source:
See:
Parameters:
Name Type Description
text String

The text to decrypt.

key CipherKey

The key used for encryption, must be 32 characters in length.

iv BinaryLike

The iv used for encryption, must be 16 characters in length.

Returns:
Type
String

deepCompare(object0, object1) → {Array.<String>}

Description:
  • Compares each property of an object and returns an array of the property names which are unique in their value across the objects.

Source:
Parameters:
Name Type Description
object0 Object
object1 Object
Returns:
Type
Array.<String>

encryptStructure(structure, …encryptionKeys) → {String}

Description:
  • Encrypts a structure and returns an encrypted string.

Source:
Parameters:
Name Type Attributes Description
structure Object

The structure to encrypt.

encryptionKeys String <repeatable>

The encryption keys to use.

Returns:
Type
String

encryptText(text, key, iv) → {String}

Description:
  • Encrypts text and returns the plain text.

Source:
See:
Parameters:
Name Type Description
text String

The text to encrypt.

key CipherKey

The key to use for encryption.

iv BinaryLike

The iv to use for encryption.

Returns:
Type
String

getKeyIv(…args) → {Object}

Description:
  • Returns a key and iv for encryption and decryption.

Source:
Parameters:
Name Type Attributes Description
args String <repeatable>

The arguments to generate the key and iv.

Returns:
Type
Object

getTimestamp(snowflake) → {Number}

Description:
  • Gives the UNIX timestamp for when the snowflake was created.

Source:
Parameters:
Name Type Description
snowflake String

The snowflake (or id).

Returns:
Type
Number

hexToInt(hex) → {Number}

Description:
  • Returns the integer representation of a hex string.

Source:
Parameters:
Name Type Description
hex String

The hex string to convert to an integer.

Returns:
Type
Number

isValidUrl(url) → {Boolean}

Description:
  • Checks if a URL is valid.

Source:
Parameters:
Name Type Description
url String

The URL to validate.

Returns:
Type
Boolean

resolveEmoji(text) → {Object}

Description:
  • Gives a valid Discord emoji structure when given an emoji mention.

Source:
Parameters:
Name Type Description
text String

Emoji mention. e.g. <:bitcoin:844240546246950922>

Returns:
Type
Object

structureHashName(…ids) → {String}

Description:
  • Returns a hashed name.

Source:
Parameters:
Name Type Attributes Description
ids String <repeatable>

The IDs to structure the hash name.

Returns:
Type
String
Description:
  • Whether the string provided contains a valid message link.

Source:
Parameters:
Name Type Description
text String

A url to a Discord message.

Returns:

The link to a message, if it is present.

Type
String