Skip to main content
Version: 4.x

Corde Bot

Corde exports a object bot. Which provides functionalities in Discord through Discord.js Client. This object can be acessed by:

import { bot } from "corde";

Gets

Methods

Reference


voiceState

Gets the voice channel state that corde's bot is connected in, If it's connected. This property is filled when joinVoiceChannel() connects to a channel and is cleared when leaveVoiceChannal() is called.


isLoggedIn

Checks if corde's bot is connected and ready.


client

Client of Discord.js.


channel

  • throws Error if corde bot is not connected.

Same of getChannel().


channels

  • throws Error if corde bot is not connected.

Get all channels in cache of the bot.


guild

  • throws Error if corde bot is not connected.

Same of getGuild().


guildMembers

  • throws Error if corde bot is not connected.

Members of the guild defined in configs.


guilds

  • throws Error if corde bot is not connected.

Get all guilds in cache of the bot.


roles

  • throws Error if corde bot is not connected.

Get all roles in cache of the guild defined in configs.


isMessageAuthor(Message)

Checks if a given message was sent by corde's bot.


joinVoiceChannel(string)

  • throws Error if corde bot is not connected.

Joins corde's bot to a voice channel.


leaveVoiceChannel

  • throws Error if corde bot is not connected.

Leaves a voice channel.


getOnlyTextChannels

  • throws Error if corde bot is not connected.

From all channels in cache, get all that are of type text


isInVoiceChannel

  • throws Error if corde bot is not connected.

Checks if corde's bot is in a voice channel.


fetchChannel(id)

  • throws Error if corde bot is not connected.

Makes a fetch of a channel based on it's id.


fetchGuild(id)

  • throws Error if corde bot is not connected.

Makes a fetch of a guild based on it's id.


fetchRole(id)

  • throws Error if corde bot is not connected.

Fetch for a role based on it's id, caching it after that.


getChannel(id | object)

  • throws Error if corde bot is not connected.

Gets the channel defined in configs.


getGuild(id | object)

  • throws Error if corde bot is not connected.

Gets the guild defined in configs.


send(string | number | boolean | object)

  • throws Error if corde bot is not connected.
  • throws Error If message is invalid.

Sends a message to the connected TextChannel.


createRole(string? | object)

  • throws Error if corde bot is not connected.

Creates a new role to the guild provided in configs.


createGuild(string? | object)

  • throws Error if corde bot is not connected.

Creates a new guild in defined in configs.


createChannel(string | object)

  • throws Error if corde bot is not connected.

Creates a new channel in guild defined in configs.

If the parameter provided be a string or a object without the property type provided, then a textChannel will be created.


createVoiceChannel(string | object)

  • throws Error if corde bot is not connected.

Creates a new VoiceChannel in guild defined in configs.

client.channels.create("exampleName", { type: "voice" });

createTextChannel(string | object)

  • throws Error if corde bot is not connected.

Creates a new TextChannel in guild defined in configs.

Shortcut for:

client.channels.create("exampleName", { type: "text" });

createCategoryChannel(string | object)

  • throws Error if corde bot is not connected.

Creates a new CategoryChannel in guild defined in configs.

Shortcut for:

client.channels.create("exampleName", { type: "category" });

getRole(string | object)

  • throws Error if corde bot is not connected.

Finds a role in config guild's cache, basing on it's id