DMChannel class

The DMChannel class extends the Zyno Bot Addons BaseChannel class.

const dmChannel = new DMChannel(data: DMChannel, addon: Addon);

constructor

The DMChannel class provides two required arguments. The first is a Discord.js channel which is an instance of the DMChannel class. The second argument is the addon where to create the channel for and has to be an instance of the Addon class.

Properties

id

The id of the channel and is a Twitter snowflake.

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.

user

The user the bot is communicating with in the DM channel. The property returns an instance of the User class.

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

dmChannel.update() : Promise<DMChannel>;

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

send

dmChannel.send(...content: [string | Embed | ActionRowBuilder | ButtonBuilder | SelectMenuBuilder | object]) : Message;

Sends a DM to the user who the bot communicates with in the DM channel.

ArgumentDescription

content

The content of the message the bot should send. The content must be a string, an Embed class, the ActionRowBuilder class, the ButtonBuilder class, the SelectMenuBuilder class or an object which provides the message its content.

The object of the message may contain the following information:

  • content: A string of the content of the message.

  • embeds: An array with the Embed class.

  • files: An array with a string which represents a file url or an object when uploading a file.

  • components: An array with the Discord.js ActionRowBuilder class.

The file object data may contain the following information:

  • name: The name of the file you want to upload

  • attachment: The path of the file you want to upload

  • description: The description of the file

Last updated