diff --git a/Channel.html b/Channel.html index c03dbe0ee..e2cff782c 100644 --- a/Channel.html +++ b/Channel.html @@ -279,7 +279,7 @@
Parameters:

View Source - structures/Channel.js, line 5 + structures/Channel.js, line 10

@@ -395,7 +395,7 @@

View Source - structures/Channel.js, line 21 + structures/Channel.js, line 26

@@ -476,7 +476,7 @@

View Source - structures/Channel.js, line 39 + structures/Channel.js, line 44

@@ -557,7 +557,7 @@

View Source - structures/Channel.js, line 46 + structures/Channel.js, line 51

@@ -634,7 +634,84 @@

View Source - structures/Channel.js, line 27 + structures/Channel.js, line 32 + +

+ + + + + + + + + +
+ + + + +ChannelMessageManager + + + + +

+ # + + + messages + + +

+ + + + +
+

The message manager for this channel.

+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+ View Source + + structures/Channel.js, line 65

@@ -711,7 +788,7 @@

View Source - structures/Channel.js, line 33 + structures/Channel.js, line 38

@@ -788,7 +865,7 @@

View Source - structures/Channel.js, line 52 + structures/Channel.js, line 57

@@ -805,6 +882,220 @@

+
+

Methods

+
+ +
+ + + +

+ # + + + async + + + + + send(content, param1) → {Promise.<Message>} + + +

+ + + + +
+

Sends a message to this channel.

+
+ + + + + + + + + + +
Parameters:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
content + + +String + + + +

The message content.

param1 + + +Object + + + +

Embeds, components and files to include with the message.

+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
See:
+
+ +
+ + + + + +

+ View Source + + structures/Channel.js, line 76 + +

+ +
+ + + + + + + + + + + + + + + + + + +
+
+
+ + + +
+ + +
+ + +Promise.<Message> + + +
+ +
+ + +
+
+ + + + +
+ +
+
+ diff --git a/TextChannel.html b/TextChannel.html index f65f006a6..bcee0c88c 100644 --- a/TextChannel.html +++ b/TextChannel.html @@ -360,7 +360,7 @@

Parameters:

View Source - structures/TextChannel.js, line 12 + structures/TextChannel.js, line 11

@@ -492,7 +492,7 @@

View Source - structures/Channel.js, line 21 + structures/Channel.js, line 26

@@ -578,7 +578,7 @@

View Source - structures/Channel.js, line 39 + structures/Channel.js, line 44

@@ -664,7 +664,7 @@

View Source - structures/Channel.js, line 46 + structures/Channel.js, line 51

@@ -746,7 +746,7 @@

View Source - structures/Channel.js, line 27 + structures/Channel.js, line 32

@@ -797,6 +797,11 @@

+
Overrides:
+
+ @@ -821,9 +826,9 @@

- View Source + View Source - structures/TextChannel.js, line 33 + structures/Channel.js, line 65

@@ -905,7 +910,7 @@

View Source - structures/Channel.js, line 33 + structures/Channel.js, line 38

@@ -987,7 +992,7 @@

View Source - structures/Channel.js, line 52 + structures/Channel.js, line 57

@@ -1132,7 +1137,7 @@

Parameters:

View Source - structures/TextChannel.js, line 81 + structures/TextChannel.js, line 40

@@ -1306,6 +1311,11 @@
Parameters:
+
Overrides:
+
+ @@ -1337,9 +1347,9 @@
Parameters:

- View Source + View Source - structures/TextChannel.js, line 51 + structures/Channel.js, line 76

diff --git a/Thread.html b/Thread.html index 9c14ef035..b67625893 100644 --- a/Thread.html +++ b/Thread.html @@ -360,7 +360,7 @@
Parameters:

View Source - structures/Thread.js, line 9 + structures/Thread.js, line 8

@@ -492,7 +492,7 @@

View Source - structures/Channel.js, line 21 + structures/Channel.js, line 26

@@ -578,7 +578,7 @@

View Source - structures/Channel.js, line 39 + structures/Channel.js, line 44

@@ -664,7 +664,7 @@

View Source - structures/Channel.js, line 46 + structures/Channel.js, line 51

@@ -746,7 +746,7 @@

View Source - structures/Channel.js, line 27 + structures/Channel.js, line 32

@@ -797,6 +797,11 @@

+
Overrides:
+
+ @@ -821,9 +826,9 @@

- View Source + View Source - structures/Thread.js, line 30 + structures/Channel.js, line 65

@@ -905,7 +910,7 @@

View Source - structures/Channel.js, line 33 + structures/Channel.js, line 38

@@ -986,7 +991,7 @@

View Source - structures/Thread.js, line 36 + structures/Thread.js, line 27

@@ -1067,7 +1072,7 @@

View Source - structures/Thread.js, line 43 + structures/Thread.js, line 34

@@ -1148,7 +1153,7 @@

View Source - structures/Thread.js, line 49 + structures/Thread.js, line 40

@@ -1229,7 +1234,7 @@

View Source - structures/Thread.js, line 56 + structures/Thread.js, line 47

@@ -1311,7 +1316,7 @@

View Source - structures/Channel.js, line 52 + structures/Channel.js, line 57

@@ -1328,6 +1333,225 @@

+
+

Methods

+
+ +
+ + + +

+ # + + + async + + + + + send(content, param1) → {Promise.<Message>} + + +

+ + + + +
+

Sends a message to this channel.

+
+ + + + + + + + + + +
Parameters:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
content + + +String + + + +

The message content.

param1 + + +Object + + + +

Embeds, components and files to include with the message.

+
+ + + + + +
+ + + + + + + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + + +
See:
+
+ +
+ + + + + +

+ View Source + + structures/Channel.js, line 76 + +

+ +
+ + + + + + + + + + + + + + + + + + +
+
+
+ + + +
+ + +
+ + +Promise.<Message> + + +
+ +
+ + +
+
+ + + + +
+ +
+
+ diff --git a/structures_Channel.js.html b/structures_Channel.js.html index e017519a1..758eb1505 100644 --- a/structures_Channel.js.html +++ b/structures_Channel.js.html @@ -85,12 +85,17 @@

structures/Channel.js

-
/**
+            
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;
-
-
- - - - -
- - - -
-
-
-
- - - - - - -