/**
+ const { PERMISSIONS } = require("../constants");
+const ChannelMessageManager = require("../managers/ChannelMessageManager");
+const checkPermission = require("../util/checkPermission");
+const Message = require("./Message");
+
+/**
* Represents a channel within Discord.
* @see {@link https://discord.com/developers/docs/resources/channel}
*/
class Channel {
-
+
/**
* Creates the base structure for a channel.
* @constructor
@@ -138,6 +143,46 @@ structures/Channel.js
*/
this.type = data.type;
+ const existing = this.guild?.channels.cache.get(data.id) || null;
+
+ /**
+ * The message manager for this channel.
+ * @type {ChannelMessageManager}
+ */
+ this.messages = existing && existing.messages && existing.messages.cache ? existing.messages : new ChannelMessageManager(client, this);
+
+ }
+
+ /**
+ * Sends a message to this channel.
+ * @param {String} content The message content.
+ * @param {Object} param1 Embeds, components and files to include with the message.
+ * @returns {Promise<Message>}
+ * @see {@link https://discord.com/developers/docs/resources/channel#create-message}
+ */
+ async send(content, { embed, components, files, embeds } = {}) {
+
+ if (!checkPermission(await this.guild.me().catch(() => null), PERMISSIONS.SEND_MESSAGES))
+ return null;
+
+ const body = {};
+
+ if (content)
+ body.content = content;
+
+ if (embed)
+ body.embeds = [embed.toJSON()];
+ else if (embeds && embeds.length != 0)
+ body.embeds = embeds.map(e => e.toJSON());
+ if (components)
+ body.components = components.toJSON();
+ if (files)
+ body.files = files;
+
+ const data = await this.client.request.makeRequest("postCreateMessage", [this.id], body);
+
+ return new Message(this.client, data, this.id.toString(), this.guild?.id.toString() || this.guild_id.toString(), false);
+
}
}
diff --git a/structures_TextChannel.js.html b/structures_TextChannel.js.html
index 75fdff361..f5120b4e0 100644
--- a/structures_TextChannel.js.html
+++ b/structures_TextChannel.js.html
@@ -86,7 +86,6 @@ structures/TextChannel.js
const { PERMISSIONS } = require("../constants");
-const ChannelMessageManager = require("../managers/ChannelMessageManager");
const Channel = require("./Channel");
const Message = require("./Message");
const checkPermission = require("../util/checkPermission");
@@ -111,14 +110,6 @@ structures/TextChannel.js
super(client, data, guild_id);
- const existing = client.guilds.cache.get(guild_id)?.channels.cache.get(data.id) || null;
-
- /**
- * The message manager for this channel.
- * @type {ChannelMessageManager}
- */
- this.messages = existing && existing.messages && existing.messages.cache ? existing.messages : new ChannelMessageManager(client, this);
-
if (nocache == false && this.client.cacheChannels == true)
this.guild?.channels.cache.set(data.id, this);
@@ -128,38 +119,6 @@ structures/TextChannel.js
}
- /**
- * Sends a message to this channel.
- * @param {String} content The message content.
- * @param {Object} param1 Embeds, components and files to include with the message.
- * @returns {Promise<Message>}
- * @see {@link https://discord.com/developers/docs/resources/channel#create-message}
- */
- async send(content, { embed, components, files, embeds } = {}) {
-
- if (!checkPermission(await this.guild.me().catch(() => null), PERMISSIONS.SEND_MESSAGES))
- return null;
-
- const body = {};
-
- if (content)
- body.content = content;
-
- if (embed)
- body.embeds = [embed.toJSON()];
- else if (embeds && embeds.length != 0)
- body.embeds = embeds.map(e => e.toJSON());
- if (components)
- body.components = components.toJSON();
- if (files)
- body.files = files;
-
- const data = await this.client.request.makeRequest("postCreateMessage", [this.id], body);
-
- return new Message(this.client, data, this.id.toString(), this.guild?.id.toString() || this.guild_id.toString(), false);
-
- }
-
/**
* Bulk deletes all the message IDs provided.
* @param {String[]} messages An array of message IDs, as strings.
diff --git a/structures_Thread.js.html b/structures_Thread.js.html
index 112b4b4c0..dac6edaa6 100644
--- a/structures_Thread.js.html
+++ b/structures_Thread.js.html
@@ -85,8 +85,7 @@ structures/Thread.js
- const ChannelMessageManager = require("../managers/ChannelMessageManager");
-const Channel = require("./Channel");
+ const Channel = require("./Channel");
/**
* Represents a thread within Discord.
@@ -108,14 +107,6 @@ structures/Thread.js
super(client, data, guild_id);
- const existing = this.guild?.channels.cache.get(data.id) || null;
-
- /**
- * The message manager for this channel.
- * @type {ChannelMessageManager}
- */
- this.messages = existing && existing.messages && existing.messages.cache ? existing.messages : new ChannelMessageManager(client, this);
-
/**
* The member who created this thread.
* @type {Member?}
diff --git a/structures_VoiceChannel.js.html b/structures_VoiceChannel.js.html
deleted file mode 100644
index ed6859d64..000000000
--- a/structures_VoiceChannel.js.html
+++ /dev/null
@@ -1,145 +0,0 @@
-
-
-
-
-
-
-
-
-
- structures/VoiceChannel.js
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Source
- structures/VoiceChannel.js
-
-
-
-
-
-
-
-
- const { CHANNEL_TYPES } = require("../constants");
-const ChannelMessageManager = require("../managers/ChannelMessageManager");
-const Channel = require("./Channel");
-
-class VoiceChannel extends Channel {
-
- constructor(client, data, guild_id, nocache = false) {
-
- super(client, data, guild_id);
-
- const existing = client.guilds.cache.get(guild_id)?.channels.cache.get(data.id) || null;
-
- /**
- * The message manager for this channel.
- * @type {ChannelMessageManager}
- */
- this.messages = existing && existing.messages && existing.messages.cache ? existing.messages : new ChannelMessageManager(client, this);
-
- if (data.type == CHANNEL_TYPES.GUILD_STAGE_VOICE)
- this.stage = true;
-
- if (nocache == false && this.client.cacheChannels == true)
- this.guild?.channels.cache.set(data.id, this);
-
- }
-
-}
-
-module.exports = VoiceChannel;
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-