@fluxerjs/core 1.0.7 → 1.0.9
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/dist/{Channel-OSOB6ELO.mjs → Channel-ICWNKXBR.mjs} +1 -1
- package/dist/{ClientUser-RNDKHQ3Z.mjs → ClientUser-WWXUMO5O.mjs} +1 -2
- package/dist/{Guild-GOQZ7XP4.mjs → Guild-TM6YGJWB.mjs} +3 -1
- package/dist/GuildBan-M4PA3HAA.mjs +7 -0
- package/dist/{GuildMember-BJJNCL6W.mjs → GuildMember-RZWZ3OCG.mjs} +1 -2
- package/dist/{Webhook-AG6QFM2I.mjs → Invite-UM5BU5A6.mjs} +3 -3
- package/dist/{Message-QXPHQOVC.mjs → Message-6IYEYSV6.mjs} +1 -2
- package/dist/MessageReaction-XRPYZDSC.mjs +7 -0
- package/dist/{Webhook-NUQCJAWZ.mjs → Role-SVLWIAMN.mjs} +3 -3
- package/dist/{Webhook-2RHBXH7R.mjs → Webhook-32VJD4AL.mjs} +1 -1
- package/dist/{chunk-T2NSVWBH.mjs → chunk-53Y37KRG.mjs} +35 -1
- package/dist/chunk-DSPSRPHF.mjs +200 -0
- package/dist/{chunk-WYSHH4LR.mjs → chunk-FJS5FBXO.mjs} +98 -6
- package/dist/{chunk-J3EIGOXQ.mjs → chunk-GCIJYVRC.mjs} +20 -6
- package/dist/{chunk-NISGA2YZ.mjs → chunk-GFUJVQ7L.mjs} +13 -4
- package/dist/chunk-HBF5QEDH.mjs +42 -0
- package/dist/chunk-QEXIYXXU.mjs +62 -0
- package/dist/chunk-RCP27MRC.mjs +33 -0
- package/dist/chunk-SQVCCSNN.mjs +41 -0
- package/dist/chunk-X77DFNE3.mjs +136 -0
- package/dist/index.d.mts +520 -55
- package/dist/index.d.ts +520 -55
- package/dist/index.js +1333 -404
- package/dist/index.mjs +616 -189
- package/package.json +27 -8
- package/dist/Channel-2WNJ445K.mjs +0 -17
- package/dist/Channel-BEZOW4VC.mjs +0 -17
- package/dist/Channel-DPLLHL7Y.mjs +0 -19
- package/dist/Channel-HM2UY4DN.mjs +0 -17
- package/dist/Channel-IKL3SJXN.mjs +0 -17
- package/dist/Channel-KILNV5V3.mjs +0 -17
- package/dist/Channel-KOTARBSF.mjs +0 -17
- package/dist/Channel-ON7O3D3M.mjs +0 -17
- package/dist/Channel-TOAQGSRX.mjs +0 -17
- package/dist/Channel-VENHOL7S.mjs +0 -17
- package/dist/Channel-YVGPVOVB.mjs +0 -17
- package/dist/ClientUser-6HBAPU6H.mjs +0 -8
- package/dist/ClientUser-ALGC4FNY.mjs +0 -8
- package/dist/ClientUser-J6HQVSDJ.mjs +0 -9
- package/dist/ClientUser-LLL6WX35.mjs +0 -8
- package/dist/ClientUser-N7ZXYAQ3.mjs +0 -8
- package/dist/Guild-36EGAAEW.mjs +0 -8
- package/dist/Guild-5UBZNIGD.mjs +0 -9
- package/dist/Guild-CA3W6DOD.mjs +0 -8
- package/dist/Guild-GIXJJBFM.mjs +0 -9
- package/dist/Guild-NHNQ5TIA.mjs +0 -8
- package/dist/Guild-S436SLOP.mjs +0 -9
- package/dist/Guild-WAFXK2EX.mjs +0 -9
- package/dist/Guild-XPOMHZZG.mjs +0 -9
- package/dist/Guild-ZOFF5LFR.mjs +0 -8
- package/dist/GuildMember-FX2JAWES.mjs +0 -8
- package/dist/GuildMember-K5FLBNHV.mjs +0 -8
- package/dist/GuildMember-RGVPVUAG.mjs +0 -9
- package/dist/GuildMember-UBNHZBCO.mjs +0 -8
- package/dist/GuildMember-UU26WJGN.mjs +0 -8
- package/dist/GuildMember-XF7K2R45.mjs +0 -9
- package/dist/Message-23Z3RPCZ.mjs +0 -9
- package/dist/Message-33APPS76.mjs +0 -9
- package/dist/Message-6RSAGIRP.mjs +0 -8
- package/dist/Message-OXTQHFCF.mjs +0 -8
- package/dist/Message-PZUU7ZFR.mjs +0 -9
- package/dist/Message-R7GZYIQQ.mjs +0 -8
- package/dist/Message-W624MHJF.mjs +0 -8
- package/dist/Message-XB5WNMHL.mjs +0 -9
- package/dist/Message-ZCS7IGJX.mjs +0 -8
- package/dist/Webhook-TGAZZRQQ.mjs +0 -7
- package/dist/chunk-2FIZRRSO.mjs +0 -88
- package/dist/chunk-3CNUPFDI.mjs +0 -59
- package/dist/chunk-4DBGMFOQ.mjs +0 -14
- package/dist/chunk-5HQRX3KJ.mjs +0 -70
- package/dist/chunk-62S4AB2S.mjs +0 -54
- package/dist/chunk-6CEMF2LO.mjs +0 -14
- package/dist/chunk-6EBNOON4.mjs +0 -86
- package/dist/chunk-72OY7B3D.mjs +0 -72
- package/dist/chunk-7FYM4D2E.mjs +0 -50
- package/dist/chunk-7GZN6JXT.mjs +0 -50
- package/dist/chunk-7H3TKJUT.mjs +0 -53
- package/dist/chunk-7SIS5CUA.mjs +0 -14
- package/dist/chunk-BGJSL6JI.mjs +0 -14
- package/dist/chunk-BUEXP5SZ.mjs +0 -70
- package/dist/chunk-BYTAODAO.mjs +0 -70
- package/dist/chunk-CQ5ZVTLX.mjs +0 -71
- package/dist/chunk-DJBCSVZX.mjs +0 -102
- package/dist/chunk-DLROMCIJ.mjs +0 -50
- package/dist/chunk-DPZHAYCK.mjs +0 -71
- package/dist/chunk-E75ZVY3I.mjs +0 -14
- package/dist/chunk-EF32ILJL.mjs +0 -102
- package/dist/chunk-F2EEQP5O.mjs +0 -86
- package/dist/chunk-FK5X6HFL.mjs +0 -111
- package/dist/chunk-FNFID6QB.mjs +0 -45
- package/dist/chunk-G4L7WAJS.mjs +0 -64
- package/dist/chunk-GUNWHOQO.mjs +0 -42
- package/dist/chunk-IPHFDI2L.mjs +0 -68
- package/dist/chunk-JJHZBWZM.mjs +0 -118
- package/dist/chunk-L25ON7WB.mjs +0 -52
- package/dist/chunk-LBBIQOSH.mjs +0 -53
- package/dist/chunk-LVMFPATK.mjs +0 -54
- package/dist/chunk-NOLYW3V4.mjs +0 -140
- package/dist/chunk-OHIHIQAS.mjs +0 -102
- package/dist/chunk-P4IRDGB4.mjs +0 -43
- package/dist/chunk-PO5JZQVN.mjs +0 -111
- package/dist/chunk-PYYXC7US.mjs +0 -76
- package/dist/chunk-QDCFQF6J.mjs +0 -36
- package/dist/chunk-QDNFJVVE.mjs +0 -70
- package/dist/chunk-QXJNV5EJ.mjs +0 -110
- package/dist/chunk-RXHJYGSJ.mjs +0 -53
- package/dist/chunk-SW6KNICI.mjs +0 -52
- package/dist/chunk-TE5IC7IP.mjs +0 -36
- package/dist/chunk-TMDZALIN.mjs +0 -110
- package/dist/chunk-WFONGZGK.mjs +0 -42
- package/dist/chunk-WZVY7DA6.mjs +0 -44
- package/dist/chunk-XTDZQD4A.mjs +0 -110
- package/dist/chunk-XXCBJJZE.mjs +0 -88
- package/dist/chunk-YKP7JHV2.mjs +0 -102
- package/dist/chunk-YSKZR66G.mjs +0 -102
- package/dist/chunk-ZHRQQZ4X.mjs +0 -102
- package/dist/chunk-ZMIMAMO2.mjs +0 -14
package/dist/index.js
CHANGED
|
@@ -20,6 +20,28 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
20
20
|
};
|
|
21
21
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
22
22
|
|
|
23
|
+
// src/client/MessageManager.ts
|
|
24
|
+
var MessageManager;
|
|
25
|
+
var init_MessageManager = __esm({
|
|
26
|
+
"src/client/MessageManager.ts"() {
|
|
27
|
+
"use strict";
|
|
28
|
+
MessageManager = class {
|
|
29
|
+
constructor(client, channelId) {
|
|
30
|
+
this.client = client;
|
|
31
|
+
this.channelId = channelId;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Fetch a message by ID from this channel.
|
|
35
|
+
* @param messageId - Snowflake of the message
|
|
36
|
+
* @returns The message, or null if not found
|
|
37
|
+
*/
|
|
38
|
+
async fetch(messageId) {
|
|
39
|
+
return this.client.channels.fetchMessage(this.channelId, messageId);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
|
|
23
45
|
// src/structures/Base.ts
|
|
24
46
|
var Base;
|
|
25
47
|
var init_Base = __esm({
|
|
@@ -30,15 +52,6 @@ var init_Base = __esm({
|
|
|
30
52
|
}
|
|
31
53
|
});
|
|
32
54
|
|
|
33
|
-
// src/util/Constants.ts
|
|
34
|
-
var CDN_URL;
|
|
35
|
-
var init_Constants = __esm({
|
|
36
|
-
"src/util/Constants.ts"() {
|
|
37
|
-
"use strict";
|
|
38
|
-
CDN_URL = "https://fluxerusercontent.com";
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
|
|
42
55
|
// src/structures/Webhook.ts
|
|
43
56
|
var Webhook_exports = {};
|
|
44
57
|
__export(Webhook_exports, {
|
|
@@ -74,13 +87,47 @@ var init_Webhook = __esm({
|
|
|
74
87
|
async delete() {
|
|
75
88
|
await this.client.rest.delete(import_types.Routes.webhook(this.id), { auth: true });
|
|
76
89
|
}
|
|
90
|
+
/**
|
|
91
|
+
* Edit this webhook. With token: name and avatar only. Without token (bot auth): name, avatar, and channel_id.
|
|
92
|
+
* @param options - Fields to update (name, avatar, channel_id when using bot auth)
|
|
93
|
+
* @returns This webhook instance with updated fields
|
|
94
|
+
*/
|
|
95
|
+
async edit(options) {
|
|
96
|
+
const body = {};
|
|
97
|
+
if (options.name !== void 0) body.name = options.name;
|
|
98
|
+
if (options.avatar !== void 0) body.avatar = options.avatar;
|
|
99
|
+
if ("channel_id" in options && options.channel_id !== void 0 && !this.token) {
|
|
100
|
+
body.channel_id = options.channel_id;
|
|
101
|
+
}
|
|
102
|
+
if (this.token) {
|
|
103
|
+
const data2 = await this.client.rest.patch(
|
|
104
|
+
import_types.Routes.webhookExecute(this.id, this.token),
|
|
105
|
+
{ body, auth: false }
|
|
106
|
+
);
|
|
107
|
+
const w2 = data2;
|
|
108
|
+
this.name = w2.name ?? this.name;
|
|
109
|
+
this.avatar = w2.avatar ?? null;
|
|
110
|
+
return this;
|
|
111
|
+
}
|
|
112
|
+
const data = await this.client.rest.patch(import_types.Routes.webhook(this.id), {
|
|
113
|
+
body,
|
|
114
|
+
auth: true
|
|
115
|
+
});
|
|
116
|
+
const w = data;
|
|
117
|
+
this.name = w.name ?? this.name;
|
|
118
|
+
this.avatar = w.avatar ?? null;
|
|
119
|
+
this.channelId = w.channel_id ?? this.channelId;
|
|
120
|
+
return this;
|
|
121
|
+
}
|
|
77
122
|
/**
|
|
78
123
|
* Send a message via this webhook. Requires the webhook token (only present when created, not when fetched).
|
|
79
124
|
* @throws Error if token is not available
|
|
80
125
|
*/
|
|
81
126
|
async send(options) {
|
|
82
127
|
if (!this.token) {
|
|
83
|
-
throw new Error(
|
|
128
|
+
throw new Error(
|
|
129
|
+
"Webhook token is required to send. The token is only returned when creating a webhook; fetched webhooks cannot send."
|
|
130
|
+
);
|
|
84
131
|
}
|
|
85
132
|
const body = typeof options === "string" ? { content: options } : options;
|
|
86
133
|
await this.client.rest.post(import_types.Routes.webhookExecute(this.id, this.token), {
|
|
@@ -120,6 +167,210 @@ var init_Webhook = __esm({
|
|
|
120
167
|
}
|
|
121
168
|
});
|
|
122
169
|
|
|
170
|
+
// src/structures/Message.ts
|
|
171
|
+
var Message_exports = {};
|
|
172
|
+
__export(Message_exports, {
|
|
173
|
+
Message: () => Message
|
|
174
|
+
});
|
|
175
|
+
var import_collection, import_types2, import_builders, Message;
|
|
176
|
+
var init_Message = __esm({
|
|
177
|
+
"src/structures/Message.ts"() {
|
|
178
|
+
"use strict";
|
|
179
|
+
init_Base();
|
|
180
|
+
import_collection = require("@fluxerjs/collection");
|
|
181
|
+
import_types2 = require("@fluxerjs/types");
|
|
182
|
+
import_builders = require("@fluxerjs/builders");
|
|
183
|
+
Message = class _Message extends Base {
|
|
184
|
+
client;
|
|
185
|
+
id;
|
|
186
|
+
channelId;
|
|
187
|
+
guildId;
|
|
188
|
+
author;
|
|
189
|
+
content;
|
|
190
|
+
createdAt;
|
|
191
|
+
editedAt;
|
|
192
|
+
pinned;
|
|
193
|
+
attachments;
|
|
194
|
+
type;
|
|
195
|
+
flags;
|
|
196
|
+
mentionEveryone;
|
|
197
|
+
tts;
|
|
198
|
+
embeds;
|
|
199
|
+
stickers;
|
|
200
|
+
reactions;
|
|
201
|
+
messageReference;
|
|
202
|
+
messageSnapshots;
|
|
203
|
+
call;
|
|
204
|
+
referencedMessage;
|
|
205
|
+
/** Channel where this message was sent. Resolved from cache; null if not cached (e.g. DM channel not in cache). */
|
|
206
|
+
get channel() {
|
|
207
|
+
return this.client.channels.get(this.channelId) ?? null;
|
|
208
|
+
}
|
|
209
|
+
/** Guild where this message was sent. Resolved from cache; null for DMs or if not cached. */
|
|
210
|
+
get guild() {
|
|
211
|
+
return this.guildId ? this.client.guilds.get(this.guildId) ?? null : null;
|
|
212
|
+
}
|
|
213
|
+
/** @param data - API message from POST/PATCH /channels/{id}/messages or gateway MESSAGE_CREATE */
|
|
214
|
+
constructor(client, data) {
|
|
215
|
+
super();
|
|
216
|
+
this.client = client;
|
|
217
|
+
this.id = data.id;
|
|
218
|
+
this.channelId = data.channel_id;
|
|
219
|
+
this.guildId = data.guild_id ?? null;
|
|
220
|
+
this.author = client.getOrCreateUser(data.author);
|
|
221
|
+
this.content = data.content;
|
|
222
|
+
this.createdAt = new Date(data.timestamp);
|
|
223
|
+
this.editedAt = data.edited_timestamp ? new Date(data.edited_timestamp) : null;
|
|
224
|
+
this.pinned = data.pinned;
|
|
225
|
+
this.attachments = new import_collection.Collection();
|
|
226
|
+
for (const a of data.attachments ?? []) this.attachments.set(a.id, a);
|
|
227
|
+
this.type = data.type ?? import_types2.MessageType.Default;
|
|
228
|
+
this.flags = data.flags ?? 0;
|
|
229
|
+
this.mentionEveryone = data.mention_everyone ?? false;
|
|
230
|
+
this.tts = data.tts ?? false;
|
|
231
|
+
this.embeds = data.embeds ?? [];
|
|
232
|
+
this.stickers = data.stickers ?? [];
|
|
233
|
+
this.reactions = data.reactions ?? [];
|
|
234
|
+
this.messageReference = data.message_reference ?? null;
|
|
235
|
+
this.messageSnapshots = data.message_snapshots ?? [];
|
|
236
|
+
this.call = data.call ?? null;
|
|
237
|
+
this.referencedMessage = data.referenced_message ? new _Message(client, data.referenced_message) : null;
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Send a message to this channel without replying. Use when you want a standalone message.
|
|
241
|
+
* @param options - Text content or object with content and/or embeds
|
|
242
|
+
* @example
|
|
243
|
+
* await message.send('Pong!');
|
|
244
|
+
* await message.send({ embeds: [embed.toJSON()] });
|
|
245
|
+
*/
|
|
246
|
+
async send(options) {
|
|
247
|
+
const body = typeof options === "string" ? { content: options } : options;
|
|
248
|
+
const data = await this.client.rest.post(import_types2.Routes.channelMessages(this.channelId), { body });
|
|
249
|
+
return new _Message(this.client, data);
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* Send a message to a specific channel. Use for logging, forwarding, or sending to another channel in the guild.
|
|
253
|
+
* @param channelId - Snowflake of the target channel (e.g. log channel ID)
|
|
254
|
+
* @param options - Text content or object with content and/or embeds
|
|
255
|
+
* @example
|
|
256
|
+
* await message.sendTo(logChannelId, 'User ' + message.author.username + ' said: ' + message.content);
|
|
257
|
+
* await message.sendTo(announceChannelId, { embeds: [embed.toJSON()] });
|
|
258
|
+
*/
|
|
259
|
+
async sendTo(channelId, options) {
|
|
260
|
+
return this.client.channels.send(channelId, options);
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* Reply to this message.
|
|
264
|
+
* @param options - Text content or object with content and/or embeds
|
|
265
|
+
*/
|
|
266
|
+
async reply(options) {
|
|
267
|
+
const body = typeof options === "string" ? {
|
|
268
|
+
content: options,
|
|
269
|
+
message_reference: {
|
|
270
|
+
channel_id: this.channelId,
|
|
271
|
+
message_id: this.id,
|
|
272
|
+
guild_id: this.guildId ?? void 0
|
|
273
|
+
}
|
|
274
|
+
} : {
|
|
275
|
+
...options,
|
|
276
|
+
message_reference: {
|
|
277
|
+
channel_id: this.channelId,
|
|
278
|
+
message_id: this.id,
|
|
279
|
+
guild_id: this.guildId ?? void 0
|
|
280
|
+
}
|
|
281
|
+
};
|
|
282
|
+
const data = await this.client.rest.post(import_types2.Routes.channelMessages(this.channelId), { body });
|
|
283
|
+
return new _Message(this.client, data);
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* Edit this message. Only the author (or admins) can edit.
|
|
287
|
+
* @param options - New content and/or embeds
|
|
288
|
+
*/
|
|
289
|
+
async edit(options) {
|
|
290
|
+
const body = {};
|
|
291
|
+
if (options.content !== void 0) body.content = options.content;
|
|
292
|
+
if (options.embeds?.length) {
|
|
293
|
+
body.embeds = options.embeds.map((e) => e instanceof import_builders.EmbedBuilder ? e.toJSON() : e);
|
|
294
|
+
}
|
|
295
|
+
const data = await this.client.rest.patch(import_types2.Routes.channelMessage(this.channelId, this.id), {
|
|
296
|
+
body
|
|
297
|
+
});
|
|
298
|
+
return new _Message(this.client, data);
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* Re-fetch this message from the API to get the latest content, embeds, reactions, etc.
|
|
302
|
+
* Use when you have a stale Message (e.g. from an old event or cache) and need fresh data.
|
|
303
|
+
* @returns The updated message, or null if deleted or not found
|
|
304
|
+
* @example
|
|
305
|
+
* const updated = await message.fetch();
|
|
306
|
+
* if (updated) console.log('Latest content:', updated.content);
|
|
307
|
+
*/
|
|
308
|
+
async fetch() {
|
|
309
|
+
return this.client.channels.fetchMessage(this.channelId, this.id);
|
|
310
|
+
}
|
|
311
|
+
/** Delete this message. */
|
|
312
|
+
async delete() {
|
|
313
|
+
await this.client.rest.delete(import_types2.Routes.channelMessage(this.channelId, this.id));
|
|
314
|
+
}
|
|
315
|
+
/** Pin this message to the channel. Requires Manage Messages permission. */
|
|
316
|
+
async pin() {
|
|
317
|
+
await this.client.rest.put(import_types2.Routes.channelPinMessage(this.channelId, this.id));
|
|
318
|
+
this.pinned = true;
|
|
319
|
+
}
|
|
320
|
+
/** Unpin this message from the channel. Requires Manage Messages permission. */
|
|
321
|
+
async unpin() {
|
|
322
|
+
await this.client.rest.delete(import_types2.Routes.channelPinMessage(this.channelId, this.id));
|
|
323
|
+
this.pinned = false;
|
|
324
|
+
}
|
|
325
|
+
/**
|
|
326
|
+
* Format emoji for reaction API: unicode string or "name:id" for custom.
|
|
327
|
+
* For string resolution (e.g. :name:), use client.resolveEmoji; Message methods resolve automatically when guildId is available.
|
|
328
|
+
*/
|
|
329
|
+
static formatEmoji(emoji) {
|
|
330
|
+
if (typeof emoji === "string") return emoji;
|
|
331
|
+
return `${emoji.name}:${emoji.id}`;
|
|
332
|
+
}
|
|
333
|
+
resolveEmojiForReaction(emoji) {
|
|
334
|
+
return this.client.resolveEmoji(emoji, this.guildId);
|
|
335
|
+
}
|
|
336
|
+
/**
|
|
337
|
+
* Add a reaction to this message (as the bot).
|
|
338
|
+
* @param emoji - Unicode emoji, custom `{ name, id }`, `:name:`, `name:id`, or `<:name:id>`
|
|
339
|
+
*/
|
|
340
|
+
async react(emoji) {
|
|
341
|
+
const emojiStr = await this.resolveEmojiForReaction(emoji);
|
|
342
|
+
const route = `${import_types2.Routes.channelMessageReaction(this.channelId, this.id, emojiStr)}/@me`;
|
|
343
|
+
await this.client.rest.put(route);
|
|
344
|
+
}
|
|
345
|
+
/**
|
|
346
|
+
* Remove the bot's reaction, or a specific user's reaction if userId is provided.
|
|
347
|
+
* @param emoji - Unicode emoji, custom `{ name, id }`, `:name:`, `name:id`, or `<:name:id>`
|
|
348
|
+
* @param userId - If provided, removes that user's reaction (requires moderator permissions)
|
|
349
|
+
*/
|
|
350
|
+
async removeReaction(emoji, userId) {
|
|
351
|
+
const emojiStr = await this.resolveEmojiForReaction(emoji);
|
|
352
|
+
const route = `${import_types2.Routes.channelMessageReaction(this.channelId, this.id, emojiStr)}/${userId ?? "@me"}`;
|
|
353
|
+
await this.client.rest.delete(route);
|
|
354
|
+
}
|
|
355
|
+
/**
|
|
356
|
+
* Remove all reactions from this message.
|
|
357
|
+
* Requires moderator permissions.
|
|
358
|
+
*/
|
|
359
|
+
async removeAllReactions() {
|
|
360
|
+
await this.client.rest.delete(import_types2.Routes.channelMessageReactions(this.channelId, this.id));
|
|
361
|
+
}
|
|
362
|
+
/**
|
|
363
|
+
* Remove all reactions of a specific emoji from this message.
|
|
364
|
+
* @param emoji - Unicode emoji, custom `{ name, id }`, `:name:`, `name:id`, or `<:name:id>`. Requires moderator permissions.
|
|
365
|
+
*/
|
|
366
|
+
async removeReactionEmoji(emoji) {
|
|
367
|
+
const emojiStr = await this.resolveEmojiForReaction(emoji);
|
|
368
|
+
await this.client.rest.delete(import_types2.Routes.channelMessageReaction(this.channelId, this.id, emojiStr));
|
|
369
|
+
}
|
|
370
|
+
};
|
|
371
|
+
}
|
|
372
|
+
});
|
|
373
|
+
|
|
123
374
|
// src/structures/Channel.ts
|
|
124
375
|
var Channel_exports = {};
|
|
125
376
|
__export(Channel_exports, {
|
|
@@ -131,13 +382,26 @@ __export(Channel_exports, {
|
|
|
131
382
|
TextChannel: () => TextChannel,
|
|
132
383
|
VoiceChannel: () => VoiceChannel
|
|
133
384
|
});
|
|
134
|
-
var
|
|
385
|
+
var import_types3, Channel, GuildChannel, TextChannel, CategoryChannel, VoiceChannel, LinkChannel, DMChannel;
|
|
135
386
|
var init_Channel = __esm({
|
|
136
387
|
"src/structures/Channel.ts"() {
|
|
137
388
|
"use strict";
|
|
389
|
+
init_MessageManager();
|
|
138
390
|
init_Base();
|
|
139
|
-
|
|
140
|
-
Channel = class extends Base {
|
|
391
|
+
import_types3 = require("@fluxerjs/types");
|
|
392
|
+
Channel = class _Channel extends Base {
|
|
393
|
+
/** Whether this channel has a send method (TextChannel, DMChannel). */
|
|
394
|
+
isSendable() {
|
|
395
|
+
return "send" in this;
|
|
396
|
+
}
|
|
397
|
+
/** Whether this channel is a DM or Group DM. */
|
|
398
|
+
isDM() {
|
|
399
|
+
return this.type === import_types3.ChannelType.DM || this.type === import_types3.ChannelType.GroupDM;
|
|
400
|
+
}
|
|
401
|
+
/** Whether this channel is voice-based (VoiceChannel). */
|
|
402
|
+
isVoice() {
|
|
403
|
+
return "bitrate" in this;
|
|
404
|
+
}
|
|
141
405
|
/** Create a DM channel from API data (type DM or GroupDM). */
|
|
142
406
|
static createDM(client, data) {
|
|
143
407
|
return new DMChannel(client, data);
|
|
@@ -159,12 +423,23 @@ var init_Channel = __esm({
|
|
|
159
423
|
*/
|
|
160
424
|
static from(client, data) {
|
|
161
425
|
const type = data.type ?? 0;
|
|
162
|
-
if (type ===
|
|
163
|
-
if (type ===
|
|
164
|
-
if (type ===
|
|
165
|
-
if (type ===
|
|
426
|
+
if (type === import_types3.ChannelType.GuildText) return new TextChannel(client, data);
|
|
427
|
+
if (type === import_types3.ChannelType.GuildCategory) return new CategoryChannel(client, data);
|
|
428
|
+
if (type === import_types3.ChannelType.GuildVoice) return new VoiceChannel(client, data);
|
|
429
|
+
if (type === import_types3.ChannelType.GuildLink || type === import_types3.ChannelType.GuildLinkExtended)
|
|
430
|
+
return new LinkChannel(client, data);
|
|
166
431
|
return new GuildChannel(client, data);
|
|
167
432
|
}
|
|
433
|
+
/**
|
|
434
|
+
* Create a channel from API data, including DM and GroupDM.
|
|
435
|
+
* Used by ChannelManager.fetch() for GET /channels/{id}.
|
|
436
|
+
*/
|
|
437
|
+
static fromOrCreate(client, data) {
|
|
438
|
+
const type = data.type ?? 0;
|
|
439
|
+
if (type === import_types3.ChannelType.DM || type === import_types3.ChannelType.GroupDM)
|
|
440
|
+
return _Channel.createDM(client, data);
|
|
441
|
+
return _Channel.from(client, data);
|
|
442
|
+
}
|
|
168
443
|
};
|
|
169
444
|
GuildChannel = class extends Channel {
|
|
170
445
|
guildId;
|
|
@@ -185,7 +460,7 @@ var init_Channel = __esm({
|
|
|
185
460
|
*/
|
|
186
461
|
async createWebhook(options) {
|
|
187
462
|
const { Webhook: Webhook2 } = await Promise.resolve().then(() => (init_Webhook(), Webhook_exports));
|
|
188
|
-
const data = await this.client.rest.post(
|
|
463
|
+
const data = await this.client.rest.post(import_types3.Routes.channelWebhooks(this.id), {
|
|
189
464
|
body: options,
|
|
190
465
|
auth: true
|
|
191
466
|
});
|
|
@@ -197,7 +472,7 @@ var init_Channel = __esm({
|
|
|
197
472
|
*/
|
|
198
473
|
async fetchWebhooks() {
|
|
199
474
|
const { Webhook: Webhook2 } = await Promise.resolve().then(() => (init_Webhook(), Webhook_exports));
|
|
200
|
-
const data = await this.client.rest.get(
|
|
475
|
+
const data = await this.client.rest.get(import_types3.Routes.channelWebhooks(this.id));
|
|
201
476
|
const list = Array.isArray(data) ? data : Object.values(data ?? {});
|
|
202
477
|
return list.map((w) => new Webhook2(this.client, w));
|
|
203
478
|
}
|
|
@@ -221,9 +496,35 @@ var init_Channel = __esm({
|
|
|
221
496
|
async send(options) {
|
|
222
497
|
const body = typeof options === "string" ? { content: options } : options;
|
|
223
498
|
const { Message: Message2 } = await Promise.resolve().then(() => (init_Message(), Message_exports));
|
|
224
|
-
const data = await this.client.rest.post(
|
|
499
|
+
const data = await this.client.rest.post(import_types3.Routes.channelMessages(this.id), { body });
|
|
225
500
|
return new Message2(this.client, data);
|
|
226
501
|
}
|
|
502
|
+
/** Message manager for this channel. Use channel.messages.fetch(messageId). */
|
|
503
|
+
get messages() {
|
|
504
|
+
return new MessageManager(this.client, this.id);
|
|
505
|
+
}
|
|
506
|
+
/**
|
|
507
|
+
* Fetch pinned messages in this channel.
|
|
508
|
+
* @returns Pinned messages
|
|
509
|
+
*/
|
|
510
|
+
async fetchPinnedMessages() {
|
|
511
|
+
const { Message: Message2 } = await Promise.resolve().then(() => (init_Message(), Message_exports));
|
|
512
|
+
const data = await this.client.rest.get(import_types3.Routes.channelPins(this.id));
|
|
513
|
+
const list = Array.isArray(data) ? data : data?.items ?? [];
|
|
514
|
+
return list.map((item) => {
|
|
515
|
+
const msg = typeof item === "object" && item && "message" in item ? item.message : item;
|
|
516
|
+
return new Message2(this.client, msg);
|
|
517
|
+
});
|
|
518
|
+
}
|
|
519
|
+
/**
|
|
520
|
+
* Fetch a message by ID from this channel.
|
|
521
|
+
* @param messageId - Snowflake of the message
|
|
522
|
+
* @returns The message, or null if not found
|
|
523
|
+
* @deprecated Use channel.messages.fetch(messageId) instead.
|
|
524
|
+
*/
|
|
525
|
+
async fetchMessage(messageId) {
|
|
526
|
+
return this.client.channels.fetchMessage(this.id, messageId);
|
|
527
|
+
}
|
|
227
528
|
};
|
|
228
529
|
CategoryChannel = class extends GuildChannel {
|
|
229
530
|
};
|
|
@@ -258,249 +559,158 @@ var init_Channel = __esm({
|
|
|
258
559
|
async send(options) {
|
|
259
560
|
const body = typeof options === "string" ? { content: options } : options;
|
|
260
561
|
const { Message: Message2 } = await Promise.resolve().then(() => (init_Message(), Message_exports));
|
|
261
|
-
const data = await this.client.rest.post(
|
|
562
|
+
const data = await this.client.rest.post(import_types3.Routes.channelMessages(this.id), { body });
|
|
262
563
|
return new Message2(this.client, data);
|
|
263
564
|
}
|
|
565
|
+
/** Message manager for this channel. Use channel.messages.fetch(messageId). */
|
|
566
|
+
get messages() {
|
|
567
|
+
return new MessageManager(this.client, this.id);
|
|
568
|
+
}
|
|
569
|
+
/**
|
|
570
|
+
* Fetch pinned messages in this DM channel.
|
|
571
|
+
* @returns Pinned messages
|
|
572
|
+
*/
|
|
573
|
+
async fetchPinnedMessages() {
|
|
574
|
+
const { Message: Message2 } = await Promise.resolve().then(() => (init_Message(), Message_exports));
|
|
575
|
+
const data = await this.client.rest.get(import_types3.Routes.channelPins(this.id));
|
|
576
|
+
const list = Array.isArray(data) ? data : data?.items ?? [];
|
|
577
|
+
return list.map((item) => {
|
|
578
|
+
const msg = typeof item === "object" && item && "message" in item ? item.message : item;
|
|
579
|
+
return new Message2(this.client, msg);
|
|
580
|
+
});
|
|
581
|
+
}
|
|
582
|
+
/**
|
|
583
|
+
* Fetch a message by ID from this DM channel.
|
|
584
|
+
* @param messageId - Snowflake of the message
|
|
585
|
+
* @returns The message, or null if not found
|
|
586
|
+
* @deprecated Use channel.messages.fetch(messageId) instead.
|
|
587
|
+
*/
|
|
588
|
+
async fetchMessage(messageId) {
|
|
589
|
+
return this.client.channels.fetchMessage(this.id, messageId);
|
|
590
|
+
}
|
|
264
591
|
};
|
|
265
592
|
}
|
|
266
593
|
});
|
|
267
594
|
|
|
268
|
-
// src/structures/
|
|
269
|
-
var
|
|
270
|
-
|
|
271
|
-
|
|
595
|
+
// src/structures/GuildMember.ts
|
|
596
|
+
var GuildMember_exports = {};
|
|
597
|
+
__export(GuildMember_exports, {
|
|
598
|
+
GuildMember: () => GuildMember
|
|
599
|
+
});
|
|
600
|
+
var import_types5, GuildMember;
|
|
601
|
+
var init_GuildMember = __esm({
|
|
602
|
+
"src/structures/GuildMember.ts"() {
|
|
272
603
|
"use strict";
|
|
273
604
|
init_Base();
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
User = class extends Base {
|
|
605
|
+
import_types5 = require("@fluxerjs/types");
|
|
606
|
+
GuildMember = class extends Base {
|
|
277
607
|
client;
|
|
278
608
|
id;
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
609
|
+
user;
|
|
610
|
+
guild;
|
|
611
|
+
nick;
|
|
612
|
+
roles;
|
|
613
|
+
joinedAt;
|
|
614
|
+
communicationDisabledUntil;
|
|
615
|
+
mute;
|
|
616
|
+
deaf;
|
|
282
617
|
avatar;
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
618
|
+
banner;
|
|
619
|
+
accentColor;
|
|
620
|
+
profileFlags;
|
|
621
|
+
/** @param data - API guild member from GET /guilds/{id}/members or GET /guilds/{id}/members/{user_id} */
|
|
622
|
+
constructor(client, data, guild) {
|
|
286
623
|
super();
|
|
287
624
|
this.client = client;
|
|
288
|
-
this.
|
|
289
|
-
this.
|
|
290
|
-
this.
|
|
291
|
-
this.
|
|
625
|
+
this.user = client.getOrCreateUser(data.user);
|
|
626
|
+
this.id = data.user.id;
|
|
627
|
+
this.guild = guild;
|
|
628
|
+
this.nick = data.nick ?? null;
|
|
629
|
+
this.roles = data.roles ?? [];
|
|
630
|
+
this.joinedAt = new Date(data.joined_at);
|
|
631
|
+
this.communicationDisabledUntil = data.communication_disabled_until ? new Date(data.communication_disabled_until) : null;
|
|
632
|
+
this.mute = data.mute ?? false;
|
|
633
|
+
this.deaf = data.deaf ?? false;
|
|
292
634
|
this.avatar = data.avatar ?? null;
|
|
293
|
-
this.
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
* Get the URL for this user's avatar.
|
|
297
|
-
* @param options - Optional `size` and `extension` (default: `png`)
|
|
298
|
-
*/
|
|
299
|
-
avatarURL(options) {
|
|
300
|
-
if (!this.avatar) return null;
|
|
301
|
-
const ext = options?.extension ?? "png";
|
|
302
|
-
const size = options?.size ? `?size=${options.size}` : "";
|
|
303
|
-
return `${CDN_URL}/avatars/${this.id}/${this.avatar}.${ext}${size}`;
|
|
304
|
-
}
|
|
305
|
-
/** Get the avatar URL, or the default avatar if none set. */
|
|
306
|
-
displayAvatarURL(options) {
|
|
307
|
-
return this.avatarURL(options) ?? `${CDN_URL}/avatars/0/0.png`;
|
|
635
|
+
this.banner = data.banner ?? null;
|
|
636
|
+
this.accentColor = data.accent_color ?? null;
|
|
637
|
+
this.profileFlags = data.profile_flags ?? null;
|
|
308
638
|
}
|
|
309
|
-
/**
|
|
310
|
-
|
|
311
|
-
return
|
|
639
|
+
/** Nickname, or global name, or username. */
|
|
640
|
+
get displayName() {
|
|
641
|
+
return this.nick ?? this.user.globalName ?? this.user.username;
|
|
312
642
|
}
|
|
313
643
|
/**
|
|
314
|
-
*
|
|
315
|
-
*
|
|
644
|
+
* Add a role to this member.
|
|
645
|
+
* @param roleId - The role ID to add
|
|
646
|
+
* Requires Manage Roles permission.
|
|
316
647
|
*/
|
|
317
|
-
async
|
|
318
|
-
|
|
319
|
-
const data = await this.client.rest.post(import_types3.Routes.userMeChannels(), {
|
|
320
|
-
body: { recipient_id: this.id },
|
|
321
|
-
auth: true
|
|
322
|
-
});
|
|
323
|
-
return new DMChannelClass(this.client, data);
|
|
648
|
+
async addRole(roleId) {
|
|
649
|
+
await this.client.rest.put(import_types5.Routes.guildMemberRole(this.guild.id, this.id, roleId));
|
|
324
650
|
}
|
|
325
651
|
/**
|
|
326
|
-
*
|
|
327
|
-
*
|
|
652
|
+
* Remove a role from this member.
|
|
653
|
+
* @param roleId - The role ID to remove
|
|
654
|
+
* Requires Manage Roles permission.
|
|
328
655
|
*/
|
|
329
|
-
async
|
|
330
|
-
|
|
331
|
-
return dm.send(options);
|
|
656
|
+
async removeRole(roleId) {
|
|
657
|
+
await this.client.rest.delete(import_types5.Routes.guildMemberRole(this.guild.id, this.id, roleId));
|
|
332
658
|
}
|
|
333
659
|
};
|
|
334
660
|
}
|
|
335
661
|
});
|
|
336
662
|
|
|
337
|
-
// src/structures/
|
|
338
|
-
var
|
|
339
|
-
__export(
|
|
340
|
-
|
|
663
|
+
// src/structures/Role.ts
|
|
664
|
+
var Role_exports = {};
|
|
665
|
+
__export(Role_exports, {
|
|
666
|
+
Role: () => Role
|
|
341
667
|
});
|
|
342
|
-
var
|
|
343
|
-
var
|
|
344
|
-
"src/structures/
|
|
668
|
+
var Role;
|
|
669
|
+
var init_Role = __esm({
|
|
670
|
+
"src/structures/Role.ts"() {
|
|
345
671
|
"use strict";
|
|
346
672
|
init_Base();
|
|
347
|
-
|
|
348
|
-
import_types4 = require("@fluxerjs/types");
|
|
349
|
-
import_builders = require("@fluxerjs/builders");
|
|
350
|
-
init_User();
|
|
351
|
-
Message = class _Message extends Base {
|
|
673
|
+
Role = class extends Base {
|
|
352
674
|
client;
|
|
353
675
|
id;
|
|
354
|
-
channelId;
|
|
355
676
|
guildId;
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
/** @param
|
|
364
|
-
|
|
677
|
+
name;
|
|
678
|
+
color;
|
|
679
|
+
position;
|
|
680
|
+
permissions;
|
|
681
|
+
hoist;
|
|
682
|
+
mentionable;
|
|
683
|
+
unicodeEmoji;
|
|
684
|
+
/** @param client - The client instance */
|
|
685
|
+
/** @param data - API role from GET /guilds/{id}/roles or gateway role events */
|
|
686
|
+
/** @param guildId - The guild this role belongs to */
|
|
687
|
+
constructor(client, data, guildId) {
|
|
365
688
|
super();
|
|
366
689
|
this.client = client;
|
|
367
690
|
this.id = data.id;
|
|
368
|
-
this.
|
|
369
|
-
this.
|
|
370
|
-
this.
|
|
371
|
-
this.
|
|
372
|
-
this.
|
|
373
|
-
this.
|
|
374
|
-
this.
|
|
375
|
-
this.
|
|
376
|
-
for (const a of data.attachments ?? []) this.attachments.set(a.id, a);
|
|
377
|
-
}
|
|
378
|
-
/**
|
|
379
|
-
* Reply to this message.
|
|
380
|
-
* @param options - Text content or object with content and/or embeds
|
|
381
|
-
*/
|
|
382
|
-
async reply(options) {
|
|
383
|
-
const body = typeof options === "string" ? { content: options, message_reference: { channel_id: this.channelId, message_id: this.id, guild_id: this.guildId ?? void 0 } } : { ...options, message_reference: { channel_id: this.channelId, message_id: this.id, guild_id: this.guildId ?? void 0 } };
|
|
384
|
-
const data = await this.client.rest.post(import_types4.Routes.channelMessages(this.channelId), { body });
|
|
385
|
-
return new _Message(this.client, data);
|
|
386
|
-
}
|
|
387
|
-
/**
|
|
388
|
-
* Edit this message. Only the author (or admins) can edit.
|
|
389
|
-
* @param options - New content and/or embeds
|
|
390
|
-
*/
|
|
391
|
-
async edit(options) {
|
|
392
|
-
const body = {};
|
|
393
|
-
if (options.content !== void 0) body.content = options.content;
|
|
394
|
-
if (options.embeds?.length) {
|
|
395
|
-
body.embeds = options.embeds.map((e) => e instanceof import_builders.EmbedBuilder ? e.toJSON() : e);
|
|
396
|
-
}
|
|
397
|
-
const data = await this.client.rest.patch(import_types4.Routes.channelMessage(this.channelId, this.id), { body });
|
|
398
|
-
return new _Message(this.client, data);
|
|
399
|
-
}
|
|
400
|
-
/** Delete this message. */
|
|
401
|
-
async delete() {
|
|
402
|
-
await this.client.rest.delete(import_types4.Routes.channelMessage(this.channelId, this.id));
|
|
403
|
-
}
|
|
404
|
-
/**
|
|
405
|
-
* Format emoji for reaction API: unicode string or "name:id" for custom.
|
|
406
|
-
* @param emoji - Unicode emoji (e.g. "👍") or custom { name, id } or "name:id" string
|
|
407
|
-
*/
|
|
408
|
-
static formatEmoji(emoji) {
|
|
409
|
-
if (typeof emoji === "string") return emoji;
|
|
410
|
-
return `${emoji.name}:${emoji.id}`;
|
|
411
|
-
}
|
|
412
|
-
/**
|
|
413
|
-
* Add a reaction to this message (as the bot).
|
|
414
|
-
* @param emoji - Unicode emoji (e.g. `👍`) or custom emoji `{ name, id }`
|
|
415
|
-
*/
|
|
416
|
-
async react(emoji) {
|
|
417
|
-
const emojiStr = _Message.formatEmoji(emoji);
|
|
418
|
-
const route = `${import_types4.Routes.channelMessageReaction(this.channelId, this.id, emojiStr)}/@me`;
|
|
419
|
-
await this.client.rest.put(route);
|
|
420
|
-
}
|
|
421
|
-
/**
|
|
422
|
-
* Remove the bot's reaction, or a specific user's reaction if userId is provided.
|
|
423
|
-
* @param emoji - Unicode emoji or custom `{ name, id }`
|
|
424
|
-
* @param userId - If provided, removes that user's reaction (requires moderator permissions)
|
|
425
|
-
*/
|
|
426
|
-
async removeReaction(emoji, userId) {
|
|
427
|
-
const emojiStr = _Message.formatEmoji(emoji);
|
|
428
|
-
const route = `${import_types4.Routes.channelMessageReaction(this.channelId, this.id, emojiStr)}/${userId ?? "@me"}`;
|
|
429
|
-
await this.client.rest.delete(route);
|
|
430
|
-
}
|
|
431
|
-
/**
|
|
432
|
-
* Remove all reactions from this message.
|
|
433
|
-
* Requires moderator permissions.
|
|
434
|
-
*/
|
|
435
|
-
async removeAllReactions() {
|
|
436
|
-
await this.client.rest.delete(import_types4.Routes.channelMessageReactions(this.channelId, this.id));
|
|
691
|
+
this.guildId = guildId;
|
|
692
|
+
this.name = data.name;
|
|
693
|
+
this.color = data.color;
|
|
694
|
+
this.position = data.position;
|
|
695
|
+
this.permissions = data.permissions;
|
|
696
|
+
this.hoist = !!data.hoist;
|
|
697
|
+
this.mentionable = !!data.mentionable;
|
|
698
|
+
this.unicodeEmoji = data.unicode_emoji ?? null;
|
|
437
699
|
}
|
|
438
|
-
/**
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
*/
|
|
442
|
-
async removeReactionEmoji(emoji) {
|
|
443
|
-
const emojiStr = _Message.formatEmoji(emoji);
|
|
444
|
-
await this.client.rest.delete(import_types4.Routes.channelMessageReaction(this.channelId, this.id, emojiStr));
|
|
700
|
+
/** Returns a mention string (e.g. `<@&123456>`). */
|
|
701
|
+
toString() {
|
|
702
|
+
return `<@&${this.id}>`;
|
|
445
703
|
}
|
|
446
704
|
};
|
|
447
705
|
}
|
|
448
706
|
});
|
|
449
707
|
|
|
450
|
-
// src/
|
|
451
|
-
var
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
});
|
|
455
|
-
var import_types5, GuildMember;
|
|
456
|
-
var init_GuildMember = __esm({
|
|
457
|
-
"src/structures/GuildMember.ts"() {
|
|
708
|
+
// src/util/Constants.ts
|
|
709
|
+
var CDN_URL;
|
|
710
|
+
var init_Constants = __esm({
|
|
711
|
+
"src/util/Constants.ts"() {
|
|
458
712
|
"use strict";
|
|
459
|
-
|
|
460
|
-
init_User();
|
|
461
|
-
import_types5 = require("@fluxerjs/types");
|
|
462
|
-
GuildMember = class extends Base {
|
|
463
|
-
client;
|
|
464
|
-
id;
|
|
465
|
-
user;
|
|
466
|
-
guild;
|
|
467
|
-
nick;
|
|
468
|
-
roles;
|
|
469
|
-
joinedAt;
|
|
470
|
-
communicationDisabledUntil;
|
|
471
|
-
/** @param data - API guild member from GET /guilds/{id}/members or GET /guilds/{id}/members/{user_id} */
|
|
472
|
-
constructor(client, data, guild) {
|
|
473
|
-
super();
|
|
474
|
-
this.client = client;
|
|
475
|
-
this.user = new User(client, data.user);
|
|
476
|
-
this.id = data.user.id;
|
|
477
|
-
this.guild = guild;
|
|
478
|
-
this.nick = data.nick ?? null;
|
|
479
|
-
this.roles = data.roles ?? [];
|
|
480
|
-
this.joinedAt = new Date(data.joined_at);
|
|
481
|
-
this.communicationDisabledUntil = data.communication_disabled_until ? new Date(data.communication_disabled_until) : null;
|
|
482
|
-
}
|
|
483
|
-
/** Nickname, or global name, or username. */
|
|
484
|
-
get displayName() {
|
|
485
|
-
return this.nick ?? this.user.globalName ?? this.user.username;
|
|
486
|
-
}
|
|
487
|
-
/**
|
|
488
|
-
* Add a role to this member.
|
|
489
|
-
* @param roleId - The role ID to add
|
|
490
|
-
* Requires Manage Roles permission.
|
|
491
|
-
*/
|
|
492
|
-
async addRole(roleId) {
|
|
493
|
-
await this.client.rest.put(import_types5.Routes.guildMemberRole(this.guild.id, this.id, roleId));
|
|
494
|
-
}
|
|
495
|
-
/**
|
|
496
|
-
* Remove a role from this member.
|
|
497
|
-
* @param roleId - The role ID to remove
|
|
498
|
-
* Requires Manage Roles permission.
|
|
499
|
-
*/
|
|
500
|
-
async removeRole(roleId) {
|
|
501
|
-
await this.client.rest.delete(import_types5.Routes.guildMemberRole(this.guild.id, this.id, roleId));
|
|
502
|
-
}
|
|
503
|
-
};
|
|
713
|
+
CDN_URL = "https://fluxerusercontent.com";
|
|
504
714
|
}
|
|
505
715
|
});
|
|
506
716
|
|
|
@@ -509,13 +719,15 @@ var Guild_exports = {};
|
|
|
509
719
|
__export(Guild_exports, {
|
|
510
720
|
Guild: () => Guild
|
|
511
721
|
});
|
|
512
|
-
var
|
|
722
|
+
var import_util, import_collection3, import_types6, Guild;
|
|
513
723
|
var init_Guild = __esm({
|
|
514
724
|
"src/structures/Guild.ts"() {
|
|
515
725
|
"use strict";
|
|
726
|
+
import_util = require("@fluxerjs/util");
|
|
516
727
|
init_Base();
|
|
517
|
-
|
|
728
|
+
import_collection3 = require("@fluxerjs/collection");
|
|
518
729
|
init_GuildMember();
|
|
730
|
+
init_Role();
|
|
519
731
|
init_Constants();
|
|
520
732
|
import_types6 = require("@fluxerjs/types");
|
|
521
733
|
Guild = class extends Base {
|
|
@@ -525,8 +737,9 @@ var init_Guild = __esm({
|
|
|
525
737
|
icon;
|
|
526
738
|
banner;
|
|
527
739
|
ownerId;
|
|
528
|
-
members = new
|
|
529
|
-
channels = new
|
|
740
|
+
members = new import_collection3.Collection();
|
|
741
|
+
channels = new import_collection3.Collection();
|
|
742
|
+
roles = new import_collection3.Collection();
|
|
530
743
|
/** @param data - API guild from GET /guilds/{id} or gateway GUILD_CREATE */
|
|
531
744
|
constructor(client, data) {
|
|
532
745
|
super();
|
|
@@ -536,6 +749,9 @@ var init_Guild = __esm({
|
|
|
536
749
|
this.icon = data.icon ?? null;
|
|
537
750
|
this.banner = data.banner ?? null;
|
|
538
751
|
this.ownerId = data.owner_id;
|
|
752
|
+
for (const r of data.roles ?? []) {
|
|
753
|
+
this.roles.set(r.id, new Role(client, r, this.id));
|
|
754
|
+
}
|
|
539
755
|
}
|
|
540
756
|
/** Get the guild icon URL, or null if no icon. */
|
|
541
757
|
iconURL(options) {
|
|
@@ -549,6 +765,47 @@ var init_Guild = __esm({
|
|
|
549
765
|
const size = options?.size ? `?size=${options.size}` : "";
|
|
550
766
|
return `${CDN_URL}/banners/${this.id}/${this.banner}.png${size}`;
|
|
551
767
|
}
|
|
768
|
+
/**
|
|
769
|
+
* Add a role to a member by user ID. Does not require fetching the member first.
|
|
770
|
+
* @param userId - The user ID of the member
|
|
771
|
+
* @param roleId - The role ID to add (or use guild.resolveRoleId for mention/name resolution)
|
|
772
|
+
* Requires Manage Roles permission.
|
|
773
|
+
*/
|
|
774
|
+
async addRoleToMember(userId, roleId) {
|
|
775
|
+
await this.client.rest.put(import_types6.Routes.guildMemberRole(this.id, userId, roleId));
|
|
776
|
+
}
|
|
777
|
+
/**
|
|
778
|
+
* Remove a role from a member by user ID. Does not require fetching the member first.
|
|
779
|
+
* @param userId - The user ID of the member
|
|
780
|
+
* @param roleId - The role ID to remove
|
|
781
|
+
* Requires Manage Roles permission.
|
|
782
|
+
*/
|
|
783
|
+
async removeRoleFromMember(userId, roleId) {
|
|
784
|
+
await this.client.rest.delete(import_types6.Routes.guildMemberRole(this.id, userId, roleId));
|
|
785
|
+
}
|
|
786
|
+
/**
|
|
787
|
+
* Resolve a role ID from an argument (role mention, raw ID, or name).
|
|
788
|
+
* Fetches guild roles if name is provided.
|
|
789
|
+
* @param arg - Role mention (@role), role ID, or role name
|
|
790
|
+
* @returns The role ID, or null if not found
|
|
791
|
+
*/
|
|
792
|
+
async resolveRoleId(arg) {
|
|
793
|
+
const parsed = (0, import_util.parseRoleMention)(arg);
|
|
794
|
+
if (parsed) return parsed;
|
|
795
|
+
if (/^\d{17,19}$/.test(arg.trim())) return arg.trim();
|
|
796
|
+
const cached = this.roles.find(
|
|
797
|
+
(r) => !!(r.name && r.name.toLowerCase() === arg.trim().toLowerCase())
|
|
798
|
+
);
|
|
799
|
+
if (cached) return cached.id;
|
|
800
|
+
const roles = await this.client.rest.get(import_types6.Routes.guildRoles(this.id));
|
|
801
|
+
const list = Array.isArray(roles) ? roles : Object.values(roles ?? {});
|
|
802
|
+
const role = list.find((r) => !!(r.name && r.name.toLowerCase() === arg.trim().toLowerCase()));
|
|
803
|
+
if (role) {
|
|
804
|
+
this.roles.set(role.id, new Role(this.client, role, this.id));
|
|
805
|
+
return role.id;
|
|
806
|
+
}
|
|
807
|
+
return null;
|
|
808
|
+
}
|
|
552
809
|
/**
|
|
553
810
|
* Fetch a guild member by user ID.
|
|
554
811
|
* @param userId - The user ID of the member to fetch
|
|
@@ -564,6 +821,22 @@ var init_Guild = __esm({
|
|
|
564
821
|
return null;
|
|
565
822
|
}
|
|
566
823
|
}
|
|
824
|
+
/**
|
|
825
|
+
* Fetch guild audit logs. Requires View Audit Log permission.
|
|
826
|
+
* @param options - Optional limit, before, after, user_id, action_type for filtering
|
|
827
|
+
*/
|
|
828
|
+
async fetchAuditLogs(options) {
|
|
829
|
+
const params = new URLSearchParams();
|
|
830
|
+
if (options?.limit != null) params.set("limit", String(options.limit));
|
|
831
|
+
if (options?.before) params.set("before", options.before);
|
|
832
|
+
if (options?.after) params.set("after", options.after);
|
|
833
|
+
if (options?.userId) params.set("user_id", options.userId);
|
|
834
|
+
if (options?.actionType != null)
|
|
835
|
+
params.set("action_type", String(options.actionType));
|
|
836
|
+
const qs = params.toString();
|
|
837
|
+
const url = import_types6.Routes.guildAuditLogs(this.id) + (qs ? `?${qs}` : "");
|
|
838
|
+
return this.client.rest.get(url);
|
|
839
|
+
}
|
|
567
840
|
/** Fetch all webhooks in this guild. Returned webhooks do not include the token (cannot send). */
|
|
568
841
|
async fetchWebhooks() {
|
|
569
842
|
const { Webhook: Webhook2 } = await Promise.resolve().then(() => (init_Webhook(), Webhook_exports));
|
|
@@ -575,6 +848,231 @@ var init_Guild = __esm({
|
|
|
575
848
|
}
|
|
576
849
|
});
|
|
577
850
|
|
|
851
|
+
// src/structures/User.ts
|
|
852
|
+
var import_types8, User;
|
|
853
|
+
var init_User = __esm({
|
|
854
|
+
"src/structures/User.ts"() {
|
|
855
|
+
"use strict";
|
|
856
|
+
init_Base();
|
|
857
|
+
import_types8 = require("@fluxerjs/types");
|
|
858
|
+
init_Constants();
|
|
859
|
+
User = class extends Base {
|
|
860
|
+
client;
|
|
861
|
+
id;
|
|
862
|
+
username;
|
|
863
|
+
discriminator;
|
|
864
|
+
globalName;
|
|
865
|
+
avatar;
|
|
866
|
+
bot;
|
|
867
|
+
/** @param data - API user from message author, GET /users/{id}, or GET /users/@me */
|
|
868
|
+
constructor(client, data) {
|
|
869
|
+
super();
|
|
870
|
+
this.client = client;
|
|
871
|
+
this.id = data.id;
|
|
872
|
+
this.username = data.username;
|
|
873
|
+
this.discriminator = data.discriminator;
|
|
874
|
+
this.globalName = data.global_name ?? null;
|
|
875
|
+
this.avatar = data.avatar ?? null;
|
|
876
|
+
this.bot = !!data.bot;
|
|
877
|
+
}
|
|
878
|
+
/** Update mutable fields from fresh API data. Used by getOrCreateUser cache. */
|
|
879
|
+
_patch(data) {
|
|
880
|
+
this.username = data.username;
|
|
881
|
+
this.discriminator = data.discriminator;
|
|
882
|
+
this.globalName = data.global_name ?? null;
|
|
883
|
+
this.avatar = data.avatar ?? null;
|
|
884
|
+
}
|
|
885
|
+
/**
|
|
886
|
+
* Get the URL for this user's avatar.
|
|
887
|
+
* @param options - Optional `size` and `extension` (default: `png`)
|
|
888
|
+
*/
|
|
889
|
+
avatarURL(options) {
|
|
890
|
+
if (!this.avatar) return null;
|
|
891
|
+
const ext = options?.extension ?? "png";
|
|
892
|
+
const size = options?.size ? `?size=${options.size}` : "";
|
|
893
|
+
return `${CDN_URL}/avatars/${this.id}/${this.avatar}.${ext}${size}`;
|
|
894
|
+
}
|
|
895
|
+
/** Get the avatar URL, or the default avatar if none set. */
|
|
896
|
+
displayAvatarURL(options) {
|
|
897
|
+
return this.avatarURL(options) ?? `${CDN_URL}/avatars/0/0.png`;
|
|
898
|
+
}
|
|
899
|
+
/** Returns a mention string (e.g. `<@123456>`). */
|
|
900
|
+
toString() {
|
|
901
|
+
return `<@${this.id}>`;
|
|
902
|
+
}
|
|
903
|
+
/**
|
|
904
|
+
* Create or get a DM channel with this user.
|
|
905
|
+
* Returns the DM channel; use {@link DMChannel.send} to send messages.
|
|
906
|
+
*/
|
|
907
|
+
async createDM() {
|
|
908
|
+
const { DMChannel: DMChannelClass } = await Promise.resolve().then(() => (init_Channel(), Channel_exports));
|
|
909
|
+
const data = await this.client.rest.post(import_types8.Routes.userMeChannels(), {
|
|
910
|
+
body: { recipient_id: this.id },
|
|
911
|
+
auth: true
|
|
912
|
+
});
|
|
913
|
+
return new DMChannelClass(this.client, data);
|
|
914
|
+
}
|
|
915
|
+
/**
|
|
916
|
+
* Send a DM to this user.
|
|
917
|
+
* Convenience method that creates the DM channel and sends the message.
|
|
918
|
+
*/
|
|
919
|
+
async send(options) {
|
|
920
|
+
const dm = await this.createDM();
|
|
921
|
+
return dm.send(options);
|
|
922
|
+
}
|
|
923
|
+
};
|
|
924
|
+
}
|
|
925
|
+
});
|
|
926
|
+
|
|
927
|
+
// src/structures/MessageReaction.ts
|
|
928
|
+
var MessageReaction_exports = {};
|
|
929
|
+
__export(MessageReaction_exports, {
|
|
930
|
+
MessageReaction: () => MessageReaction
|
|
931
|
+
});
|
|
932
|
+
var MessageReaction;
|
|
933
|
+
var init_MessageReaction = __esm({
|
|
934
|
+
"src/structures/MessageReaction.ts"() {
|
|
935
|
+
"use strict";
|
|
936
|
+
init_Base();
|
|
937
|
+
MessageReaction = class extends Base {
|
|
938
|
+
client;
|
|
939
|
+
messageId;
|
|
940
|
+
channelId;
|
|
941
|
+
guildId;
|
|
942
|
+
emoji;
|
|
943
|
+
/** Raw gateway payload for low-level access. */
|
|
944
|
+
_data;
|
|
945
|
+
constructor(client, data) {
|
|
946
|
+
super();
|
|
947
|
+
this.client = client;
|
|
948
|
+
this._data = data;
|
|
949
|
+
this.messageId = data.message_id;
|
|
950
|
+
this.channelId = data.channel_id;
|
|
951
|
+
this.guildId = data.guild_id ?? null;
|
|
952
|
+
this.emoji = data.emoji;
|
|
953
|
+
}
|
|
954
|
+
/** Emoji as a string: unicode or "name:id" for custom. */
|
|
955
|
+
get emojiIdentifier() {
|
|
956
|
+
return this.emoji.id ? `${this.emoji.name}:${this.emoji.id}` : this.emoji.name;
|
|
957
|
+
}
|
|
958
|
+
/** Guild where this reaction was added. Resolved from cache; null for DMs or if not cached. */
|
|
959
|
+
get guild() {
|
|
960
|
+
return this.guildId ? this.client.guilds.get(this.guildId) ?? null : null;
|
|
961
|
+
}
|
|
962
|
+
/**
|
|
963
|
+
* Fetch the message this reaction belongs to.
|
|
964
|
+
* Use when you need to edit, delete, or otherwise interact with the message.
|
|
965
|
+
*/
|
|
966
|
+
async fetchMessage() {
|
|
967
|
+
return this.client.channels.fetchMessage(this.channelId, this.messageId);
|
|
968
|
+
}
|
|
969
|
+
};
|
|
970
|
+
}
|
|
971
|
+
});
|
|
972
|
+
|
|
973
|
+
// src/structures/GuildBan.ts
|
|
974
|
+
var GuildBan_exports = {};
|
|
975
|
+
__export(GuildBan_exports, {
|
|
976
|
+
GuildBan: () => GuildBan
|
|
977
|
+
});
|
|
978
|
+
var import_types9, GuildBan;
|
|
979
|
+
var init_GuildBan = __esm({
|
|
980
|
+
"src/structures/GuildBan.ts"() {
|
|
981
|
+
"use strict";
|
|
982
|
+
init_Base();
|
|
983
|
+
import_types9 = require("@fluxerjs/types");
|
|
984
|
+
GuildBan = class extends Base {
|
|
985
|
+
client;
|
|
986
|
+
guildId;
|
|
987
|
+
user;
|
|
988
|
+
reason;
|
|
989
|
+
/** @param data - API ban from GET /guilds/{id}/bans or gateway GUILD_BAN_ADD */
|
|
990
|
+
constructor(client, data, guildId) {
|
|
991
|
+
super();
|
|
992
|
+
this.client = client;
|
|
993
|
+
this.guildId = data.guild_id ?? guildId;
|
|
994
|
+
this.user = client.getOrCreateUser(data.user);
|
|
995
|
+
this.reason = data.reason ?? null;
|
|
996
|
+
}
|
|
997
|
+
/**
|
|
998
|
+
* Remove this ban (unban the user).
|
|
999
|
+
* Requires Ban Members permission.
|
|
1000
|
+
*/
|
|
1001
|
+
async unban() {
|
|
1002
|
+
await this.client.rest.delete(import_types9.Routes.guildBan(this.guildId, this.user.id), {
|
|
1003
|
+
auth: true
|
|
1004
|
+
});
|
|
1005
|
+
}
|
|
1006
|
+
};
|
|
1007
|
+
}
|
|
1008
|
+
});
|
|
1009
|
+
|
|
1010
|
+
// src/structures/Invite.ts
|
|
1011
|
+
var Invite_exports = {};
|
|
1012
|
+
__export(Invite_exports, {
|
|
1013
|
+
Invite: () => Invite
|
|
1014
|
+
});
|
|
1015
|
+
var import_types10, Invite;
|
|
1016
|
+
var init_Invite = __esm({
|
|
1017
|
+
"src/structures/Invite.ts"() {
|
|
1018
|
+
"use strict";
|
|
1019
|
+
init_Base();
|
|
1020
|
+
import_types10 = require("@fluxerjs/types");
|
|
1021
|
+
Invite = class extends Base {
|
|
1022
|
+
client;
|
|
1023
|
+
code;
|
|
1024
|
+
type;
|
|
1025
|
+
guild;
|
|
1026
|
+
channel;
|
|
1027
|
+
inviter;
|
|
1028
|
+
memberCount;
|
|
1029
|
+
presenceCount;
|
|
1030
|
+
expiresAt;
|
|
1031
|
+
temporary;
|
|
1032
|
+
createdAt;
|
|
1033
|
+
uses;
|
|
1034
|
+
maxUses;
|
|
1035
|
+
maxAge;
|
|
1036
|
+
/** @param data - API invite from GET /invites/{code}, channel/guild invite list, or gateway INVITE_CREATE */
|
|
1037
|
+
constructor(client, data) {
|
|
1038
|
+
super();
|
|
1039
|
+
this.client = client;
|
|
1040
|
+
this.code = data.code;
|
|
1041
|
+
this.type = data.type;
|
|
1042
|
+
this.guild = data.guild;
|
|
1043
|
+
this.channel = data.channel;
|
|
1044
|
+
this.inviter = data.inviter ? client.getOrCreateUser(data.inviter) : null;
|
|
1045
|
+
this.memberCount = data.member_count ?? null;
|
|
1046
|
+
this.presenceCount = data.presence_count ?? null;
|
|
1047
|
+
this.expiresAt = data.expires_at ?? null;
|
|
1048
|
+
this.temporary = data.temporary ?? null;
|
|
1049
|
+
this.createdAt = data.created_at ?? null;
|
|
1050
|
+
this.uses = data.uses ?? null;
|
|
1051
|
+
this.maxUses = data.max_uses ?? null;
|
|
1052
|
+
this.maxAge = data.max_age ?? null;
|
|
1053
|
+
}
|
|
1054
|
+
/** Full invite URL (https://fluxer.gg/{code} or instance-specific). */
|
|
1055
|
+
get url() {
|
|
1056
|
+
return `https://fluxer.gg/${this.code}`;
|
|
1057
|
+
}
|
|
1058
|
+
/**
|
|
1059
|
+
* Resolve the guild from cache if available.
|
|
1060
|
+
* @returns The guild, or null if not cached
|
|
1061
|
+
*/
|
|
1062
|
+
getGuild() {
|
|
1063
|
+
return this.guild?.id ? this.client.guilds.get(this.guild.id) ?? null : null;
|
|
1064
|
+
}
|
|
1065
|
+
/**
|
|
1066
|
+
* Delete this invite.
|
|
1067
|
+
* Requires Manage Guild or Create Instant Invite permission.
|
|
1068
|
+
*/
|
|
1069
|
+
async delete() {
|
|
1070
|
+
await this.client.rest.delete(import_types10.Routes.invite(this.code), { auth: true });
|
|
1071
|
+
}
|
|
1072
|
+
};
|
|
1073
|
+
}
|
|
1074
|
+
});
|
|
1075
|
+
|
|
578
1076
|
// src/client/ClientUser.ts
|
|
579
1077
|
var ClientUser_exports = {};
|
|
580
1078
|
__export(ClientUser_exports, {
|
|
@@ -600,6 +1098,7 @@ __export(index_exports, {
|
|
|
600
1098
|
Base: () => Base,
|
|
601
1099
|
CategoryChannel: () => CategoryChannel,
|
|
602
1100
|
Channel: () => Channel,
|
|
1101
|
+
ChannelManager: () => ChannelManager,
|
|
603
1102
|
Client: () => Client,
|
|
604
1103
|
ClientUser: () => ClientUser,
|
|
605
1104
|
DMChannel: () => DMChannel,
|
|
@@ -607,14 +1106,21 @@ __export(index_exports, {
|
|
|
607
1106
|
ErrorCodes: () => ErrorCodes,
|
|
608
1107
|
Events: () => Events,
|
|
609
1108
|
FluxerError: () => FluxerError,
|
|
610
|
-
GatewayOpcodes: () =>
|
|
1109
|
+
GatewayOpcodes: () => import_types14.GatewayOpcodes,
|
|
611
1110
|
Guild: () => Guild,
|
|
1111
|
+
GuildBan: () => GuildBan,
|
|
612
1112
|
GuildChannel: () => GuildChannel,
|
|
1113
|
+
GuildEmoji: () => GuildEmoji,
|
|
613
1114
|
GuildMember: () => GuildMember,
|
|
1115
|
+
GuildSticker: () => GuildSticker,
|
|
1116
|
+
Invite: () => Invite,
|
|
614
1117
|
LinkChannel: () => LinkChannel,
|
|
615
1118
|
Message: () => Message,
|
|
1119
|
+
MessageManager: () => MessageManager,
|
|
616
1120
|
MessagePayload: () => import_builders2.MessagePayload,
|
|
617
|
-
|
|
1121
|
+
MessageReaction: () => MessageReaction,
|
|
1122
|
+
Role: () => Role,
|
|
1123
|
+
Routes: () => import_types14.Routes,
|
|
618
1124
|
TextChannel: () => TextChannel,
|
|
619
1125
|
User: () => User,
|
|
620
1126
|
VoiceChannel: () => VoiceChannel,
|
|
@@ -626,8 +1132,120 @@ module.exports = __toCommonJS(index_exports);
|
|
|
626
1132
|
var import_events = require("events");
|
|
627
1133
|
var import_rest = require("@fluxerjs/rest");
|
|
628
1134
|
var import_ws = require("@fluxerjs/ws");
|
|
1135
|
+
var import_types11 = require("@fluxerjs/types");
|
|
1136
|
+
var import_collection5 = require("@fluxerjs/collection");
|
|
1137
|
+
|
|
1138
|
+
// src/client/ChannelManager.ts
|
|
1139
|
+
var import_collection2 = require("@fluxerjs/collection");
|
|
1140
|
+
var import_types4 = require("@fluxerjs/types");
|
|
1141
|
+
var ChannelManager = class extends import_collection2.Collection {
|
|
1142
|
+
constructor(client) {
|
|
1143
|
+
super();
|
|
1144
|
+
this.client = client;
|
|
1145
|
+
}
|
|
1146
|
+
/**
|
|
1147
|
+
* Fetch a channel by ID from the API (or return from cache if present).
|
|
1148
|
+
* @param channelId - Snowflake of the channel
|
|
1149
|
+
* @returns The channel, or null if not found
|
|
1150
|
+
* @example
|
|
1151
|
+
* const channel = await client.channels.fetch(channelId);
|
|
1152
|
+
* if (channel?.isSendable()) await channel.send('Hello!');
|
|
1153
|
+
*/
|
|
1154
|
+
async fetch(channelId) {
|
|
1155
|
+
const cached = this.get(channelId);
|
|
1156
|
+
if (cached) return cached;
|
|
1157
|
+
try {
|
|
1158
|
+
const { Channel: Channel2 } = await Promise.resolve().then(() => (init_Channel(), Channel_exports));
|
|
1159
|
+
const data = await this.client.rest.get(
|
|
1160
|
+
import_types4.Routes.channel(channelId)
|
|
1161
|
+
);
|
|
1162
|
+
const channel = Channel2.fromOrCreate(this.client, data);
|
|
1163
|
+
if (channel) this.set(channel.id, channel);
|
|
1164
|
+
return channel;
|
|
1165
|
+
} catch {
|
|
1166
|
+
return null;
|
|
1167
|
+
}
|
|
1168
|
+
}
|
|
1169
|
+
/**
|
|
1170
|
+
* Fetch a message by ID from the API.
|
|
1171
|
+
* @param channelId - Snowflake of the channel
|
|
1172
|
+
* @param messageId - Snowflake of the message
|
|
1173
|
+
* @returns The message, or null if not found
|
|
1174
|
+
* @deprecated Use channel.messages.fetch(messageId). Prefer (await client.channels.fetch(channelId))?.messages?.fetch(messageId).
|
|
1175
|
+
* @example
|
|
1176
|
+
* const channel = await client.channels.fetch(channelId);
|
|
1177
|
+
* const message = await channel?.messages?.fetch(messageId);
|
|
1178
|
+
*/
|
|
1179
|
+
async fetchMessage(channelId, messageId) {
|
|
1180
|
+
try {
|
|
1181
|
+
const { Message: Message2 } = await Promise.resolve().then(() => (init_Message(), Message_exports));
|
|
1182
|
+
const data = await this.client.rest.get(
|
|
1183
|
+
import_types4.Routes.channelMessage(channelId, messageId)
|
|
1184
|
+
);
|
|
1185
|
+
return new Message2(this.client, data);
|
|
1186
|
+
} catch {
|
|
1187
|
+
return null;
|
|
1188
|
+
}
|
|
1189
|
+
}
|
|
1190
|
+
/**
|
|
1191
|
+
* Send a message to a channel by ID. Works even when the channel is not cached.
|
|
1192
|
+
* Skips the fetch when you only need to send.
|
|
1193
|
+
* @param channelId - Snowflake of the channel (text channel or DM)
|
|
1194
|
+
* @param payload - Text content or object with content and/or embeds
|
|
1195
|
+
* @returns The created message
|
|
1196
|
+
* @example
|
|
1197
|
+
* await client.channels.send(logChannelId, 'User joined!');
|
|
1198
|
+
* await client.channels.send(channelId, { embeds: [embed.toJSON()] });
|
|
1199
|
+
*/
|
|
1200
|
+
async send(channelId, payload) {
|
|
1201
|
+
const body = typeof payload === "string" ? { content: payload } : payload;
|
|
1202
|
+
const { Message: Message2 } = await Promise.resolve().then(() => (init_Message(), Message_exports));
|
|
1203
|
+
const data = await this.client.rest.post(import_types4.Routes.channelMessages(channelId), { body });
|
|
1204
|
+
return new Message2(this.client, data);
|
|
1205
|
+
}
|
|
1206
|
+
};
|
|
1207
|
+
|
|
1208
|
+
// src/client/GuildManager.ts
|
|
1209
|
+
var import_collection4 = require("@fluxerjs/collection");
|
|
629
1210
|
var import_types7 = require("@fluxerjs/types");
|
|
630
|
-
var
|
|
1211
|
+
var GuildManager = class extends import_collection4.Collection {
|
|
1212
|
+
constructor(client) {
|
|
1213
|
+
super();
|
|
1214
|
+
this.client = client;
|
|
1215
|
+
}
|
|
1216
|
+
/**
|
|
1217
|
+
* Fetch a guild by ID from the API (or return from cache if present).
|
|
1218
|
+
* @param guildId - Snowflake of the guild
|
|
1219
|
+
* @returns The guild, or null if not found
|
|
1220
|
+
* @example
|
|
1221
|
+
* const guild = await client.guilds.fetch(guildId);
|
|
1222
|
+
* if (guild) console.log(guild.name);
|
|
1223
|
+
*/
|
|
1224
|
+
async fetch(guildId) {
|
|
1225
|
+
const cached = this.get(guildId);
|
|
1226
|
+
if (cached) return cached;
|
|
1227
|
+
try {
|
|
1228
|
+
const { Guild: Guild2 } = await Promise.resolve().then(() => (init_Guild(), Guild_exports));
|
|
1229
|
+
const data = await this.client.rest.get(
|
|
1230
|
+
import_types7.Routes.guild(guildId)
|
|
1231
|
+
);
|
|
1232
|
+
const guild = new Guild2(this.client, data);
|
|
1233
|
+
this.set(guild.id, guild);
|
|
1234
|
+
return guild;
|
|
1235
|
+
} catch {
|
|
1236
|
+
return null;
|
|
1237
|
+
}
|
|
1238
|
+
}
|
|
1239
|
+
};
|
|
1240
|
+
|
|
1241
|
+
// src/errors/FluxerError.ts
|
|
1242
|
+
var FluxerError = class _FluxerError extends Error {
|
|
1243
|
+
constructor(message) {
|
|
1244
|
+
super(message);
|
|
1245
|
+
this.name = "FluxerError";
|
|
1246
|
+
Object.setPrototypeOf(this, _FluxerError.prototype);
|
|
1247
|
+
}
|
|
1248
|
+
};
|
|
631
1249
|
|
|
632
1250
|
// src/util/Events.ts
|
|
633
1251
|
var Events = {
|
|
@@ -635,6 +1253,7 @@ var Events = {
|
|
|
635
1253
|
MessageCreate: "messageCreate",
|
|
636
1254
|
MessageUpdate: "messageUpdate",
|
|
637
1255
|
MessageDelete: "messageDelete",
|
|
1256
|
+
MessageDeleteBulk: "messageDeleteBulk",
|
|
638
1257
|
MessageReactionAdd: "messageReactionAdd",
|
|
639
1258
|
MessageReactionRemove: "messageReactionRemove",
|
|
640
1259
|
MessageReactionRemoveAll: "messageReactionRemoveAll",
|
|
@@ -643,25 +1262,293 @@ var Events = {
|
|
|
643
1262
|
GuildCreate: "guildCreate",
|
|
644
1263
|
GuildUpdate: "guildUpdate",
|
|
645
1264
|
GuildDelete: "guildDelete",
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
1265
|
+
GuildBanAdd: "guildBanAdd",
|
|
1266
|
+
GuildBanRemove: "guildBanRemove",
|
|
1267
|
+
GuildEmojisUpdate: "guildEmojisUpdate",
|
|
1268
|
+
GuildStickersUpdate: "guildStickersUpdate",
|
|
1269
|
+
GuildIntegrationsUpdate: "guildIntegrationsUpdate",
|
|
649
1270
|
GuildMemberAdd: "guildMemberAdd",
|
|
650
1271
|
GuildMemberUpdate: "guildMemberUpdate",
|
|
651
1272
|
GuildMemberRemove: "guildMemberRemove",
|
|
1273
|
+
GuildRoleCreate: "guildRoleCreate",
|
|
1274
|
+
GuildRoleUpdate: "guildRoleUpdate",
|
|
1275
|
+
GuildRoleDelete: "guildRoleDelete",
|
|
1276
|
+
GuildScheduledEventCreate: "guildScheduledEventCreate",
|
|
1277
|
+
GuildScheduledEventUpdate: "guildScheduledEventUpdate",
|
|
1278
|
+
GuildScheduledEventDelete: "guildScheduledEventDelete",
|
|
1279
|
+
ChannelCreate: "channelCreate",
|
|
1280
|
+
ChannelUpdate: "channelUpdate",
|
|
1281
|
+
ChannelDelete: "channelDelete",
|
|
1282
|
+
ChannelPinsUpdate: "channelPinsUpdate",
|
|
1283
|
+
InviteCreate: "inviteCreate",
|
|
1284
|
+
InviteDelete: "inviteDelete",
|
|
1285
|
+
TypingStart: "typingStart",
|
|
1286
|
+
UserUpdate: "userUpdate",
|
|
1287
|
+
PresenceUpdate: "presenceUpdate",
|
|
652
1288
|
VoiceStateUpdate: "voiceStateUpdate",
|
|
653
1289
|
VoiceServerUpdate: "voiceServerUpdate",
|
|
654
1290
|
VoiceStatesSync: "voiceStatesSync",
|
|
1291
|
+
WebhooksUpdate: "webhooksUpdate",
|
|
1292
|
+
Resumed: "resumed",
|
|
655
1293
|
Error: "error",
|
|
656
1294
|
Debug: "debug"
|
|
657
1295
|
};
|
|
658
1296
|
|
|
1297
|
+
// src/client/Client.ts
|
|
1298
|
+
var import_util2 = require("@fluxerjs/util");
|
|
1299
|
+
init_User();
|
|
1300
|
+
|
|
1301
|
+
// src/client/EventHandlerRegistry.ts
|
|
1302
|
+
var handlers = /* @__PURE__ */ new Map();
|
|
1303
|
+
handlers.set("MESSAGE_CREATE", async (client, d) => {
|
|
1304
|
+
const { Message: Message2 } = await Promise.resolve().then(() => (init_Message(), Message_exports));
|
|
1305
|
+
client.emit(Events.MessageCreate, new Message2(client, d));
|
|
1306
|
+
});
|
|
1307
|
+
handlers.set("MESSAGE_UPDATE", async (client, d) => {
|
|
1308
|
+
const { Message: Message2 } = await Promise.resolve().then(() => (init_Message(), Message_exports));
|
|
1309
|
+
client.emit(Events.MessageUpdate, null, new Message2(client, d));
|
|
1310
|
+
});
|
|
1311
|
+
handlers.set("MESSAGE_DELETE", async (client, d) => {
|
|
1312
|
+
const data = d;
|
|
1313
|
+
const channel = client.channels.get(data.channel_id) ?? null;
|
|
1314
|
+
client.emit(Events.MessageDelete, {
|
|
1315
|
+
id: data.id,
|
|
1316
|
+
channelId: data.channel_id,
|
|
1317
|
+
channel
|
|
1318
|
+
});
|
|
1319
|
+
});
|
|
1320
|
+
handlers.set("MESSAGE_REACTION_ADD", async (client, d) => {
|
|
1321
|
+
const data = d;
|
|
1322
|
+
const { MessageReaction: MessageReaction2 } = await Promise.resolve().then(() => (init_MessageReaction(), MessageReaction_exports));
|
|
1323
|
+
const reaction = new MessageReaction2(client, data);
|
|
1324
|
+
const user = client.getOrCreateUser({
|
|
1325
|
+
id: data.user_id,
|
|
1326
|
+
username: "Unknown",
|
|
1327
|
+
discriminator: "0"
|
|
1328
|
+
});
|
|
1329
|
+
client.emit(Events.MessageReactionAdd, reaction, user);
|
|
1330
|
+
});
|
|
1331
|
+
handlers.set("MESSAGE_REACTION_REMOVE", async (client, d) => {
|
|
1332
|
+
const data = d;
|
|
1333
|
+
const { MessageReaction: MessageReaction2 } = await Promise.resolve().then(() => (init_MessageReaction(), MessageReaction_exports));
|
|
1334
|
+
const reaction = new MessageReaction2(client, data);
|
|
1335
|
+
const user = client.getOrCreateUser({
|
|
1336
|
+
id: data.user_id,
|
|
1337
|
+
username: "Unknown",
|
|
1338
|
+
discriminator: "0"
|
|
1339
|
+
});
|
|
1340
|
+
client.emit(Events.MessageReactionRemove, reaction, user);
|
|
1341
|
+
});
|
|
1342
|
+
handlers.set("MESSAGE_REACTION_REMOVE_ALL", async (client, d) => {
|
|
1343
|
+
client.emit(Events.MessageReactionRemoveAll, d);
|
|
1344
|
+
});
|
|
1345
|
+
handlers.set("MESSAGE_REACTION_REMOVE_EMOJI", async (client, d) => {
|
|
1346
|
+
client.emit(
|
|
1347
|
+
Events.MessageReactionRemoveEmoji,
|
|
1348
|
+
d
|
|
1349
|
+
);
|
|
1350
|
+
});
|
|
1351
|
+
handlers.set("GUILD_CREATE", async (client, d) => {
|
|
1352
|
+
const { Guild: Guild2 } = await Promise.resolve().then(() => (init_Guild(), Guild_exports));
|
|
1353
|
+
const { Channel: Channel2 } = await Promise.resolve().then(() => (init_Channel(), Channel_exports));
|
|
1354
|
+
const guild = new Guild2(client, d);
|
|
1355
|
+
client.guilds.set(guild.id, guild);
|
|
1356
|
+
const g = d;
|
|
1357
|
+
for (const ch of g.channels ?? []) {
|
|
1358
|
+
const channel = Channel2.from(client, ch);
|
|
1359
|
+
if (channel) client.channels.set(channel.id, channel);
|
|
1360
|
+
}
|
|
1361
|
+
client.emit(Events.GuildCreate, guild);
|
|
1362
|
+
if (g.voice_states?.length) {
|
|
1363
|
+
client.emit(Events.VoiceStatesSync, { guildId: guild.id, voiceStates: g.voice_states });
|
|
1364
|
+
}
|
|
1365
|
+
});
|
|
1366
|
+
handlers.set("GUILD_UPDATE", async (client, d) => {
|
|
1367
|
+
const { Guild: Guild2 } = await Promise.resolve().then(() => (init_Guild(), Guild_exports));
|
|
1368
|
+
const g = d;
|
|
1369
|
+
const old = client.guilds.get(g.id);
|
|
1370
|
+
const updated = new Guild2(client, g);
|
|
1371
|
+
client.guilds.set(updated.id, updated);
|
|
1372
|
+
client.emit(Events.GuildUpdate, old ?? updated, updated);
|
|
1373
|
+
});
|
|
1374
|
+
handlers.set("GUILD_DELETE", async (client, d) => {
|
|
1375
|
+
const g = d;
|
|
1376
|
+
const guild = client.guilds.get(g.id);
|
|
1377
|
+
if (guild) {
|
|
1378
|
+
client.guilds.delete(g.id);
|
|
1379
|
+
client.emit(Events.GuildDelete, guild);
|
|
1380
|
+
}
|
|
1381
|
+
});
|
|
1382
|
+
handlers.set("CHANNEL_CREATE", async (client, d) => {
|
|
1383
|
+
const { Channel: Channel2 } = await Promise.resolve().then(() => (init_Channel(), Channel_exports));
|
|
1384
|
+
const ch = Channel2.from(client, d);
|
|
1385
|
+
if (ch) {
|
|
1386
|
+
client.channels.set(ch.id, ch);
|
|
1387
|
+
client.emit(Events.ChannelCreate, ch);
|
|
1388
|
+
}
|
|
1389
|
+
});
|
|
1390
|
+
handlers.set("CHANNEL_UPDATE", async (client, d) => {
|
|
1391
|
+
const { Channel: Channel2 } = await Promise.resolve().then(() => (init_Channel(), Channel_exports));
|
|
1392
|
+
const ch = d;
|
|
1393
|
+
const oldCh = client.channels.get(ch.id);
|
|
1394
|
+
const newCh = Channel2.from(client, ch);
|
|
1395
|
+
if (newCh) {
|
|
1396
|
+
client.channels.set(newCh.id, newCh);
|
|
1397
|
+
client.emit(Events.ChannelUpdate, oldCh ?? newCh, newCh);
|
|
1398
|
+
}
|
|
1399
|
+
});
|
|
1400
|
+
handlers.set("CHANNEL_DELETE", async (client, d) => {
|
|
1401
|
+
const ch = d;
|
|
1402
|
+
const channel = client.channels.get(ch.id);
|
|
1403
|
+
if (channel) {
|
|
1404
|
+
client.channels.delete(ch.id);
|
|
1405
|
+
client.emit(Events.ChannelDelete, channel);
|
|
1406
|
+
}
|
|
1407
|
+
});
|
|
1408
|
+
handlers.set("GUILD_MEMBER_ADD", async (client, d) => {
|
|
1409
|
+
const { GuildMember: GuildMember2 } = await Promise.resolve().then(() => (init_GuildMember(), GuildMember_exports));
|
|
1410
|
+
const data = d;
|
|
1411
|
+
const guild = client.guilds.get(data.guild_id);
|
|
1412
|
+
if (guild) {
|
|
1413
|
+
const member = new GuildMember2(client, data, guild);
|
|
1414
|
+
guild.members.set(member.id, member);
|
|
1415
|
+
client.emit(Events.GuildMemberAdd, member);
|
|
1416
|
+
}
|
|
1417
|
+
});
|
|
1418
|
+
handlers.set("GUILD_MEMBER_UPDATE", async (client, d) => {
|
|
1419
|
+
const { GuildMember: GuildMember2 } = await Promise.resolve().then(() => (init_GuildMember(), GuildMember_exports));
|
|
1420
|
+
const data = d;
|
|
1421
|
+
const guild = client.guilds.get(data.guild_id);
|
|
1422
|
+
if (guild) {
|
|
1423
|
+
const oldM = guild.members.get(data.user.id);
|
|
1424
|
+
const newM = new GuildMember2(client, data, guild);
|
|
1425
|
+
guild.members.set(newM.id, newM);
|
|
1426
|
+
client.emit(Events.GuildMemberUpdate, oldM ?? newM, newM);
|
|
1427
|
+
}
|
|
1428
|
+
});
|
|
1429
|
+
handlers.set("GUILD_MEMBER_REMOVE", async (client, d) => {
|
|
1430
|
+
const data = d;
|
|
1431
|
+
const guild = client.guilds.get(data.guild_id);
|
|
1432
|
+
if (guild) {
|
|
1433
|
+
const member = guild.members.get(data.user.id);
|
|
1434
|
+
if (member) {
|
|
1435
|
+
guild.members.delete(data.user.id);
|
|
1436
|
+
client.emit(Events.GuildMemberRemove, member);
|
|
1437
|
+
}
|
|
1438
|
+
}
|
|
1439
|
+
});
|
|
1440
|
+
handlers.set("INTERACTION_CREATE", async (client, d) => {
|
|
1441
|
+
client.emit(Events.InteractionCreate, d);
|
|
1442
|
+
});
|
|
1443
|
+
handlers.set("VOICE_STATE_UPDATE", async (client, d) => {
|
|
1444
|
+
client.emit(Events.VoiceStateUpdate, d);
|
|
1445
|
+
});
|
|
1446
|
+
handlers.set("VOICE_SERVER_UPDATE", async (client, d) => {
|
|
1447
|
+
client.emit(Events.VoiceServerUpdate, d);
|
|
1448
|
+
});
|
|
1449
|
+
handlers.set("MESSAGE_DELETE_BULK", async (client, d) => {
|
|
1450
|
+
client.emit(Events.MessageDeleteBulk, d);
|
|
1451
|
+
});
|
|
1452
|
+
handlers.set("GUILD_BAN_ADD", async (client, d) => {
|
|
1453
|
+
const data = d;
|
|
1454
|
+
const { GuildBan: GuildBan2 } = await Promise.resolve().then(() => (init_GuildBan(), GuildBan_exports));
|
|
1455
|
+
const ban = new GuildBan2(client, data, data.guild_id);
|
|
1456
|
+
client.emit(Events.GuildBanAdd, ban);
|
|
1457
|
+
});
|
|
1458
|
+
handlers.set("GUILD_BAN_REMOVE", async (client, d) => {
|
|
1459
|
+
const data = d;
|
|
1460
|
+
const { GuildBan: GuildBan2 } = await Promise.resolve().then(() => (init_GuildBan(), GuildBan_exports));
|
|
1461
|
+
const ban = new GuildBan2(client, { ...data, reason: null }, data.guild_id);
|
|
1462
|
+
client.emit(Events.GuildBanRemove, ban);
|
|
1463
|
+
});
|
|
1464
|
+
handlers.set("GUILD_EMOJIS_UPDATE", async (client, d) => {
|
|
1465
|
+
client.emit(Events.GuildEmojisUpdate, d);
|
|
1466
|
+
});
|
|
1467
|
+
handlers.set("GUILD_STICKERS_UPDATE", async (client, d) => {
|
|
1468
|
+
client.emit(Events.GuildStickersUpdate, d);
|
|
1469
|
+
});
|
|
1470
|
+
handlers.set("GUILD_INTEGRATIONS_UPDATE", async (client, d) => {
|
|
1471
|
+
client.emit(Events.GuildIntegrationsUpdate, d);
|
|
1472
|
+
});
|
|
1473
|
+
handlers.set("GUILD_ROLE_CREATE", async (client, d) => {
|
|
1474
|
+
const data = d;
|
|
1475
|
+
const guild = client.guilds.get(data.guild_id);
|
|
1476
|
+
if (guild) {
|
|
1477
|
+
const { Role: Role2 } = await Promise.resolve().then(() => (init_Role(), Role_exports));
|
|
1478
|
+
guild.roles.set(data.role.id, new Role2(client, data.role, guild.id));
|
|
1479
|
+
}
|
|
1480
|
+
client.emit(Events.GuildRoleCreate, data);
|
|
1481
|
+
});
|
|
1482
|
+
handlers.set("GUILD_ROLE_UPDATE", async (client, d) => {
|
|
1483
|
+
const data = d;
|
|
1484
|
+
const guild = client.guilds.get(data.guild_id);
|
|
1485
|
+
if (guild) {
|
|
1486
|
+
const { Role: Role2 } = await Promise.resolve().then(() => (init_Role(), Role_exports));
|
|
1487
|
+
guild.roles.set(data.role.id, new Role2(client, data.role, guild.id));
|
|
1488
|
+
}
|
|
1489
|
+
client.emit(Events.GuildRoleUpdate, data);
|
|
1490
|
+
});
|
|
1491
|
+
handlers.set("GUILD_ROLE_DELETE", async (client, d) => {
|
|
1492
|
+
const data = d;
|
|
1493
|
+
const guild = client.guilds.get(data.guild_id);
|
|
1494
|
+
if (guild) guild.roles.delete(data.role_id);
|
|
1495
|
+
client.emit(Events.GuildRoleDelete, data);
|
|
1496
|
+
});
|
|
1497
|
+
handlers.set("GUILD_SCHEDULED_EVENT_CREATE", async (client, d) => {
|
|
1498
|
+
client.emit(Events.GuildScheduledEventCreate, d);
|
|
1499
|
+
});
|
|
1500
|
+
handlers.set("GUILD_SCHEDULED_EVENT_UPDATE", async (client, d) => {
|
|
1501
|
+
client.emit(Events.GuildScheduledEventUpdate, d);
|
|
1502
|
+
});
|
|
1503
|
+
handlers.set("GUILD_SCHEDULED_EVENT_DELETE", async (client, d) => {
|
|
1504
|
+
client.emit(Events.GuildScheduledEventDelete, d);
|
|
1505
|
+
});
|
|
1506
|
+
handlers.set("CHANNEL_PINS_UPDATE", async (client, d) => {
|
|
1507
|
+
client.emit(Events.ChannelPinsUpdate, d);
|
|
1508
|
+
});
|
|
1509
|
+
handlers.set("INVITE_CREATE", async (client, d) => {
|
|
1510
|
+
const data = d;
|
|
1511
|
+
const { Invite: Invite2 } = await Promise.resolve().then(() => (init_Invite(), Invite_exports));
|
|
1512
|
+
client.emit(Events.InviteCreate, new Invite2(client, data));
|
|
1513
|
+
});
|
|
1514
|
+
handlers.set("INVITE_DELETE", async (client, d) => {
|
|
1515
|
+
client.emit(Events.InviteDelete, d);
|
|
1516
|
+
});
|
|
1517
|
+
handlers.set("TYPING_START", async (client, d) => {
|
|
1518
|
+
client.emit(Events.TypingStart, d);
|
|
1519
|
+
});
|
|
1520
|
+
handlers.set("USER_UPDATE", async (client, d) => {
|
|
1521
|
+
const data = d;
|
|
1522
|
+
if (client.user?.id === data.id) {
|
|
1523
|
+
client.user._patch(data);
|
|
1524
|
+
}
|
|
1525
|
+
client.emit(Events.UserUpdate, data);
|
|
1526
|
+
});
|
|
1527
|
+
handlers.set("PRESENCE_UPDATE", async (client, d) => {
|
|
1528
|
+
client.emit(Events.PresenceUpdate, d);
|
|
1529
|
+
});
|
|
1530
|
+
handlers.set("WEBHOOKS_UPDATE", async (client, d) => {
|
|
1531
|
+
client.emit(Events.WebhooksUpdate, d);
|
|
1532
|
+
});
|
|
1533
|
+
handlers.set("RESUMED", async (client) => {
|
|
1534
|
+
client.emit(Events.Resumed);
|
|
1535
|
+
});
|
|
1536
|
+
var eventHandlers = handlers;
|
|
1537
|
+
|
|
659
1538
|
// src/client/Client.ts
|
|
660
1539
|
var Client = class extends import_events.EventEmitter {
|
|
661
1540
|
/** @param options - Token, REST config, WebSocket, presence, etc. */
|
|
662
1541
|
constructor(options = {}) {
|
|
663
1542
|
super();
|
|
664
1543
|
this.options = options;
|
|
1544
|
+
Object.defineProperty(this.channels, "cache", {
|
|
1545
|
+
get: () => this.channels,
|
|
1546
|
+
configurable: true
|
|
1547
|
+
});
|
|
1548
|
+
Object.defineProperty(this.guilds, "cache", {
|
|
1549
|
+
get: () => this.guilds,
|
|
1550
|
+
configurable: true
|
|
1551
|
+
});
|
|
665
1552
|
this.rest = new import_rest.REST({
|
|
666
1553
|
api: options.rest?.api ?? "https://api.fluxer.app",
|
|
667
1554
|
version: options.rest?.version ?? "1",
|
|
@@ -669,12 +1556,77 @@ var Client = class extends import_events.EventEmitter {
|
|
|
669
1556
|
});
|
|
670
1557
|
}
|
|
671
1558
|
rest;
|
|
672
|
-
guilds = new
|
|
673
|
-
channels = new
|
|
674
|
-
users = new
|
|
1559
|
+
guilds = new GuildManager(this);
|
|
1560
|
+
channels = new ChannelManager(this);
|
|
1561
|
+
users = new import_collection5.Collection();
|
|
675
1562
|
user = null;
|
|
676
1563
|
readyAt = null;
|
|
677
1564
|
_ws = null;
|
|
1565
|
+
/**
|
|
1566
|
+
* Resolve an emoji argument to the API format (unicode or "name:id").
|
|
1567
|
+
* Supports: <:name:id>, :name:, name:id, { name, id }, unicode.
|
|
1568
|
+
* When id is missing (e.g. :name:), fetches guild emojis if guildId provided.
|
|
1569
|
+
* @param emoji - Emoji string or object
|
|
1570
|
+
* @param guildId - Guild ID for resolving custom emoji by name (required when id is missing)
|
|
1571
|
+
* @returns API-formatted string for reactions
|
|
1572
|
+
*/
|
|
1573
|
+
async resolveEmoji(emoji, guildId) {
|
|
1574
|
+
if (typeof emoji === "object" && emoji.id) {
|
|
1575
|
+
return (0, import_util2.formatEmoji)({ name: emoji.name, id: emoji.id, animated: emoji.animated });
|
|
1576
|
+
}
|
|
1577
|
+
const parsed = (0, import_util2.parseEmoji)(typeof emoji === "string" ? emoji : `:${emoji.name}:`);
|
|
1578
|
+
if (!parsed) throw new Error("Invalid emoji");
|
|
1579
|
+
if (parsed.id) return (0, import_util2.formatEmoji)(parsed);
|
|
1580
|
+
if (guildId) {
|
|
1581
|
+
const emojis = await this.rest.get(import_types11.Routes.guildEmojis(guildId));
|
|
1582
|
+
const list = Array.isArray(emojis) ? emojis : Object.values(emojis ?? {});
|
|
1583
|
+
const found = list.find((e) => e.name && e.name.toLowerCase() === parsed.name.toLowerCase());
|
|
1584
|
+
if (found) return (0, import_util2.formatEmoji)({ ...parsed, id: found.id, animated: found.animated });
|
|
1585
|
+
throw new Error(
|
|
1586
|
+
`Custom emoji ":${parsed.name}:" not found in guild. Use name:id or <:name:id> format.`
|
|
1587
|
+
);
|
|
1588
|
+
}
|
|
1589
|
+
if (/^\w+$/.test(parsed.name)) {
|
|
1590
|
+
throw new Error(
|
|
1591
|
+
`Custom emoji ":${parsed.name}:" requires guild context. Use message.react() in a guild channel, or pass guildId to client.resolveEmoji().`
|
|
1592
|
+
);
|
|
1593
|
+
}
|
|
1594
|
+
return encodeURIComponent(parsed.name);
|
|
1595
|
+
}
|
|
1596
|
+
/**
|
|
1597
|
+
* Fetch a message by channel and message ID. Use when you have IDs (e.g. from a DB).
|
|
1598
|
+
* @param channelId - Snowflake of the channel
|
|
1599
|
+
* @param messageId - Snowflake of the message
|
|
1600
|
+
* @returns The message, or null if not found
|
|
1601
|
+
* @deprecated Use channel.messages.fetch(messageId). For IDs-only: (await client.channels.fetch(channelId))?.messages?.fetch(messageId)
|
|
1602
|
+
* @example
|
|
1603
|
+
* const channel = await client.channels.fetch(channelId);
|
|
1604
|
+
* const message = await channel?.messages?.fetch(messageId);
|
|
1605
|
+
*/
|
|
1606
|
+
async fetchMessage(channelId, messageId) {
|
|
1607
|
+
return this.channels.fetchMessage(channelId, messageId);
|
|
1608
|
+
}
|
|
1609
|
+
/**
|
|
1610
|
+
* Send a message to any channel by ID. Shorthand for client.channels.send().
|
|
1611
|
+
* Works even when the channel is not cached.
|
|
1612
|
+
*/
|
|
1613
|
+
async sendToChannel(channelId, payload) {
|
|
1614
|
+
return this.channels.send(channelId, payload);
|
|
1615
|
+
}
|
|
1616
|
+
/**
|
|
1617
|
+
* Get or create a User from API data. Caches in client.users.
|
|
1618
|
+
* Updates existing user's username, avatar, etc. when fresh data is provided.
|
|
1619
|
+
*/
|
|
1620
|
+
getOrCreateUser(data) {
|
|
1621
|
+
const existing = this.users.get(data.id);
|
|
1622
|
+
if (existing) {
|
|
1623
|
+
existing._patch(data);
|
|
1624
|
+
return existing;
|
|
1625
|
+
}
|
|
1626
|
+
const user = new User(this, data);
|
|
1627
|
+
this.users.set(user.id, user);
|
|
1628
|
+
return user;
|
|
1629
|
+
}
|
|
678
1630
|
/** WebSocket manager. Throws if not logged in. */
|
|
679
1631
|
get ws() {
|
|
680
1632
|
if (!this._ws) throw new Error("Client is not logged in");
|
|
@@ -692,145 +1644,8 @@ var Client = class extends import_events.EventEmitter {
|
|
|
692
1644
|
if (payload.op !== 0 || !payload.t) return;
|
|
693
1645
|
const { t: event, d } = payload;
|
|
694
1646
|
try {
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
const { Message: Message2 } = await Promise.resolve().then(() => (init_Message(), Message_exports));
|
|
698
|
-
this.emit(Events.MessageCreate, new Message2(this, d));
|
|
699
|
-
break;
|
|
700
|
-
}
|
|
701
|
-
case "MESSAGE_UPDATE": {
|
|
702
|
-
const { Message: Message2 } = await Promise.resolve().then(() => (init_Message(), Message_exports));
|
|
703
|
-
this.emit(Events.MessageUpdate, null, new Message2(this, d));
|
|
704
|
-
break;
|
|
705
|
-
}
|
|
706
|
-
case "MESSAGE_DELETE":
|
|
707
|
-
this.emit(Events.MessageDelete, { id: d.id, channelId: d.channel_id });
|
|
708
|
-
break;
|
|
709
|
-
case "MESSAGE_REACTION_ADD":
|
|
710
|
-
this.emit(Events.MessageReactionAdd, d);
|
|
711
|
-
break;
|
|
712
|
-
case "MESSAGE_REACTION_REMOVE":
|
|
713
|
-
this.emit(Events.MessageReactionRemove, d);
|
|
714
|
-
break;
|
|
715
|
-
case "MESSAGE_REACTION_REMOVE_ALL":
|
|
716
|
-
this.emit(Events.MessageReactionRemoveAll, d);
|
|
717
|
-
break;
|
|
718
|
-
case "MESSAGE_REACTION_REMOVE_EMOJI":
|
|
719
|
-
this.emit(Events.MessageReactionRemoveEmoji, d);
|
|
720
|
-
break;
|
|
721
|
-
case "GUILD_CREATE": {
|
|
722
|
-
const { Guild: Guild2 } = await Promise.resolve().then(() => (init_Guild(), Guild_exports));
|
|
723
|
-
const { Channel: Channel2 } = await Promise.resolve().then(() => (init_Channel(), Channel_exports));
|
|
724
|
-
const guild = new Guild2(this, d);
|
|
725
|
-
this.guilds.set(guild.id, guild);
|
|
726
|
-
const g = d;
|
|
727
|
-
for (const ch of g.channels ?? []) {
|
|
728
|
-
const channel = Channel2.from(this, ch);
|
|
729
|
-
if (channel) this.channels.set(channel.id, channel);
|
|
730
|
-
}
|
|
731
|
-
this.emit(Events.GuildCreate, guild);
|
|
732
|
-
if (g.voice_states?.length) {
|
|
733
|
-
this.emit(Events.VoiceStatesSync, { guildId: guild.id, voiceStates: g.voice_states });
|
|
734
|
-
}
|
|
735
|
-
break;
|
|
736
|
-
}
|
|
737
|
-
case "GUILD_UPDATE": {
|
|
738
|
-
const { Guild: Guild2 } = await Promise.resolve().then(() => (init_Guild(), Guild_exports));
|
|
739
|
-
const g = d;
|
|
740
|
-
const old = this.guilds.get(g.id);
|
|
741
|
-
const updated = new Guild2(this, g);
|
|
742
|
-
this.guilds.set(updated.id, updated);
|
|
743
|
-
this.emit(Events.GuildUpdate, old ?? updated, updated);
|
|
744
|
-
break;
|
|
745
|
-
}
|
|
746
|
-
case "GUILD_DELETE": {
|
|
747
|
-
const g = d;
|
|
748
|
-
const guild = this.guilds.get(g.id);
|
|
749
|
-
if (guild) {
|
|
750
|
-
this.guilds.delete(g.id);
|
|
751
|
-
this.emit(Events.GuildDelete, guild);
|
|
752
|
-
}
|
|
753
|
-
break;
|
|
754
|
-
}
|
|
755
|
-
case "CHANNEL_CREATE": {
|
|
756
|
-
const { Channel: Channel2 } = await Promise.resolve().then(() => (init_Channel(), Channel_exports));
|
|
757
|
-
const ch = Channel2.from(this, d);
|
|
758
|
-
if (ch) {
|
|
759
|
-
this.channels.set(ch.id, ch);
|
|
760
|
-
this.emit(Events.ChannelCreate, ch);
|
|
761
|
-
}
|
|
762
|
-
break;
|
|
763
|
-
}
|
|
764
|
-
case "CHANNEL_UPDATE": {
|
|
765
|
-
const { Channel: Channel2 } = await Promise.resolve().then(() => (init_Channel(), Channel_exports));
|
|
766
|
-
const ch = d;
|
|
767
|
-
const oldCh = this.channels.get(ch.id);
|
|
768
|
-
const newCh = Channel2.from(this, ch);
|
|
769
|
-
if (newCh) {
|
|
770
|
-
this.channels.set(newCh.id, newCh);
|
|
771
|
-
this.emit(Events.ChannelUpdate, oldCh ?? newCh, newCh);
|
|
772
|
-
}
|
|
773
|
-
break;
|
|
774
|
-
}
|
|
775
|
-
case "CHANNEL_DELETE": {
|
|
776
|
-
const ch = d;
|
|
777
|
-
const channel = this.channels.get(ch.id);
|
|
778
|
-
if (channel) {
|
|
779
|
-
this.channels.delete(ch.id);
|
|
780
|
-
this.emit(Events.ChannelDelete, channel);
|
|
781
|
-
}
|
|
782
|
-
break;
|
|
783
|
-
}
|
|
784
|
-
case "GUILD_MEMBER_ADD": {
|
|
785
|
-
const { GuildMember: GuildMember2 } = await Promise.resolve().then(() => (init_GuildMember(), GuildMember_exports));
|
|
786
|
-
const data = d;
|
|
787
|
-
const guild = this.guilds.get(data.guild_id);
|
|
788
|
-
if (guild) {
|
|
789
|
-
const member = new GuildMember2(this, data, guild);
|
|
790
|
-
guild.members.set(member.id, member);
|
|
791
|
-
this.emit(Events.GuildMemberAdd, member);
|
|
792
|
-
}
|
|
793
|
-
break;
|
|
794
|
-
}
|
|
795
|
-
case "GUILD_MEMBER_UPDATE": {
|
|
796
|
-
const { GuildMember: GuildMember2 } = await Promise.resolve().then(() => (init_GuildMember(), GuildMember_exports));
|
|
797
|
-
const data = d;
|
|
798
|
-
const guild = this.guilds.get(data.guild_id);
|
|
799
|
-
if (guild) {
|
|
800
|
-
const oldM = guild.members.get(data.user.id);
|
|
801
|
-
const newM = new GuildMember2(this, data, guild);
|
|
802
|
-
guild.members.set(newM.id, newM);
|
|
803
|
-
this.emit(Events.GuildMemberUpdate, oldM ?? newM, newM);
|
|
804
|
-
}
|
|
805
|
-
break;
|
|
806
|
-
}
|
|
807
|
-
case "GUILD_MEMBER_REMOVE": {
|
|
808
|
-
const data = d;
|
|
809
|
-
const guild = this.guilds.get(data.guild_id);
|
|
810
|
-
if (guild) {
|
|
811
|
-
const member = guild.members.get(data.user.id);
|
|
812
|
-
if (member) {
|
|
813
|
-
guild.members.delete(data.user.id);
|
|
814
|
-
this.emit(Events.GuildMemberRemove, member);
|
|
815
|
-
}
|
|
816
|
-
}
|
|
817
|
-
break;
|
|
818
|
-
}
|
|
819
|
-
case "INTERACTION_CREATE": {
|
|
820
|
-
this.emit(Events.InteractionCreate, d);
|
|
821
|
-
break;
|
|
822
|
-
}
|
|
823
|
-
case "VOICE_STATE_UPDATE": {
|
|
824
|
-
this.emit(Events.VoiceStateUpdate, d);
|
|
825
|
-
break;
|
|
826
|
-
}
|
|
827
|
-
case "VOICE_SERVER_UPDATE": {
|
|
828
|
-
this.emit(Events.VoiceServerUpdate, d);
|
|
829
|
-
break;
|
|
830
|
-
}
|
|
831
|
-
default:
|
|
832
|
-
break;
|
|
833
|
-
}
|
|
1647
|
+
const handler = eventHandlers.get(event);
|
|
1648
|
+
if (handler) await handler(this, d);
|
|
834
1649
|
} catch (err) {
|
|
835
1650
|
this.emit(Events.Error, err instanceof Error ? err : new Error(String(err)));
|
|
836
1651
|
}
|
|
@@ -840,14 +1655,16 @@ var Client = class extends import_events.EventEmitter {
|
|
|
840
1655
|
* @param token - Bot token (e.g. from FLUXER_BOT_TOKEN)
|
|
841
1656
|
*/
|
|
842
1657
|
async login(token) {
|
|
1658
|
+
if (this._ws) {
|
|
1659
|
+
throw new FluxerError("Client is already logged in. Call destroy() first.");
|
|
1660
|
+
}
|
|
843
1661
|
this.rest.setToken(token);
|
|
844
1662
|
let intents = this.options.intents ?? 0;
|
|
845
1663
|
if (intents !== 0) {
|
|
846
1664
|
if (typeof process !== "undefined" && process.emitWarning) {
|
|
847
|
-
process.emitWarning(
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
);
|
|
1665
|
+
process.emitWarning("Fluxer does not support intents yet. Value has been set to 0.", {
|
|
1666
|
+
type: "FluxerIntents"
|
|
1667
|
+
});
|
|
851
1668
|
} else {
|
|
852
1669
|
console.warn("Fluxer does not support intents yet. Value has been set to 0.");
|
|
853
1670
|
}
|
|
@@ -862,28 +1679,38 @@ var Client = class extends import_events.EventEmitter {
|
|
|
862
1679
|
WebSocket: this.options.WebSocket
|
|
863
1680
|
});
|
|
864
1681
|
this._ws.on("dispatch", ({ payload }) => {
|
|
865
|
-
this.handleDispatch(payload)
|
|
1682
|
+
this.handleDispatch(payload).catch(
|
|
1683
|
+
(err) => this.emit(Events.Error, err instanceof Error ? err : new Error(String(err)))
|
|
1684
|
+
);
|
|
866
1685
|
});
|
|
867
|
-
this._ws.on(
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
const
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
for (const
|
|
877
|
-
const
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
1686
|
+
this._ws.on(
|
|
1687
|
+
"ready",
|
|
1688
|
+
async ({
|
|
1689
|
+
data
|
|
1690
|
+
}) => {
|
|
1691
|
+
const { ClientUser: ClientUser2 } = await Promise.resolve().then(() => (init_ClientUser(), ClientUser_exports));
|
|
1692
|
+
const { Guild: Guild2 } = await Promise.resolve().then(() => (init_Guild(), Guild_exports));
|
|
1693
|
+
const { Channel: Channel2 } = await Promise.resolve().then(() => (init_Channel(), Channel_exports));
|
|
1694
|
+
this.user = new ClientUser2(this, data.user);
|
|
1695
|
+
for (const g of data.guilds ?? []) {
|
|
1696
|
+
const guild = new Guild2(this, g);
|
|
1697
|
+
this.guilds.set(guild.id, guild);
|
|
1698
|
+
const withCh = g;
|
|
1699
|
+
for (const ch of withCh.channels ?? []) {
|
|
1700
|
+
const channel = Channel2.from(this, ch);
|
|
1701
|
+
if (channel) this.channels.set(channel.id, channel);
|
|
1702
|
+
}
|
|
1703
|
+
if (withCh.voice_states?.length) {
|
|
1704
|
+
this.emit(Events.VoiceStatesSync, {
|
|
1705
|
+
guildId: guild.id,
|
|
1706
|
+
voiceStates: withCh.voice_states
|
|
1707
|
+
});
|
|
1708
|
+
}
|
|
882
1709
|
}
|
|
1710
|
+
this.readyAt = /* @__PURE__ */ new Date();
|
|
1711
|
+
this.emit(Events.Ready);
|
|
883
1712
|
}
|
|
884
|
-
|
|
885
|
-
this.emit(Events.Ready);
|
|
886
|
-
});
|
|
1713
|
+
);
|
|
887
1714
|
this._ws.on("error", ({ error }) => this.emit(Events.Error, error));
|
|
888
1715
|
this._ws.on("debug", (msg) => this.emit(Events.Debug, msg));
|
|
889
1716
|
await this._ws.connect();
|
|
@@ -907,26 +1734,120 @@ var Client = class extends import_events.EventEmitter {
|
|
|
907
1734
|
return this.readyAt !== null && this.user !== null;
|
|
908
1735
|
}
|
|
909
1736
|
static get Routes() {
|
|
910
|
-
return
|
|
1737
|
+
return import_types11.Routes;
|
|
911
1738
|
}
|
|
912
1739
|
};
|
|
913
1740
|
|
|
914
1741
|
// src/index.ts
|
|
1742
|
+
init_MessageManager();
|
|
915
1743
|
init_ClientUser();
|
|
916
1744
|
init_Base();
|
|
917
1745
|
init_User();
|
|
918
1746
|
init_Guild();
|
|
919
1747
|
init_Channel();
|
|
920
1748
|
init_Message();
|
|
1749
|
+
init_MessageReaction();
|
|
921
1750
|
init_Webhook();
|
|
922
1751
|
init_GuildMember();
|
|
1752
|
+
init_Role();
|
|
1753
|
+
init_Invite();
|
|
1754
|
+
init_GuildBan();
|
|
923
1755
|
|
|
924
|
-
// src/
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
1756
|
+
// src/structures/GuildEmoji.ts
|
|
1757
|
+
init_Base();
|
|
1758
|
+
var import_types12 = require("@fluxerjs/types");
|
|
1759
|
+
init_Constants();
|
|
1760
|
+
var GuildEmoji = class extends Base {
|
|
1761
|
+
client;
|
|
1762
|
+
id;
|
|
1763
|
+
guildId;
|
|
1764
|
+
name;
|
|
1765
|
+
animated;
|
|
1766
|
+
/** @param data - API emoji from GET /guilds/{id}/emojis or guild emoji events */
|
|
1767
|
+
constructor(client, data, guildId) {
|
|
1768
|
+
super();
|
|
1769
|
+
this.client = client;
|
|
1770
|
+
this.id = data.id;
|
|
1771
|
+
this.guildId = data.guild_id ?? guildId;
|
|
1772
|
+
this.name = data.name;
|
|
1773
|
+
this.animated = data.animated ?? false;
|
|
1774
|
+
}
|
|
1775
|
+
/** CDN URL for this emoji image. */
|
|
1776
|
+
get url() {
|
|
1777
|
+
const ext = this.animated ? "gif" : "png";
|
|
1778
|
+
return `${CDN_URL}/emojis/${this.id}.${ext}`;
|
|
1779
|
+
}
|
|
1780
|
+
/** Emoji identifier for use in reactions: `name:id` */
|
|
1781
|
+
get identifier() {
|
|
1782
|
+
return `${this.name}:${this.id}`;
|
|
1783
|
+
}
|
|
1784
|
+
/** Delete this emoji. Requires Manage Emojis and Stickers permission. */
|
|
1785
|
+
async delete() {
|
|
1786
|
+
await this.client.rest.delete(import_types12.Routes.guildEmoji(this.guildId, this.id), {
|
|
1787
|
+
auth: true
|
|
1788
|
+
});
|
|
1789
|
+
}
|
|
1790
|
+
/**
|
|
1791
|
+
* Edit this emoji's name.
|
|
1792
|
+
* Requires Manage Emojis and Stickers permission.
|
|
1793
|
+
*/
|
|
1794
|
+
async edit(options) {
|
|
1795
|
+
const data = await this.client.rest.patch(import_types12.Routes.guildEmoji(this.guildId, this.id), {
|
|
1796
|
+
body: options,
|
|
1797
|
+
auth: true
|
|
1798
|
+
});
|
|
1799
|
+
this.name = data.name;
|
|
1800
|
+
return this;
|
|
1801
|
+
}
|
|
1802
|
+
};
|
|
1803
|
+
|
|
1804
|
+
// src/structures/GuildSticker.ts
|
|
1805
|
+
init_Base();
|
|
1806
|
+
var import_types13 = require("@fluxerjs/types");
|
|
1807
|
+
init_Constants();
|
|
1808
|
+
var GuildSticker = class extends Base {
|
|
1809
|
+
client;
|
|
1810
|
+
id;
|
|
1811
|
+
guildId;
|
|
1812
|
+
name;
|
|
1813
|
+
description;
|
|
1814
|
+
tags;
|
|
1815
|
+
animated;
|
|
1816
|
+
/** @param data - API sticker from GET /guilds/{id}/stickers or guild sticker events */
|
|
1817
|
+
constructor(client, data, guildId) {
|
|
1818
|
+
super();
|
|
1819
|
+
this.client = client;
|
|
1820
|
+
this.id = data.id;
|
|
1821
|
+
this.guildId = data.guild_id ?? guildId;
|
|
1822
|
+
this.name = data.name;
|
|
1823
|
+
this.description = data.description ?? "";
|
|
1824
|
+
this.tags = data.tags ?? [];
|
|
1825
|
+
this.animated = data.animated ?? false;
|
|
1826
|
+
}
|
|
1827
|
+
/** CDN URL for this sticker image. */
|
|
1828
|
+
get url() {
|
|
1829
|
+
const ext = this.animated ? "gif" : "png";
|
|
1830
|
+
return `${CDN_URL}/stickers/${this.id}.${ext}`;
|
|
1831
|
+
}
|
|
1832
|
+
/** Delete this sticker. Requires Manage Emojis and Stickers permission. */
|
|
1833
|
+
async delete() {
|
|
1834
|
+
await this.client.rest.delete(import_types13.Routes.guildSticker(this.guildId, this.id), {
|
|
1835
|
+
auth: true
|
|
1836
|
+
});
|
|
1837
|
+
}
|
|
1838
|
+
/**
|
|
1839
|
+
* Edit this sticker's name and/or description.
|
|
1840
|
+
* Requires Manage Emojis and Stickers permission.
|
|
1841
|
+
*/
|
|
1842
|
+
async edit(options) {
|
|
1843
|
+
const data = await this.client.rest.patch(import_types13.Routes.guildSticker(this.guildId, this.id), {
|
|
1844
|
+
body: options,
|
|
1845
|
+
auth: true
|
|
1846
|
+
});
|
|
1847
|
+
const s = data;
|
|
1848
|
+
this.name = s.name;
|
|
1849
|
+
this.description = s.description ?? "";
|
|
1850
|
+
return this;
|
|
930
1851
|
}
|
|
931
1852
|
};
|
|
932
1853
|
|
|
@@ -938,13 +1859,14 @@ var ErrorCodes = {
|
|
|
938
1859
|
|
|
939
1860
|
// src/index.ts
|
|
940
1861
|
var import_builders2 = require("@fluxerjs/builders");
|
|
941
|
-
var
|
|
1862
|
+
var import_types14 = require("@fluxerjs/types");
|
|
942
1863
|
// Annotate the CommonJS export names for ESM import in node:
|
|
943
1864
|
0 && (module.exports = {
|
|
944
1865
|
AttachmentBuilder,
|
|
945
1866
|
Base,
|
|
946
1867
|
CategoryChannel,
|
|
947
1868
|
Channel,
|
|
1869
|
+
ChannelManager,
|
|
948
1870
|
Client,
|
|
949
1871
|
ClientUser,
|
|
950
1872
|
DMChannel,
|
|
@@ -954,11 +1876,18 @@ var import_types8 = require("@fluxerjs/types");
|
|
|
954
1876
|
FluxerError,
|
|
955
1877
|
GatewayOpcodes,
|
|
956
1878
|
Guild,
|
|
1879
|
+
GuildBan,
|
|
957
1880
|
GuildChannel,
|
|
1881
|
+
GuildEmoji,
|
|
958
1882
|
GuildMember,
|
|
1883
|
+
GuildSticker,
|
|
1884
|
+
Invite,
|
|
959
1885
|
LinkChannel,
|
|
960
1886
|
Message,
|
|
1887
|
+
MessageManager,
|
|
961
1888
|
MessagePayload,
|
|
1889
|
+
MessageReaction,
|
|
1890
|
+
Role,
|
|
962
1891
|
Routes,
|
|
963
1892
|
TextChannel,
|
|
964
1893
|
User,
|