discord-self-lite 0.1.14 → 0.1.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
package/src/classes/Channel.js
CHANGED
|
@@ -74,10 +74,12 @@ class Channel {
|
|
|
74
74
|
* @param {number} [options.limit] - Number of messages to fetch
|
|
75
75
|
* @param {string} [options.before] - Fetch messages before this message ID
|
|
76
76
|
* @param {string} [options.after] - Fetch messages after this message ID
|
|
77
|
-
* @returns {Promise<
|
|
77
|
+
* @returns {Promise<Message[]>} Array of message instances
|
|
78
78
|
*/
|
|
79
79
|
async fetchMessages(options = {}) {
|
|
80
|
-
|
|
80
|
+
const data = await this.rest.fetchMessages(this.id, options);
|
|
81
|
+
if (!Array.isArray(data)) return data;
|
|
82
|
+
return data.map((msg) => new Message(this.client, msg));
|
|
81
83
|
}
|
|
82
84
|
|
|
83
85
|
/**
|
package/src/classes/Client.js
CHANGED
|
@@ -248,10 +248,12 @@ class Client extends EventEmitter {
|
|
|
248
248
|
* @param {number} [options.limit] - Number of messages to fetch
|
|
249
249
|
* @param {string} [options.before] - Fetch messages before this message ID
|
|
250
250
|
* @param {string} [options.after] - Fetch messages after this message ID
|
|
251
|
-
* @returns {Promise<
|
|
251
|
+
* @returns {Promise<Message[]>} Array of message instances
|
|
252
252
|
*/
|
|
253
253
|
async fetchMessages(channelId, options = {}) {
|
|
254
|
-
|
|
254
|
+
const data = await this.rest.fetchMessages(channelId, options);
|
|
255
|
+
if (!Array.isArray(data)) return data;
|
|
256
|
+
return data.map((msg) => new Message(this, msg));
|
|
255
257
|
}
|
|
256
258
|
|
|
257
259
|
/**
|
|
@@ -3,12 +3,16 @@
|
|
|
3
3
|
* @param {RestManager} rest - The REST manager instance
|
|
4
4
|
* @param {string} channelId - The channel ID
|
|
5
5
|
* @param {string} messageId - The message ID
|
|
6
|
-
* @param {string} emoji - The emoji to react with (unicode or
|
|
6
|
+
* @param {string|object} emoji - The emoji to react with (unicode, custom emoji string, or emoji object)
|
|
7
7
|
* @returns {Promise<void>}
|
|
8
8
|
*/
|
|
9
9
|
async function react(rest, channelId, messageId, emoji) {
|
|
10
|
+
let emojiStr = emoji;
|
|
11
|
+
if (emoji && typeof emoji === "object") {
|
|
12
|
+
emojiStr = emoji.id ? `${emoji.name}:${emoji.id}` : emoji.name;
|
|
13
|
+
}
|
|
10
14
|
// Encode emoji for URL (e.g., 😀 -> %F0%9F%98%80, or custom:123 -> custom%3A123)
|
|
11
|
-
const encodedEmoji = encodeURIComponent(
|
|
15
|
+
const encodedEmoji = encodeURIComponent(emojiStr);
|
|
12
16
|
return await rest.request(
|
|
13
17
|
`/channels/${channelId}/messages/${messageId}/reactions/${encodedEmoji}/@me`,
|
|
14
18
|
{
|