CommandCreator

CommandCreator

new CommandCreator()

Source:
Properties:
Name Type Attributes Description
_commands Store

A store of Commands ( Where registered commands are added )

options Object <optional>

Options for the command creator

Properties
Name Type Attributes Default Description
customPrefix Boolean <optional>
false

Whether to use a by-guild custom prefix

defaultPrefix String <optional>
'!'

The default Prefix of the bot

owners Array <optional>
[]

An array of bot owner ids

Extends

Methods

addOwner(owner) → {Array.<Snowflake>}

Source:

Adds a new owner for the bot This will add a new owner for the current cache, you can use a database to make this persistent, but for this request, it will only save to the current session. We will try to add a way to make this persistent.

Parameters:
Name Type Description
owner Snowflake

The id of the owner to add

Returns:

The array of owners

Type
Array.<Snowflake>

createDM(user) → {Promise.<DMChannel>}

Source:
Inherited From:

Creates a DMChannel between a user

Parameters:
Name Type Description
user Snowflake

The id of the recipient for the DM

Returns:
Type
Promise.<DMChannel>

createEmbed(channel, embed) → {Promise.<Message>}

Source:
Inherited From:
Deprecated:
  • Use Client#sendMessage() instead.

Creates an embed to a channel

Parameters:
Name Type Description
channel Snowflake

The id of the channel to send a message to

embed Object

The embed to send

Returns:
Type
Promise.<Message>

createGuild(name, optionsopt) → {Promise.<Guild>}

Source:
Inherited From:

Creates a guild

Parameters:
Name Type Attributes Description
name String

The name for the new guild

options Object <optional>

Options for the new guild

Properties
Name Type Attributes Description
region String <optional>

The region for the guild

icon String <optional>

A base64 128x128 jpeg image for the guild icon

Returns:
Type
Promise.<Guild>

createMessage(channel, content) → {Promise.<Message>}

Source:
Inherited From:
Deprecated:
  • Use Client#sendMessage() instead.

Creates a message to a channel

Parameters:
Name Type Description
channel Snowflake

The id of the channel to send a message to

content String

The content to send

Returns:
Type
Promise.<Message>

customLog(type, color, message) → {Object}

Source:
Inherited From:

Make your own log with your own type and color

Parameters:
Name Type Description
type String

The type of the log, can be anything

color String

The color of the type

message String

The message to log

Returns:
Type
Object

deleteCommand(name) → {Command}

Source:

Deletes a Created Command

Parameters:
Name Type Description
name String

The name of the command to delete

Returns:
Type
Command

getUser(user) → {Promise.<User>}

Source:
Inherited From:

Fetches the user from cache, if it doesn't exist use the REST API to fetch it and add to the cache

Parameters:
Name Type Description
user Snowflake

The id of the user to fetch

Returns:
Type
Promise.<User>

(async) initiate(token) → {Void}

Source:
Inherited From:

This will start connecting to the gateway using the given bot token

Parameters:
Name Type Description
token String

The token of the user

Returns:
Type
Void

leaveGuild(guild) → {Promise.<Boolean>}

Source:
Inherited From:

Makes the bot leave the guild

Parameters:
Name Type Description
guild Snowflake

The id of the guild

Returns:

Will return true if it's a success

Type
Promise.<Boolean>

log(type, message) → {Object}

Source:
Inherited From:

Logs something to the console that is colored.

Parameters:
Name Type Description
type String

The type of the log

message String

The message to log

Returns:
Type
Object

patchMessage(channel, options) → {Promise.<Message>}

Source:
Inherited From:

Edits a message

Parameters:
Name Type Description
channel Snowflake

The id of the channel

options Object

Options for the message editing

Properties
Name Type Description
content String

The content of the message

embed Embed

The embed for the message

message Snowflake

The id of the message

Returns:
Type
Promise.<Message>

registerCommand(name, reply) → {Command}

Source:

Creates an executable command

  • If the reply parameter is an Array, it will choose a random element from the array to send
  • If the reply parameter is an Object, you need to add a "reply" property
  • If the reply parameter is a String, it will send that string
  • If the reply parameter is a Function, it will not send a message by default. It means that if you supply a Function, it would do what the function says it would do instead of sending the message. You can still send messages with a function, but you need to do it inside the function.
Parameters:
Name Type Description
name String
reply String | Array | Object | function

What the bot will do or reply once this command is triggered

Returns:
Type
Command

registerGuildPrefix(guild, prefix) → {Void}

Source:

Registers a custom prefix for the guild

Parameters:
Name Type Description
guild Snowflake

The id of the guild

prefix String

The new custom prefix

Returns:
Type
Void

removeOwner(owner) → {Boolean}

Source:

Removes an owner id from the list of owners in the cache

Parameters:
Name Type Description
owner Snowflake

The id of the owner to remove

Returns:
Type
Boolean

rgbLog(type, message, optionsopt) → {Object}

Source:
Inherited From:

Make your own log with your own type and color using RGB

Parameters:
Name Type Attributes Description
type String

The type of the log, can be anything

message String

The message to log

options Object <optional>

The options for the RGB Color

Properties
Name Type Attributes Default Description
red Number <optional>
0

The number for the color red in the rgb data

green Number <optional>
0

The number for the color green in the rgb data

blue Number <optional>
0

The number for the color blue in the rgb data

Returns:
Type
Object

sendMessage(channel, options) → {Promise.<Message>}

Source:
Inherited From:

Sends a message to a channel

Parameters:
Name Type Description
channel Snowflake
options Object
Properties
Name Type Attributes Description
content String <optional>

The content of the message

embed Embed <optional>

The embed object of the message

Returns:
Type
Promise.<Message>

setActivity(shard, optionsopt) → {Object}

Source:
Inherited From:

Sends an activity to the shard

Parameters:
Name Type Attributes Description
shard String

The id of the shard, or 'all' for all shards

options Object <optional>

The options for the Activity

Properties
Name Type Attributes Default Description
since Number <optional>
null

Unix time (in milliseconds) of when the client went idle, or null if the client is not idle

game Object <optional>
null

The user's new activity

Properties
Name Type Attributes Default Description
name String <optional>
null

The activity's name

type Number <optional>
0

The activity's type

url String <optional>
null

The url of the activity ( Only for game type 1 )

status String <optional>
'online'

The new status of the client

afk Boolean <optional>
false

Whether or not the client is afk

Returns:

The options for the Activity

Type
Object

spawn(id) → {Boolean}

Source:
Inherited From:

Spawns a shard

Parameters:
Name Type Description
id Number

The id of the shard

Returns:
Type
Boolean