ChannelMessageManager

ChannelMessageManager

Manages all messages within a channel.

Constructor

new ChannelMessageManager(client, guild, channel)

Description:
  • Creates a channel message manager.

Source:
Parameters:
Name Type Description
client Client

The client instance.

guild Guild

The guild that this message manager belongs to.

channel Channel

The channel that is being managed.

Throws:
TypeError

Members

(readonly) guild :Guild

Description:
  • The guild that this message manager belongs to.

Source:

The guild that this message manager belongs to.

Type:

Methods

(async, static) fetchMessage(client, guildId, channelId, messageId) → {Message}

Description:
  • Fetches a message from the channel.

Source:
Parameters:
Name Type Description
client Client

The client instance.

guildId String

The ID of the guild.

channelId String

The ID of the channel.

messageId String

The ID of the message.

Throws:
TypeError | Error
Returns:
Type
Message

(async, static) fetchMessages(client, guildId, channelId, options) → {Array.<Message>}

Description:
  • Fetches a collection of messages from the channel.

Source:
Parameters:
Name Type Description
client Client

The client instance.

guildId String

The ID of the guild.

channelId String

The ID of the channel.

options Object

The options for fetching messages.

Properties
Name Type Description
around String

The ID of the message to fetch messages around.

before String

The ID of the message to fetch messages before.

after String

The ID of the message to fetch messages after.

limit Number

The maximum number of messages to fetch.

Throws:
TypeError | Error
Returns:
Type
Array.<Message>

(static) getCacheManager(client, guildId, channelId) → {ChannelMessageManager}

Description:
  • Returns the cache manager.

Source:
Parameters:
Name Type Description
client Client

The client instance.

guildId String

The ID of the guild.

channelId String

The ID of the channel.

Throws:
TypeError
Returns:
Type
ChannelMessageManager

(static) getMessage(client, guildId, channelId, messageId) → {Message}

Description:
  • Gets a message from the cache.

Source:
Parameters:
Name Type Description
client Client

The client instance.

guildId String

The ID of the guild.

channelId String

The ID of the channel.

messageId String

The ID of the message.

Throws:
TypeError
Returns:
Type
Message

(async, static) purgeChannelMessages(client, channelId, messages, options) → {Promise.<void>}

Description:
  • Bulk deletes channel messages.

Source:
Parameters:
Name Type Description
client Client

The client instance.

channelId String

The id of the channel to purge messages in.

messages Array.<String>

An array of message ids to delete.

options Object
Throws:
TypeError
Returns:
Type
Promise.<void>

(async) fetch(options) → {Promise.<Array.<Message>>|Promise.<Message>}

Description:
  • Fetches a collection of messages or a singular message from the channel.

Source:
Parameters:
Name Type Description
options Object | String

Either an object of options or a message id.

Throws:
TypeError | Error
Returns:
Type
Promise.<Array.<Message>> | Promise.<Message>

(async) fetchPinned() → {Promise.<Array.<Message>>}

Description:
  • Fetches all the pinned messages that belong to the channel.

Source:
Returns:
Type
Promise.<Array.<Message>>

set(id, message) → {Message}

Description:
  • Adds a message to the cache.

Source:
Parameters:
Name Type Description
id String

The ID of the message to cache.

message Message

The message to cache.

Throws:
TypeError
Returns:
Type
Message