ChannelManager
classe · Source
A manager of channels belonging to a client
Extends: CachedManager
Properties
cache
cache: Collection<Snowflake, Channel>
The cache of Channels Source
_cache
_cache: Collection
The private cache of items for this manager. Source
holds
holds: function
The data structure belonging to this manager. Source
client
client: Client
The client that instantiated this Manager Source
Methods
resolve
resolve(channel: ChannelResolvable): Channel
Resolves a ChannelResolvable to a Channel object. Parameters
| Name | Type | Description |
|---|---|---|
channel | ChannelResolvable | The channel resolvable to resolve |
Returns: ChannelSource
resolveId
resolveId(channel: ChannelResolvable): Snowflake
Resolves a ChannelResolvable to a channel id string. Parameters
| Name | Type | Description |
|---|---|---|
channel | ChannelResolvable | The channel resolvable to resolve |
Returns: SnowflakeSource
fetch
async fetch(id: Snowflake, options?: FetchChannelOptions): Promise<?Channel>
Obtains a channel from Discord, or the channel cache if it's already available. Parameters
| Name | Type | Description |
|---|---|---|
id | Snowflake | The channel's id |
options? | FetchChannelOptions | Additional options for this fetch |
Returns: Promise<?Channel>
js
// Fetch a channel by its id
client.channels.fetch('222109930545610754')
.then(channel => console.log(channel.name))
.catch(console.error);createGroupDM
async createGroupDM(recipients?: Array<UserResolvable>): Promise<GroupDMChannel>
Create Group DM Parameters
| Name | Type | Description |
|---|---|---|
recipients? | Array<UserResolvable> | Array of recipients Default: []. |
Returns: Promise<GroupDMChannel> — Channel
js
client.channels.createGroupDM();