Skip to content

Channel

Channel ⇐ Base

Represents a channel in a guild or a direct message.

Kind: global class
Extends: Base

new Channel([data], guildId, client)

Constructs a new Channel object.

ParamTypeDescription
[data]ObjectThe data for the channel.
guildIdstringThe ID of the guild that the channel belongs to.
clientClientThe client instance.

channel.parent ⇒ Channel | null

Get the parent channel of this channel.

Kind: instance property of Channel
Returns: Channel | null - The parent channel if it exists, otherwise null.

channel.guild ⇒

Retrieves the guild associated with this guildId.

Kind: instance property of Channel
Returns: The guild object if found, otherwise null.

channel.fetch([options]) ⇒ Promise

Fetches the channels using the provided options.

Kind: instance method of Channel
Returns: Promise - - A promise that resolves to the fetched channels.

ParamTypeDescription
[options]ObjectThe options to be used for fetching the channels.

channel.delete(reason) ⇒ Promise.<void>

Deletes the channel with the specified reason.

Kind: instance method of Channel
Returns: Promise.<void> - - A promise that resolves when the channel is deleted.

ParamTypeDescription
reasonstringThe reason for deleting the channel.

channel.edit(options) ⇒ Promise

Edits the properties of a channel using the provided options.

Kind: instance method of Channel
Returns: Promise - A promise that resolves when the channel has been successfully edited.

ParamTypeDescription
optionsObjectThe options object containing the properties to edit.

channel.fetchInvites() ⇒ Promise.<RaidenCol>

Fetches the invites for the channel.

Kind: instance method of Channel
Returns: Promise.<RaidenCol> - A promise that resolves to a collection of invites.

channel.createInvite(options) ⇒ Promise.<Invite>

Creates an invite for the current channel using the specified options.

Kind: instance method of Channel
Returns: Promise.<Invite> - A promise that resolves to the created invite.

ParamTypeDescription
optionsObjectThe options for creating the invite.

channel.clone() ⇒ Promise.<Channel>

Clones the channel.

Kind: instance method of Channel
Returns: Promise.<Channel> - A promise that resolves to the cloned channel.

channel.isGuildText() ⇒ boolean

Checks if the type of the object is “Guild_Text”.

Kind: instance method of Channel
Returns: boolean - - true if the type is “Guild_Text”, false otherwise.

channel.isDM() ⇒ boolean

Checks if the type of the object is “Dm”.

Kind: instance method of Channel
Returns: boolean - - true if the type is “Dm”, false otherwise.

channel.isStage() ⇒ boolean

Checks if the current stage is a Guild Stage Voice.

Kind: instance method of Channel
Returns: boolean - - True if the current stage is a Guild Stage Voice, false otherwise.

channel.isForum() ⇒ boolean

Checks if the current page is a forum page.

Kind: instance method of Channel
Returns: boolean - - true if the page is a forum page, false otherwise.

channel.isMedia() ⇒ boolean

Checks if the current object is of media type.

Kind: instance method of Channel
Returns: boolean - - true if the object is of media type, false otherwise.

channel.isGuildVoice() ⇒ boolean

Checks if the type of the object is “Guild_Voice”.

Kind: instance method of Channel
Returns: boolean - - true if the type is “Guild_Voice”, false otherwise.

channel.isNews() ⇒ boolean

Checks if the current type is “Guild_News”.

Kind: instance method of Channel
Returns: boolean - - Returns true if the type is “Guild_News”, otherwise returns false.

channel.isCategory() ⇒ boolean

Checks if the current object is of the category type.

Kind: instance method of Channel
Returns: boolean - - true if the object is of the category type, false otherwise.

channel.isText() ⇒ boolean

Checks if the current text is of a specific type.

Kind: instance method of Channel
Returns: boolean - - True if the text is of a specific type, false otherwise.

channel.isThread() ⇒ boolean

Checks if the current thread is a private, news, or public guild thread.

Kind: instance method of Channel
Returns: boolean - - True if the thread is a private, news, or public guild thread, false otherwise.

channel.isVoice() ⇒ boolean

Checks if the current object is of type “Guild_Voice” or “Guild_Stage_Voice”.

Kind: instance method of Channel
Returns: boolean - - true if the object is of type “Guild_Voice” or “Guild_Stage_Voice”, false otherwise.

channel.isDirectory() ⇒ boolean

Checks if the current object is a directory.

Kind: instance method of Channel
Returns: boolean - - Returns true if the object is a directory, false otherwise.

channel.inGuild() ⇒ boolean

Checks if the current context is within a guild.

Kind: instance method of Channel
Returns: boolean - - True if the context is within a guild, false otherwise.

