ChannelManager

Channel Manager to work with Channels

Constructor

new ChannelManager(client, id)

Parameters:
NameTypeDescription
clientobject

the Application Client

idstring

the id of the channel

Example
// You can use this way
const manager = new ChannelManager(<Client>);
const channel = await manager.fetch(channelId);
console.log(channel);

// Or this way
const manager = new ChannelManager(<Client>, channelId);
const channel = await manager.fetch();
console.log(channel);

Members

client :object

the Application Client

Type:
  • object

id :string|null

the id of the channel

Type:
  • string | null

Methods

(async) createMessage(channelId, data) → {Promise.<object>}

send a message to a channel

Parameters:
NameTypeDescription
channelIdstring | null
dataobject

the message payload

Returns:
Type: 
Promise.<object>

(async) createReaction(channelId, messageId, emoji) → {Promise.<object>}

create a reaction to a message

Parameters:
NameTypeDescription
channelIdstring | null

the id of the channel

messageIdstring

the id of the message

emojistring

the emoji to react with

Returns:
Type: 
Promise.<object>

(async) crosspostMessage(channelId, messageId) → {Promise.<object>}

crosspost a message to a channel

Parameters:
NameTypeDescription
channelIdstring | null

the id of the channel

messageIdstring

the id of the message

Returns:
Type: 
Promise.<object>

(async) delete(channelId, reasonnullable)

Delete a channel from Discord

Parameters:
NameTypeAttributesDefaultDescription
channelIdstring

The id of the channel

reasonstring<nullable>
null

The reason of the deletion

Example
const deleteChannel = await new ChannelManager(client, "980770618087710754").delete();
console.log(deleteChannel);

(async) deleteMessage(channelId, messageId) → {Promise.<object>}

delete a message

Parameters:
NameTypeDescription
channelIdstring | null

the id of the channel

messageIdstring

the id of the message

Returns:
Type: 
Promise.<object>

(async) editMessage(channelId, messageId, data) → {Promise.<object>}

edit a message

Parameters:
NameTypeDescription
channelIdstring | null

the id of the channel

messageIdstring

the id of the message

dataobject

the message payload

Returns:
Type: 
Promise.<object>

(async) fetch(channelId)

Fetch a channel from Discord

Parameters:
NameTypeDescription
channelIdstring

The id of the channel

Example
const channel = await new ChannelManager(client, "980770618087710754").fetch();
console.log(channel);

(async) fetchMessage(channelId, messageId) → {Promise.<object>}

Fetch a message from a channel

Parameters:
NameTypeDescription
channelId
messageId
Returns:
Type: 
Promise.<object>

(async) fetchReactions(channelId, messageId, after, limit) → {Promise.<object>}

Fetch all reactions from a message

Parameters:
NameTypeDescription
channelIdstring | null
messageIdstring | null
afterstring | null
limitnumber | null
Returns:
Type: 
Promise.<object>

get(channelId)

Get the channel from cache if enabled

Parameters:
NameTypeDescription
channelIdstring

The id of the channel

Example
const channel = await new ChannelManager(client, "980770618087710754").get();