Skip to content

ChannelShorter

Signature

export declare class ChannelShorter extends BaseShorter

Methods

fetch(id: string, force?: boolean): Promise<AllChannels>;

Fetches a channel by its ID.

Parameters
id
The ID of the channel to fetch.
force
Whether to force fetching the channel from the API even if it exists in the cache.
Returns

A Promise that resolves to the fetched channel.

delete(id: string, optional?: ChannelShorterOptionalParams): Promise<AllChannels>;

Deletes a channel by its ID.

Parameters
id
The ID of the channel to delete.
optional
Optional parameters for the deletion.
Returns

A Promise that resolves to the deleted channel.

editOverwrite(channelId: string, overwriteId: string, raw: ChannelShorterOverwriteBody, optional?: ChannelShorterOptionalParams): Promise<void>;

Edits or creates a permission overwrite for a channel.

Parameters
channelId
The ID of the channel.
overwriteId
The ID of the role or member overwrite.
body
The overwrite payload.
optional
Optional parameters including guild id and reason.
deleteOverwrite(channelId: string, overwriteId: string, optional?: ChannelShorterOptionalParams): Promise<void>;

Deletes a permission overwrite from a channel.

Parameters
channelId
The ID of the channel.
overwriteId
The ID of the role or member overwrite.
optional
Optional parameters including guild id and reason.
typing(id: string): Promise<void>;

Sends a typing indicator to the channel.

Parameters
id
The ID of the channel.
Returns

A Promise that resolves when the typing indicator is successfully sent.

setPin(messageId: string, channelId: string, reason?: string): Promise<undefined>;

Pins a message in the channel.

Parameters
messageId
The ID of the message to pin.
channelId
The ID of the channel.
reason
The reason for pinning the message.
Returns

A Promise that resolves when the message is successfully pinned.

deletePin(messageId: string, channelId: string, reason?: string): Promise<undefined>;

Unpins a message in the channel.

Parameters
messageId
The ID of the message to unpin.
channelId
The ID of the channel.
reason
The reason for unpinning the message.
Returns

A Promise that resolves when the message is successfully unpinned.

thread(channelId: string, body: ThreadCreateBodyRequest, reason?: string): Promise<ThreadChannelStructure>;

Creates a new thread in the channel (only guild based channels).

Parameters
channelId
The ID of the parent channel.
reason
The reason for unpinning the message.
Returns

A promise that resolves when the thread is succesfully created.

fetchMemberPermissions(channelId: string, memberId: string, implicit?: boolean): Promise<PermissionsBitField>;

Fetches a member's permissions in a channel as computed by Discord, including their roles and overwrites. Threads use the overwrites of their parent channel.

Parameters
channelId
The ID of the channel.
memberId
The ID of the member.
implicit
Whether to clear every permission when `ViewChannel` (or `Connect` for voice and stage channels) is missing. Discord defaults to `true` and never applies it to bots.
Returns

A Promise that resolves to the member's channel permissions.

fetchRolePermissions(channelId: string, roleId: string, implicit?: boolean): Promise<PermissionsBitField>;

Fetches a role's permissions in a channel as computed by Discord, combined with `@everyone` and their overwrites. Other roles and member-specific overwrites are not taken into account.

Parameters
channelId
The ID of the channel.
roleId
The ID of the role.
implicit
Whether to clear every permission when `ViewChannel` (or `Connect` for voice and stage channels) is missing. Discord defaults to `true`.
Returns

A Promise that resolves to the role's channel permissions.

setVoiceStatus(channelId: string, status?: string | null): Promise<undefined>;