class ChannelManager
extends
CachedManager<Snowflake, Channel, ChannelResolvable>export class ChannelManager extends CachedManager<Snowflake, Channel, ChannelResolvable>
A manager of channels belonging to a client
readonlyCollection<Key, Holds> cache :
The cache of items for this manager.
Inherited from: DataManager
readonlyConstructable<Holds> holds :
The data structure belonging to this manager.
Inherited from: DataManager
createMessageoptions: string | MessagePayload | MessageCreateOptions) : Promise<OmitPartialGroupDMChannel<Message>> (
options: string | MessagePayload | MessageCreateOptions
Creates a message in a channel.
Examples:
// Send a basic message
client.channels.createMessage(channel, 'hello!')
.then(message => console.log(`Sent message: ${message.content}`))
.catch(console.error);
// Send a remote file
client.channels.createMessage(channel, {
files: ['https://github.com/discordjs.png']
})
.then(console.log)
.catch(console.error);
// Send a local file
client.channels.createMessage(channel, {
files: [{
attachment: 'entire/path/to/file.jpg',
name: 'file.jpg',
description: 'A description of the file'
}]
})
.then(console.log)
.catch(console.error);
fetchid: Snowflakeoptions?: FetchChannelOptions) : Promise<Channel | null> (
id: Snowflake
options?: FetchChannelOptions
Obtains a channel from Discord, or the channel cache if it's already available.
Examples:
// Fetch a channel by its id
client.channels.fetch('222109930545610754')
.then(channel => console.log(channel.name))
.catch(console.error);
resolvechannel: ChannelResolvable) : BaseChannel | null (
channel: ChannelResolvable
Resolves a ChannelResolvable to a Channel object.
resolveIdchannel: ChannelResolvable) : Snowflake | null (
channel: ChannelResolvable
Resolves a ChannelResolvable to a channel id string.
valueOfCollection<Key, Holds> () :
Inherited from: DataManager