AbstractReadonlyclientThe client instance.
The unique identifier for the object.
The type of the channel. Defaults to "UNKNOWN".
Gets the timestamp (in milliseconds) when the channel was created.
The timestamp of the channel's creation.
Creates a deep clone of the object.
A clone of the object.
Updates the object with new data and returns a clone of the object.
The data to update the object with.
Optionalclear: string[]Fields to clear in the object.
A clone of the updated object.
Creates a new webhook in this channel.
The name of the webhook
Optionalavatar: string | Readable | FileOptional avatar for the webhook. Can be a URL string, Readable stream, or File object
Promise resolving to the created webhook response
Deletes the current channel instance from the client's channel collection.
This method interacts with the client's channel management system to remove the channel. Once deleted, the channel will no longer be accessible through the client.
A promise that resolves when the channel has been successfully deleted.
Deletes a webhook.
The ID of the webhook to delete
The token of the webhook
Promise that resolves when the webhook is deleted
Edits a webhook's properties.
The ID of the webhook to edit
The token of the webhook
The options to edit on the webhook
Promise resolving to the updated webhook response
Compares this object with another to determine if they are equal.
Optionalobj: Channel | nullThe object to compare with.
true if the objects are equal, otherwise false.
Retrieves partial information about a webhook using only its ID. This method provides limited webhook information without requiring a token.
The ID of the webhook to retrieve partial information for
Promise resolving to the webhook response with partial information
Retrieves a specific webhook by ID and token.
The ID of the webhook to retrieve
The token of the webhook
Promise resolving to the webhook response
Retrieves all webhooks for this channel.
Promise resolving to an array of webhook responses
Checks if the channel is part of a server.
True if the channel is a server channel, otherwise false.
Checks if the channel is a group channel.
True if the channel is a group channel, otherwise false.
Checks if the channel is a text-based channel.
True if the channel is a text-based channel, otherwise false.
Checks if the channel is a voice channel.
True if the channel is a voice channel, otherwise false.
Sends a message through a webhook in this channel.
The ID of the webhook to send the message through
The token of the webhook
The message content. Can be a string or MessageOptions object with attachments and embeds
Promise resolving to the sent message
// Send a simple text message
await channel.sendWebhookMessage("webhookId", "token", "Hello, world!");
// Send a message with embeds and attachments
await channel.sendWebhookMessage("webhookId", "token", {
content: "Check out this image!",
attachments: ["https://example.com/image.png"],
embeds: [myEmbed]
});
Sets default permissions for this channel.
Array of permissions to allow by default.
A promise that resolves when the permissions have been updated.
Sets default permissions for this channel.
Object containing allow and/or deny permissions.
A promise that resolves when the permissions have been updated.
// Allow specific permissions only
await channel.setDefaultPermissions({ allow: ["ViewChannel", "SendMessage"] });
// Deny specific permissions only
await channel.setDefaultPermissions({ deny: ["ManageMessages"] });
// Set both allow and deny permissions
await channel.setDefaultPermissions({
allow: ["ViewChannel"],
deny: ["ManageMessages"]
});
Sets default permissions for this channel (legacy format).
Object containing allow and deny permissions.
A promise that resolves when the permissions have been updated.
Sets role permissions for this channel.
The ID of the role to set permissions for.
Array of permissions to allow for the role.
A promise that resolves when the permissions have been updated.
Sets role permissions for this channel.
The ID of the role to set permissions for.
Array of permissions to allow for the role.
Array of permissions to deny for the role.
A promise that resolves when the permissions have been updated.
Sets role permissions for this channel.
The ID of the role to set permissions for.
Object containing allow and/or deny permissions.
A promise that resolves when the permissions have been updated.
// Allow specific permissions only
await channel.setRolePermissions(roleId, { allow: ["ViewChannel", "SendMessage"] });
// Deny specific permissions only
await channel.setRolePermissions(roleId, { deny: ["ManageMessages"] });
// Set both allow and deny permissions
await channel.setRolePermissions(roleId, {
allow: ["ViewChannel"],
deny: ["ManageMessages"]
});
Converts the channel to a string representation.
A string representation of the channel in the format <#channelId>.
Represents a generic communication channel in the client. This abstract class provides a base structure and common functionality for all types of channels, such as text, voice, group, and server channels.