channel.inCachedGuild() ⇒ boolean

Checks if the guild is cached in the client’s guild cache.

Kind: instance method of Channel
Returns: boolean - - true if the guild is cached, false otherwise.

channel.isRuleChannel() ⇒ boolean

Checks if the current channel is the rules channel for the guild.

Kind: instance method of Channel
Returns: boolean - - true if the current channel is the rules channel, false otherwise.

channel.isSystemChannel() ⇒ boolean | null

Checks if the current channel is the system channel of the guild.

Kind: instance method of Channel
Returns: boolean | null - - Returns true if the channel is the system channel, false if it is not, and null if the guild does not have a system channel.

channel.bannerURL(options) ⇒ string | null

Returns the URL of the channel banner image.

Kind: instance method of Channel
Returns: string | null - The URL of the channel banner image, or null if no banner is set.

ParamTypeDescription
optionsObjectOptional parameters for generating the URL.
[options.dynamic]booleanWhether to generate a dynamic URL.
[options.size]stringThe desired size of the banner image.
[options.format]stringThe desired format of the banner image.

channel.setName(name, reason) ⇒ Promise

Sets the name and reason for an object.

Kind: instance method of Channel
Returns: Promise - - A promise that resolves when the name and reason are successfully set.

ParamTypeDescription
namestringThe new name to set.
reasonstringThe reason for setting the new name.

channel.setType(type, reason) ⇒ Promise.<any>

Sets the type and reason of an object asynchronously.

Kind: instance method of Channel
Returns: Promise.<any> - - A promise that resolves to the edited object.

ParamTypeDescription
typeanyThe type to set.
reasonanyThe reason to set.

channel.setTopic(topic, reason) ⇒ Promise

Sets the topic of the current object and provides a reason for the change.

Kind: instance method of Channel
Returns: Promise - - A promise that resolves when the topic is successfully set.

ParamTypeDescription
topicstringThe new topic to set.
reasonstringThe reason for changing the topic.

channel.setPosition(position, reason) ⇒ Promise.<void>

Sets the position of an object and provides a reason for the change.

Kind: instance method of Channel
Returns: Promise.<void> - - A promise that resolves when the position is successfully set.

ParamTypeDescription
positionanyThe new position of the object.
reasonstringThe reason for the position change.

channel.setParent(parent, reason) ⇒ Promise

Sets the parent of an object and provides a reason for the change.

Kind: instance method of Channel
Returns: Promise - A promise that resolves when the parent is successfully set.

ParamTypeDescription
parentanyThe new parent object.
reasonstringThe reason for setting the new parent.

channel.setDefaultAutoArchiveDuration(defaultAutoArchiveDuration, reason) ⇒ Promise

Sets the default auto-archive duration for a specific item.

Kind: instance method of Channel
Returns: Promise - - A promise that resolves when the default auto-archive duration is successfully set.

ParamTypeDescription
defaultAutoArchiveDurationnumberThe new default auto-archive duration to set.
reasonstringThe reason for setting the new default auto-archive duration.

channel.setFlags(flags, reason) ⇒ Promise.<void>

Sets the flags and reason for an object.

Kind: instance method of Channel
Returns: Promise.<void> - - A promise that resolves when the flags are set.

ParamTypeDescription
flagsanyThe flags to set.
reasonstringThe reason for setting the flags.

channel.lockPermissions() ⇒ Promise.<void>

Locks the permissions for the current object.

Kind: instance method of Channel
Returns: Promise.<void> - A promise that resolves when the permissions are locked.

channel.permissionsFor(userOrRole) ⇒ Permissions

Retrieves the permissions for a given user or role in the guild.

Kind: instance method of Channel
Returns: Permissions - - The permissions for the user or role.
Throws:

  • RangeError - If the user or role is not found in the cache or is invalid.
ParamTypeDescription
userOrRolestring | GuildMember | RoleThe user or role to retrieve permissions for.

channel.fetchWebhooks() ⇒ Promise.<RaidenCol>

Fetches the webhooks associated with the channel.

Kind: instance method of Channel
Returns: Promise.<RaidenCol> - A promise that resolves to a collection of webhooks.

channel.createWebhook([options]) ⇒ Promise.<Webhook>

Creates a webhook for the current channel.

Kind: instance method of Channel
Returns: Promise.<Webhook> - A promise that resolves with the created webhook.

ParamTypeDescription
[options]ObjectOptional parameters for creating the webhook.
[options.reason]stringThe reason for creating the webhook.
[options.name]stringThe name of the webhook.
[options.avatar]stringThe avatar URL or file path of the webhook.