Channel
Channel ⇐ Base
Section titled “Channel ⇐ Base”Represents a channel in a guild or a direct message.
Kind: global class
Extends: Base
- Channel ⇐
Base- new Channel([data], guildId, client)
- .parent ⇒
Channel|null - .guild ⇒
- .fetch([options]) ⇒
Promise - .delete(reason) ⇒
Promise.<void> - .edit(options) ⇒
Promise - .fetchInvites() ⇒
Promise.<RaidenCol> - .createInvite(options) ⇒
Promise.<Invite> - .clone() ⇒
Promise.<Channel> - .isGuildText() ⇒
boolean - .isDM() ⇒
boolean - .isStage() ⇒
boolean - .isForum() ⇒
boolean - .isMedia() ⇒
boolean - .isGuildVoice() ⇒
boolean - .isNews() ⇒
boolean - .isCategory() ⇒
boolean - .isText() ⇒
boolean - .isThread() ⇒
boolean - .isVoice() ⇒
boolean - .isDirectory() ⇒
boolean - .inGuild() ⇒
boolean - .inCachedGuild() ⇒
boolean - .isRuleChannel() ⇒
boolean - .isSystemChannel() ⇒
boolean|null - .bannerURL(options) ⇒
string|null - .setName(name, reason) ⇒
Promise - .setType(type, reason) ⇒
Promise.<any> - .setTopic(topic, reason) ⇒
Promise - .setPosition(position, reason) ⇒
Promise.<void> - .setParent(parent, reason) ⇒
Promise - .setDefaultAutoArchiveDuration(defaultAutoArchiveDuration, reason) ⇒
Promise - .setFlags(flags, reason) ⇒
Promise.<void> - .lockPermissions() ⇒
Promise.<void> - .permissionsFor(userOrRole) ⇒
Permissions - .fetchWebhooks() ⇒
Promise.<RaidenCol> - .createWebhook([options]) ⇒
Promise.<Webhook>
new Channel([data], guildId, client)
Section titled “new Channel([data], guildId, client)”Constructs a new Channel object.
| Param | Type | Description |
|---|---|---|
| [data] | Object | The data for the channel. |
| guildId | string | The ID of the guild that the channel belongs to. |
| client | Client | The client instance. |
channel.parent ⇒ Channel | null
Section titled “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 ⇒
Section titled “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
Section titled “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.
| Param | Type | Description |
|---|---|---|
| [options] | Object | The options to be used for fetching the channels. |
channel.delete(reason) ⇒ Promise.<void>
Section titled “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.
| Param | Type | Description |
|---|---|---|
| reason | string | The reason for deleting the channel. |
channel.edit(options) ⇒ Promise
Section titled “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.
| Param | Type | Description |
|---|---|---|
| options | Object | The options object containing the properties to edit. |
channel.fetchInvites() ⇒ Promise.<RaidenCol>
Section titled “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>
Section titled “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.
| Param | Type | Description |
|---|---|---|
| options | Object | The options for creating the invite. |
channel.clone() ⇒ Promise.<Channel>
Section titled “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
Section titled “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
Section titled “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
Section titled “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
Section titled “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
Section titled “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
Section titled “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
Section titled “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
Section titled “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
Section titled “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
Section titled “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
Section titled “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
Section titled “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
Section titled “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
Section titled “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
Section titled “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
Section titled “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
Section titled “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.
| Param | Type | Description |
|---|---|---|
| options | Object | Optional parameters for generating the URL. |
| [options.dynamic] | boolean | Whether to generate a dynamic URL. |
| [options.size] | string | The desired size of the banner image. |
| [options.format] | string | The desired format of the banner image. |
channel.setName(name, reason) ⇒ Promise
Section titled “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.
| Param | Type | Description |
|---|---|---|
| name | string | The new name to set. |
| reason | string | The reason for setting the new name. |
channel.setType(type, reason) ⇒ Promise.<any>
Section titled “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.
| Param | Type | Description |
|---|---|---|
| type | any | The type to set. |
| reason | any | The reason to set. |
channel.setTopic(topic, reason) ⇒ Promise
Section titled “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.
| Param | Type | Description |
|---|---|---|
| topic | string | The new topic to set. |
| reason | string | The reason for changing the topic. |
channel.setPosition(position, reason) ⇒ Promise.<void>
Section titled “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.
| Param | Type | Description |
|---|---|---|
| position | any | The new position of the object. |
| reason | string | The reason for the position change. |
channel.setParent(parent, reason) ⇒ Promise
Section titled “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.
| Param | Type | Description |
|---|---|---|
| parent | any | The new parent object. |
| reason | string | The reason for setting the new parent. |
channel.setDefaultAutoArchiveDuration(defaultAutoArchiveDuration, reason) ⇒ Promise
Section titled “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.
| Param | Type | Description |
|---|---|---|
| defaultAutoArchiveDuration | number | The new default auto-archive duration to set. |
| reason | string | The reason for setting the new default auto-archive duration. |
channel.setFlags(flags, reason) ⇒ Promise.<void>
Section titled “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.
| Param | Type | Description |
|---|---|---|
| flags | any | The flags to set. |
| reason | string | The reason for setting the flags. |
channel.lockPermissions() ⇒ Promise.<void>
Section titled “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
Section titled “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.
| Param | Type | Description |
|---|---|---|
| userOrRole | string | GuildMember | Role | The user or role to retrieve permissions for. |
channel.fetchWebhooks() ⇒ Promise.<RaidenCol>
Section titled “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>
Section titled “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.
| Param | Type | Description |
|---|---|---|
| [options] | Object | Optional parameters for creating the webhook. |
| [options.reason] | string | The reason for creating the webhook. |
| [options.name] | string | The name of the webhook. |
| [options.avatar] | string | The avatar URL or file path of the webhook. |