@fluxerjs/core 1.1.5 → 1.1.6
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-HBKXUNL5.mjs → Channel-L6UE2MAF.mjs} +1 -1
- package/dist/{ClientUser-RXOB6K6C.mjs → ClientUser-5KQNQHUB.mjs} +1 -1
- package/dist/{Guild-3ETPHHF5.mjs → Guild-NNMSFIA6.mjs} +2 -2
- package/dist/GuildEmoji-SOGQ4C32.mjs +8 -0
- package/dist/{GuildMember-43B5E5CH.mjs → GuildMember-F5FZJOHD.mjs} +1 -1
- package/dist/GuildSticker-3QYT6ZIY.mjs +8 -0
- package/dist/{Message-DXBXIQIJ.mjs → Message-QNWAPT55.mjs} +1 -1
- package/dist/{MessageReaction-NIAHV3EM.mjs → MessageReaction-MFK2N3AD.mjs} +1 -1
- package/dist/{Webhook-WIF6OGPA.mjs → Webhook-IWPKKMWD.mjs} +1 -1
- package/dist/{chunk-FSXTONUR.mjs → chunk-2245SAIA.mjs} +1 -1
- package/dist/{chunk-VZPN7FNH.mjs → chunk-4OEOU7G7.mjs} +11 -0
- package/dist/{chunk-DUQAD7F6.mjs → chunk-5JEDVRKU.mjs} +20 -0
- package/dist/chunk-5QRROWJS.mjs +56 -0
- package/dist/{chunk-E6SU3TR5.mjs → chunk-B6F5LWNS.mjs} +1 -1
- package/dist/{chunk-NNZUZLG3.mjs → chunk-EUKEYW72.mjs} +87 -7
- package/dist/{chunk-CREI4MOS.mjs → chunk-FVZY7IZ4.mjs} +190 -21
- package/dist/chunk-KUMLJGXY.mjs +58 -0
- package/dist/{chunk-4S42USSG.mjs → chunk-USHLLE7C.mjs} +2 -2
- package/dist/index.d.mts +246 -54
- package/dist/index.d.ts +246 -54
- package/dist/index.js +510 -188
- package/dist/index.mjs +58 -126
- package/package.json +7 -7
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Guild
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-FVZY7IZ4.mjs";
|
|
4
4
|
import "./chunk-PU73YRKJ.mjs";
|
|
5
|
-
import "./chunk-
|
|
5
|
+
import "./chunk-5JEDVRKU.mjs";
|
|
6
6
|
import "./chunk-X6K3ZD62.mjs";
|
|
7
7
|
import "./chunk-HQMYRYMY.mjs";
|
|
8
8
|
import "./chunk-2ZSMLDEI.mjs";
|
|
@@ -107,7 +107,7 @@ var Webhook = class _Webhook extends Base {
|
|
|
107
107
|
postOptions
|
|
108
108
|
);
|
|
109
109
|
if (wait && data) {
|
|
110
|
-
const { Message } = await import("./Message-
|
|
110
|
+
const { Message } = await import("./Message-QNWAPT55.mjs");
|
|
111
111
|
return new Message(this.client, data);
|
|
112
112
|
}
|
|
113
113
|
return void 0;
|
|
@@ -228,6 +228,17 @@ var Message = class _Message extends Base {
|
|
|
228
228
|
async delete() {
|
|
229
229
|
await this.client.rest.delete(Routes.channelMessage(this.channelId, this.id));
|
|
230
230
|
}
|
|
231
|
+
/**
|
|
232
|
+
* Delete a specific attachment from this message.
|
|
233
|
+
* DELETE /channels/{id}/messages/{id}/attachments/{attachmentId}.
|
|
234
|
+
*/
|
|
235
|
+
async deleteAttachment(attachmentId) {
|
|
236
|
+
await this.client.rest.delete(
|
|
237
|
+
Routes.channelMessageAttachment(this.channelId, this.id, attachmentId),
|
|
238
|
+
{ auth: true }
|
|
239
|
+
);
|
|
240
|
+
this.attachments.delete(attachmentId);
|
|
241
|
+
}
|
|
231
242
|
/** Pin this message to the channel. Requires Manage Messages permission. */
|
|
232
243
|
async pin() {
|
|
233
244
|
await this.client.rest.put(Routes.channelPinMessage(this.channelId, this.id));
|
|
@@ -106,6 +106,26 @@ var GuildMember = class extends Base {
|
|
|
106
106
|
async removeRole(roleId) {
|
|
107
107
|
await this.client.rest.delete(Routes.guildMemberRole(this.guild.id, this.id, roleId));
|
|
108
108
|
}
|
|
109
|
+
/**
|
|
110
|
+
* Edit this guild member. PATCH /guilds/{id}/members/{userId} or /members/@me for the bot.
|
|
111
|
+
* For @me: nick, avatar, banner, bio, pronouns, accent_color, profile_flags, mute, deaf,
|
|
112
|
+
* communication_disabled_until, timeout_reason, channel_id, connection_id.
|
|
113
|
+
* For other members: same plus roles (array of role IDs).
|
|
114
|
+
*/
|
|
115
|
+
async edit(options) {
|
|
116
|
+
const isMe = this.client.user?.id === this.id;
|
|
117
|
+
const route = isMe ? `/guilds/${this.guild.id}/members/@me` : Routes.guildMember(this.guild.id, this.id);
|
|
118
|
+
const data = await this.client.rest.patch(route, {
|
|
119
|
+
body: options,
|
|
120
|
+
auth: true
|
|
121
|
+
});
|
|
122
|
+
this.nick = data.nick ?? this.nick;
|
|
123
|
+
if (data.roles) this.roles = data.roles;
|
|
124
|
+
if (data.communication_disabled_until != null) {
|
|
125
|
+
this.communicationDisabledUntil = data.communication_disabled_until ? new Date(data.communication_disabled_until) : null;
|
|
126
|
+
}
|
|
127
|
+
return this;
|
|
128
|
+
}
|
|
109
129
|
/**
|
|
110
130
|
* Get the member's guild-level permissions (from roles only, no channel overwrites).
|
|
111
131
|
* Use this for server-wide permission checks (e.g. ban, kick, manage roles).
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CDN_URL
|
|
3
|
+
} from "./chunk-HQMYRYMY.mjs";
|
|
4
|
+
import {
|
|
5
|
+
Base
|
|
6
|
+
} from "./chunk-XNS4O6QJ.mjs";
|
|
7
|
+
|
|
8
|
+
// src/structures/GuildEmoji.ts
|
|
9
|
+
import { Routes } from "@fluxerjs/types";
|
|
10
|
+
var GuildEmoji = class extends Base {
|
|
11
|
+
client;
|
|
12
|
+
id;
|
|
13
|
+
guildId;
|
|
14
|
+
name;
|
|
15
|
+
animated;
|
|
16
|
+
/** @param data - API emoji from GET /guilds/{id}/emojis or guild emoji events */
|
|
17
|
+
constructor(client, data, guildId) {
|
|
18
|
+
super();
|
|
19
|
+
this.client = client;
|
|
20
|
+
this.id = data.id;
|
|
21
|
+
this.guildId = data.guild_id ?? guildId;
|
|
22
|
+
this.name = data.name;
|
|
23
|
+
this.animated = data.animated ?? false;
|
|
24
|
+
}
|
|
25
|
+
/** CDN URL for this emoji image. */
|
|
26
|
+
get url() {
|
|
27
|
+
const ext = this.animated ? "gif" : "png";
|
|
28
|
+
return `${CDN_URL}/emojis/${this.id}.${ext}`;
|
|
29
|
+
}
|
|
30
|
+
/** Emoji identifier for use in reactions: `name:id` */
|
|
31
|
+
get identifier() {
|
|
32
|
+
return `${this.name}:${this.id}`;
|
|
33
|
+
}
|
|
34
|
+
/** Delete this emoji. Requires Manage Emojis and Stickers permission. */
|
|
35
|
+
async delete() {
|
|
36
|
+
await this.client.rest.delete(Routes.guildEmoji(this.guildId, this.id), {
|
|
37
|
+
auth: true
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Edit this emoji's name.
|
|
42
|
+
* Requires Manage Emojis and Stickers permission.
|
|
43
|
+
*/
|
|
44
|
+
async edit(options) {
|
|
45
|
+
const data = await this.client.rest.patch(Routes.guildEmoji(this.guildId, this.id), {
|
|
46
|
+
body: options,
|
|
47
|
+
auth: true
|
|
48
|
+
});
|
|
49
|
+
this.name = data.name;
|
|
50
|
+
return this;
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export {
|
|
55
|
+
GuildEmoji
|
|
56
|
+
};
|
|
@@ -41,7 +41,7 @@ var MessageReaction = class extends Base {
|
|
|
41
41
|
*/
|
|
42
42
|
async fetchMessage() {
|
|
43
43
|
try {
|
|
44
|
-
const { Message } = await import("./Message-
|
|
44
|
+
const { Message } = await import("./Message-QNWAPT55.mjs");
|
|
45
45
|
const data = await this.client.rest.get(
|
|
46
46
|
Routes.channelMessage(this.channelId, this.messageId)
|
|
47
47
|
);
|
|
@@ -29,7 +29,7 @@ var MessageManager = class {
|
|
|
29
29
|
*/
|
|
30
30
|
async fetch(messageId) {
|
|
31
31
|
try {
|
|
32
|
-
const { Message } = await import("./Message-
|
|
32
|
+
const { Message } = await import("./Message-QNWAPT55.mjs");
|
|
33
33
|
const data = await this.client.rest.get(
|
|
34
34
|
Routes.channelMessage(this.channelId, messageId)
|
|
35
35
|
);
|
|
@@ -200,7 +200,7 @@ var GuildChannel = class extends Channel {
|
|
|
200
200
|
* @returns The webhook with token (required for send()). Requires Manage Webhooks permission.
|
|
201
201
|
*/
|
|
202
202
|
async createWebhook(options) {
|
|
203
|
-
const { Webhook } = await import("./Webhook-
|
|
203
|
+
const { Webhook } = await import("./Webhook-IWPKKMWD.mjs");
|
|
204
204
|
const data = await this.client.rest.post(Routes2.channelWebhooks(this.id), {
|
|
205
205
|
body: options,
|
|
206
206
|
auth: true
|
|
@@ -212,7 +212,7 @@ var GuildChannel = class extends Channel {
|
|
|
212
212
|
* @returns Webhooks (includes token when listing from channel; can send via send())
|
|
213
213
|
*/
|
|
214
214
|
async fetchWebhooks() {
|
|
215
|
-
const { Webhook } = await import("./Webhook-
|
|
215
|
+
const { Webhook } = await import("./Webhook-IWPKKMWD.mjs");
|
|
216
216
|
const data = await this.client.rest.get(Routes2.channelWebhooks(this.id));
|
|
217
217
|
const list = Array.isArray(data) ? data : Object.values(data ?? {});
|
|
218
218
|
return list.map((w) => new Webhook(this.client, w));
|
|
@@ -245,6 +245,66 @@ var GuildChannel = class extends Channel {
|
|
|
245
245
|
const list = Array.isArray(data) ? data : Object.values(data ?? {});
|
|
246
246
|
return list.map((i) => new Invite(this.client, i));
|
|
247
247
|
}
|
|
248
|
+
/**
|
|
249
|
+
* Set or update a permission overwrite. PUT /channels/{id}/permissions/{overwriteId}.
|
|
250
|
+
* @param overwriteId - Role or member ID
|
|
251
|
+
* @param options - type (0=role, 1=member), allow, deny (permission bitfields)
|
|
252
|
+
*/
|
|
253
|
+
async editPermission(overwriteId, options) {
|
|
254
|
+
await this.client.rest.put(Routes2.channelPermission(this.id, overwriteId), {
|
|
255
|
+
body: options,
|
|
256
|
+
auth: true
|
|
257
|
+
});
|
|
258
|
+
const idx = this.permissionOverwrites.findIndex((o) => o.id === overwriteId);
|
|
259
|
+
const entry = {
|
|
260
|
+
id: overwriteId,
|
|
261
|
+
type: options.type,
|
|
262
|
+
allow: options.allow ?? "0",
|
|
263
|
+
deny: options.deny ?? "0"
|
|
264
|
+
};
|
|
265
|
+
if (idx >= 0) this.permissionOverwrites[idx] = entry;
|
|
266
|
+
else this.permissionOverwrites.push(entry);
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* Remove a permission overwrite. DELETE /channels/{id}/permissions/{overwriteId}.
|
|
270
|
+
*/
|
|
271
|
+
async deletePermission(overwriteId) {
|
|
272
|
+
await this.client.rest.delete(Routes2.channelPermission(this.id, overwriteId), { auth: true });
|
|
273
|
+
const idx = this.permissionOverwrites.findIndex((o) => o.id === overwriteId);
|
|
274
|
+
if (idx >= 0) this.permissionOverwrites.splice(idx, 1);
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* Edit this channel. PATCH /channels/{id}.
|
|
278
|
+
* Requires Manage Channel permission.
|
|
279
|
+
*/
|
|
280
|
+
async edit(options) {
|
|
281
|
+
const data = await this.client.rest.patch(Routes2.channel(this.id), {
|
|
282
|
+
body: options,
|
|
283
|
+
auth: true
|
|
284
|
+
});
|
|
285
|
+
this.name = data.name ?? this.name;
|
|
286
|
+
this.parentId = data.parent_id ?? this.parentId;
|
|
287
|
+
this.permissionOverwrites = data.permission_overwrites ?? this.permissionOverwrites;
|
|
288
|
+
const self = this;
|
|
289
|
+
if ("topic" in self && "topic" in data) self.topic = data.topic ?? null;
|
|
290
|
+
if ("nsfw" in self && "nsfw" in data) self.nsfw = data.nsfw ?? false;
|
|
291
|
+
if ("rate_limit_per_user" in data) self.rateLimitPerUser = data.rate_limit_per_user ?? 0;
|
|
292
|
+
if ("bitrate" in self && "bitrate" in data) self.bitrate = data.bitrate ?? null;
|
|
293
|
+
if ("user_limit" in data) self.userLimit = data.user_limit ?? null;
|
|
294
|
+
if ("rtc_region" in data) self.rtcRegion = data.rtc_region ?? null;
|
|
295
|
+
return this;
|
|
296
|
+
}
|
|
297
|
+
/**
|
|
298
|
+
* Delete this channel. Requires Manage Channel permission.
|
|
299
|
+
* @param options - silent: if true, does not send a system message (default false)
|
|
300
|
+
*/
|
|
301
|
+
async delete(options) {
|
|
302
|
+
const url = Routes2.channel(this.id) + (options?.silent ? "?silent=true" : "");
|
|
303
|
+
await this.client.rest.delete(url, { auth: true });
|
|
304
|
+
this.client.channels.delete(this.id);
|
|
305
|
+
const guild = this.client.guilds.get(this.guildId);
|
|
306
|
+
if (guild) guild.channels.delete(this.id);
|
|
307
|
+
}
|
|
248
308
|
};
|
|
249
309
|
var TextChannel = class extends GuildChannel {
|
|
250
310
|
topic;
|
|
@@ -265,7 +325,7 @@ var TextChannel = class extends GuildChannel {
|
|
|
265
325
|
async send(options) {
|
|
266
326
|
const opts = typeof options === "string" ? { content: options } : options;
|
|
267
327
|
const body = buildSendBody(options);
|
|
268
|
-
const { Message } = await import("./Message-
|
|
328
|
+
const { Message } = await import("./Message-QNWAPT55.mjs");
|
|
269
329
|
const files = opts.files?.length ? await resolveMessageFiles(opts.files) : void 0;
|
|
270
330
|
const postOptions = files?.length ? { body, files } : { body };
|
|
271
331
|
const data = await this.client.rest.post(Routes2.channelMessages(this.id), postOptions);
|
|
@@ -292,7 +352,7 @@ var TextChannel = class extends GuildChannel {
|
|
|
292
352
|
* @returns Pinned messages
|
|
293
353
|
*/
|
|
294
354
|
async fetchPinnedMessages() {
|
|
295
|
-
const { Message } = await import("./Message-
|
|
355
|
+
const { Message } = await import("./Message-QNWAPT55.mjs");
|
|
296
356
|
const data = await this.client.rest.get(Routes2.channelPins(this.id));
|
|
297
357
|
const list = Array.isArray(data) ? data : data?.items ?? [];
|
|
298
358
|
return list.map((item) => {
|
|
@@ -358,7 +418,7 @@ var DMChannel = class extends Channel {
|
|
|
358
418
|
async send(options) {
|
|
359
419
|
const opts = typeof options === "string" ? { content: options } : options;
|
|
360
420
|
const body = buildSendBody(options);
|
|
361
|
-
const { Message } = await import("./Message-
|
|
421
|
+
const { Message } = await import("./Message-QNWAPT55.mjs");
|
|
362
422
|
const files = opts.files?.length ? await resolveMessageFiles(opts.files) : void 0;
|
|
363
423
|
const postOptions = files?.length ? { body, files } : { body };
|
|
364
424
|
const data = await this.client.rest.post(Routes2.channelMessages(this.id), postOptions);
|
|
@@ -380,7 +440,7 @@ var DMChannel = class extends Channel {
|
|
|
380
440
|
* @returns Pinned messages
|
|
381
441
|
*/
|
|
382
442
|
async fetchPinnedMessages() {
|
|
383
|
-
const { Message } = await import("./Message-
|
|
443
|
+
const { Message } = await import("./Message-QNWAPT55.mjs");
|
|
384
444
|
const data = await this.client.rest.get(Routes2.channelPins(this.id));
|
|
385
445
|
const list = Array.isArray(data) ? data : data?.items ?? [];
|
|
386
446
|
return list.map((item) => {
|
|
@@ -401,6 +461,26 @@ var DMChannel = class extends Channel {
|
|
|
401
461
|
);
|
|
402
462
|
return this.client.channels.fetchMessage(this.id, messageId);
|
|
403
463
|
}
|
|
464
|
+
/**
|
|
465
|
+
* Add a recipient to this Group DM. Requires Group DM (type GroupDM).
|
|
466
|
+
* PUT /channels/{id}/recipients/{userId}.
|
|
467
|
+
*/
|
|
468
|
+
async addRecipient(userId) {
|
|
469
|
+
await this.client.rest.put(Routes2.channelRecipient(this.id, userId), { auth: true });
|
|
470
|
+
const user = this.client.users.get(userId) ?? await this.client.users.fetch(userId);
|
|
471
|
+
if (user) this.recipients.push(user);
|
|
472
|
+
}
|
|
473
|
+
/**
|
|
474
|
+
* Remove a recipient from this Group DM. Requires Group DM (type GroupDM).
|
|
475
|
+
* DELETE /channels/{id}/recipients/{userId}.
|
|
476
|
+
* @param options - silent: if true, does not send a system message (default false)
|
|
477
|
+
*/
|
|
478
|
+
async removeRecipient(userId, options) {
|
|
479
|
+
const url = Routes2.channelRecipient(this.id, userId) + (options?.silent ? "?silent=true" : "");
|
|
480
|
+
await this.client.rest.delete(url, { auth: true });
|
|
481
|
+
const idx = this.recipients.findIndex((u) => u.id === userId);
|
|
482
|
+
if (idx >= 0) this.recipients.splice(idx, 1);
|
|
483
|
+
}
|
|
404
484
|
};
|
|
405
485
|
|
|
406
486
|
export {
|