Constructor
new ChannelManager(client, id)
Parameters:
Name | Type | Description |
---|---|---|
client | object | the Application Client |
id | string | 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:
Name | Type | Description |
---|---|---|
channelId | string | | |
data | object | the message payload |
Returns:
- Type:
- Promise.<object>
(async) createReaction(channelId, messageId, emoji) → {Promise.<object>}
create a reaction to a message
Parameters:
Name | Type | Description |
---|---|---|
channelId | string | | the id of the channel |
messageId | string | the id of the message |
emoji | string | the emoji to react with |
Returns:
- Type:
- Promise.<object>
(async) crosspostMessage(channelId, messageId) → {Promise.<object>}
crosspost a message to a channel
Parameters:
Name | Type | Description |
---|---|---|
channelId | string | | the id of the channel |
messageId | string | the id of the message |
Returns:
- Type:
- Promise.<object>
(async) delete(channelId, reasonnullable)
Delete a channel from Discord
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
channelId | string | The id of the channel | ||
reason | string | <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:
Name | Type | Description |
---|---|---|
channelId | string | | the id of the channel |
messageId | string | the id of the message |
Returns:
- Type:
- Promise.<object>
(async) editMessage(channelId, messageId, data) → {Promise.<object>}
edit a message
Parameters:
Name | Type | Description |
---|---|---|
channelId | string | | the id of the channel |
messageId | string | the id of the message |
data | object | the message payload |
Returns:
- Type:
- Promise.<object>
(async) fetch(channelId)
Fetch a channel from Discord
Parameters:
Name | Type | Description |
---|---|---|
channelId | string | 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:
Name | Type | Description |
---|---|---|
channelId | ||
messageId |
Returns:
- Type:
- Promise.<object>
(async) fetchReactions(channelId, messageId, after, limit) → {Promise.<object>}
Fetch all reactions from a message
Parameters:
Name | Type | Description |
---|---|---|
channelId | string | | |
messageId | string | | |
after | string | | |
limit | number | |
Returns:
- Type:
- Promise.<object>
get(channelId)
Get the channel from cache if enabled
Parameters:
Name | Type | Description |
---|---|---|
channelId | string | The id of the channel |
Example
const channel = await new ChannelManager(client, "980770618087710754").get();