Appearance
ChannelManager
Package: @erinjs/core
Manages channels with fetch and send. Extends Collection so you can use .get(), .set(), .filter(), etc.
Constructor
| Name | Type | Optional | Description |
|---|---|---|---|
client | Client | No |
Properties
| Name | Type | Readonly | Optional | Description |
|---|---|---|---|---|
maxSize | number | Yes | No |
Methods
fetch() async
Fetch a channel by ID from the API (or return from cache if present).
Returns: Promise<Channel>
Parameters:
| Name | Type | Optional | Description |
|---|---|---|---|
channelId | string | No | Snowflake of the channel |
fetchMessage() async
Fetch a message by ID from the API.
Returns: Promise<Message>
Parameters:
| Name | Type | Optional | Description |
|---|---|---|---|
channelId | string | No | Snowflake of the channel |
messageId | string | No | Snowflake of the message |
resolve() async
Get a channel from cache or fetch from the API if not present. Convenience helper to avoid repeating client.channels.get(id) ?? (await client.channels.fetch(id)).
Returns: Promise<Channel>
Parameters:
| Name | Type | Optional | Description |
|---|---|---|---|
channelId | string | No | Snowflake of the channel |
send() async
Send a message to a channel by ID. Works even when the channel is not cached. Skips the fetch when you only need to send.
Returns: Promise<Message>
Parameters:
| Name | Type | Optional | Description |
|---|---|---|---|
channelId | string | No | Snowflake of the channel (text channel or DM) |
payload | string | MessageSendOptions | No | Text content or object with content, embeds, and/or files |
set()
Returns: this
Parameters:
| Name | Type | Optional | Description |
|---|---|---|---|
key | string | No | |
value | Channel | No |