CategoryChannel class

The CategoryChannel class extends the Zyno Bot Addons BaseChannel class.

const categoryChannel = new CategoryChannel(data: CategoryChannel, addon: Addon, guild: Guild);

constructor

The CategoryChannel class provides three required arguments. The first is a Discord.js channel which is an instance of the CategoryChannel class. The second argument is the addon where to create the channel for and has to be an instance of the Addon class. The third argument is the guild where the CategoryChannel class belongs to and must be an instance of the Guild class.

Properties

id

The id of the channel and is a Twitter snowflake.

name

The name of the channel.

channels

The channels which are inside the category channel.

position

The position of the channel comparing to other channels in the guild.

deletable

A boolean which defines whether the channel can be deleted or not.

guild

The guild the channel belongs to.

guildId

The id of the guild the channel belongs to.

manageable

A boolean which defines whether the bot is able to edit the channel or not.

permissions

A save with the key being a Twitter snowflake defining a user or role id and the value being an instance of the Permissions class which defines the permissions the user or role has of the corresponding user or role id.

type

A string which provides the type of the channel. In the table below is mentioned which types are available:

TypeDescription

GuildText

A default Discord text channel where everyone with a certain permission is allowed to communicate with each other.

DM

A Discord DM channel which only communicates between the bot and a specific user.

GuildVoice

A default Discord voice channel where everyone with a certain permission can call with each other.

GroupDM

A Discord DM channel which communicates with a specific set of people. This is not supported for bots.

GuildCategory

A category channel where channels can be organized in.

GuildAnnouncement

An announcement text channel in which server announcements are sent and users can follow and crosspost into their own guild.

AnnouncementThread

A Discord thread channel which only can be created in announcement channels.

PublicThread

A Discord thread channel where everyone who has access to the parent channel can communicate in.

PrivateThread

A Discord thread channel where only a specific set of people has access to unlike the PublicThread channel.

GuildStageVoice

A Discord voice channel where only a specific set of people can talk and the other participants can only listen to what's being told by the hosters.

GuildDirectory

A channel in a Student Hub which contains a list of servers.

GuildForum

A Discord channel where posts can be created and only can be communicated in the posts.

created

An instance of the default Date class which defines the time when the channel was created.

createdTimestamp

A number which represents the timestamp of when the channel was created.

string

Returns the channel mention as a string.

url

The url of the channel.

viewable

A boolean which defines whether the category channel can be seen by the bot.

Functions

isTextChannel

baseChannel.isTextChannel() : boolean;

Returns a boolean which defines whether the channel is a text channel or not (GuildText or GuildAnnouncement).

isVoiceChannel

baseChannel.isVoiceChannel() : boolean;

Returns a boolean which defines whether the channel is a voice channel or not (GuildVoice).

isVoiceStage

baseChannel.isVoiceStage() : boolean;

Returns a boolean which defines whether the channel is a voice stage channel or not (GuildVoiceStage)

isDM

baseChannel.isDM() : boolean;

Returns a boolean which defines whether the channel is a DM channel or not (DM).

isThread

baseChannel.isThread() : boolean;

Returns a boolean which defines whether the channel is a thread channel or no t(PublicThread, PrivateThread, AnnouncementThread).

isTicket

baseChannel.isTicket() : boolean;

Returns a boolean which defines whether the channel is an open ticket of a user or not.

getTicketOwner

baseChannel.getTicketOwner() : Member | undefined;

Returns a Member class of the member who opened the ticket. If the channel is not a ticket, the function will return undefined.

getTicketInfo

baseChannel.getTicketInfo() : object | undefined;

Returns an object with information of the open ticket. If the channel is not a ticket, the function will return undefined.

{
    channelId: string;
    claimed?: boolean; // Works for tickets created since Zyno Bot version 1.5.0
    category?: string; // Works for tickets created since Zyno Bot version 1.5.0
    owner?: Member; // Almost certainly defined
    closed: boolean;
}

update

categoryChannel.update() : Promise<CategoryChannel>;

Updates the channel information when changes have been made to it. The function returns a Promise which returns the CategoryChannel class once it's fulfilled.

delete

categoryChannel.delete() : Promise<void>;

Deletes the channel. The function returns a Promise which will return a void once it's fulfilled.

setName

categoryChannel.setName(name: string, reason?: string) : Promise<CategoryChannel>;

Changes the name of the channel. The function returns a Promise which returns the CategoryChannel class once it's fulfilled.

ArgumentDescription

name

The new name you want to give to the channel. This must be a string between 1-100 characters.

reason

The reason you want to change the channel's name. This must be a string between 1-512 characters, but is not required.

setPosition

categoryChannel.setPosition(position: number, reason?: string) : Promise<CategoryChannel>;

Changes the position of the channel comparing to other channels. The function returns a Promise which returns the CategoryChannel class once it's fulfilled.

ArgumentDescription

position

The new position you want to give to the channel. This must be a number where 0 is the highest position.

reason

The reason you want to change the channel's position. This must be a string between 1-512 characters, but is not required.

Last updated