@fluxerjs/core 1.1.5 → 1.1.7
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-JCRVGIJL.mjs} +1 -1
- package/dist/{Guild-3ETPHHF5.mjs → Guild-RXGLAN54.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-CREI4MOS.mjs → chunk-BRIU4HGS.mjs} +194 -21
- package/dist/{chunk-NNZUZLG3.mjs → chunk-EUKEYW72.mjs} +87 -7
- package/dist/chunk-KUMLJGXY.mjs +58 -0
- package/dist/{chunk-4S42USSG.mjs → chunk-S25KNTHZ.mjs} +2 -2
- package/dist/index.d.mts +246 -54
- package/dist/index.d.ts +246 -54
- package/dist/index.js +534 -194
- package/dist/index.mjs +78 -132
- package/package.json +7 -7
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Guild
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-BRIU4HGS.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
|
);
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
} from "./chunk-PU73YRKJ.mjs";
|
|
5
5
|
import {
|
|
6
6
|
GuildMember
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-5JEDVRKU.mjs";
|
|
8
8
|
import {
|
|
9
9
|
CDN_URL
|
|
10
10
|
} from "./chunk-HQMYRYMY.mjs";
|
|
@@ -25,6 +25,7 @@ import { Collection as Collection2 } from "@fluxerjs/collection";
|
|
|
25
25
|
|
|
26
26
|
// src/client/GuildMemberManager.ts
|
|
27
27
|
import { Collection } from "@fluxerjs/collection";
|
|
28
|
+
import { Routes } from "@fluxerjs/types";
|
|
28
29
|
var GuildMemberManager = class extends Collection {
|
|
29
30
|
constructor(guild) {
|
|
30
31
|
super();
|
|
@@ -59,10 +60,36 @@ var GuildMemberManager = class extends Collection {
|
|
|
59
60
|
}
|
|
60
61
|
return this.guild.fetchMember(userId);
|
|
61
62
|
}
|
|
63
|
+
/**
|
|
64
|
+
* Fetch guild members with pagination. GET /guilds/{id}/members.
|
|
65
|
+
* @param options - limit (1-1000), after (user ID for pagination)
|
|
66
|
+
* @returns Array of GuildMember objects (cached in guild.members)
|
|
67
|
+
*/
|
|
68
|
+
async fetch(options) {
|
|
69
|
+
const params = new URLSearchParams();
|
|
70
|
+
if (options?.limit != null) params.set("limit", String(options.limit));
|
|
71
|
+
if (options?.after) params.set("after", options.after);
|
|
72
|
+
const qs = params.toString();
|
|
73
|
+
const url = Routes.guildMembers(this.guild.id) + (qs ? `?${qs}` : "");
|
|
74
|
+
const data = await this.guild.client.rest.get(url, { auth: true });
|
|
75
|
+
const list = Array.isArray(data) ? data : data?.members ?? [];
|
|
76
|
+
const { GuildMember: GuildMember2 } = await import("./GuildMember-F5FZJOHD.mjs");
|
|
77
|
+
const members = [];
|
|
78
|
+
for (const m of list) {
|
|
79
|
+
const member = new GuildMember2(
|
|
80
|
+
this.guild.client,
|
|
81
|
+
{ ...m, guild_id: this.guild.id },
|
|
82
|
+
this.guild
|
|
83
|
+
);
|
|
84
|
+
this.set(member.id, member);
|
|
85
|
+
members.push(member);
|
|
86
|
+
}
|
|
87
|
+
return members;
|
|
88
|
+
}
|
|
62
89
|
};
|
|
63
90
|
|
|
64
91
|
// src/structures/Guild.ts
|
|
65
|
-
import { Routes } from "@fluxerjs/types";
|
|
92
|
+
import { Routes as Routes2 } from "@fluxerjs/types";
|
|
66
93
|
var Guild = class extends Base {
|
|
67
94
|
client;
|
|
68
95
|
id;
|
|
@@ -155,7 +182,7 @@ var Guild = class extends Base {
|
|
|
155
182
|
* Requires Manage Roles permission.
|
|
156
183
|
*/
|
|
157
184
|
async addRoleToMember(userId, roleId) {
|
|
158
|
-
await this.client.rest.put(
|
|
185
|
+
await this.client.rest.put(Routes2.guildMemberRole(this.id, userId, roleId));
|
|
159
186
|
}
|
|
160
187
|
/**
|
|
161
188
|
* Remove a role from a member by user ID. Does not require fetching the member first.
|
|
@@ -164,7 +191,7 @@ var Guild = class extends Base {
|
|
|
164
191
|
* Requires Manage Roles permission.
|
|
165
192
|
*/
|
|
166
193
|
async removeRoleFromMember(userId, roleId) {
|
|
167
|
-
await this.client.rest.delete(
|
|
194
|
+
await this.client.rest.delete(Routes2.guildMemberRole(this.id, userId, roleId));
|
|
168
195
|
}
|
|
169
196
|
/**
|
|
170
197
|
* Create a role in this guild.
|
|
@@ -186,7 +213,7 @@ var Guild = class extends Base {
|
|
|
186
213
|
if (options.unicode_emoji !== void 0) body.unicode_emoji = options.unicode_emoji;
|
|
187
214
|
if (options.position !== void 0) body.position = options.position;
|
|
188
215
|
if (options.hoist_position !== void 0) body.hoist_position = options.hoist_position;
|
|
189
|
-
const data = await this.client.rest.post(
|
|
216
|
+
const data = await this.client.rest.post(Routes2.guildRoles(this.id), {
|
|
190
217
|
body: Object.keys(body).length ? body : void 0,
|
|
191
218
|
auth: true
|
|
192
219
|
});
|
|
@@ -200,7 +227,7 @@ var Guild = class extends Base {
|
|
|
200
227
|
*/
|
|
201
228
|
async fetchRoles() {
|
|
202
229
|
const data = await this.client.rest.get(
|
|
203
|
-
|
|
230
|
+
Routes2.guildRoles(this.id)
|
|
204
231
|
);
|
|
205
232
|
const list = Array.isArray(data) ? data : Object.values(data ?? {});
|
|
206
233
|
const roles = [];
|
|
@@ -219,7 +246,7 @@ var Guild = class extends Base {
|
|
|
219
246
|
*/
|
|
220
247
|
async fetchRole(roleId) {
|
|
221
248
|
try {
|
|
222
|
-
const data = await this.client.rest.get(
|
|
249
|
+
const data = await this.client.rest.get(Routes2.guildRole(this.id, roleId));
|
|
223
250
|
const role = new Role(this.client, data, this.id);
|
|
224
251
|
this.roles.set(role.id, role);
|
|
225
252
|
return role;
|
|
@@ -248,7 +275,7 @@ var Guild = class extends Base {
|
|
|
248
275
|
(r) => !!(r.name && r.name.toLowerCase() === arg.trim().toLowerCase())
|
|
249
276
|
);
|
|
250
277
|
if (cached) return cached.id;
|
|
251
|
-
const roles = await this.client.rest.get(
|
|
278
|
+
const roles = await this.client.rest.get(Routes2.guildRoles(this.id));
|
|
252
279
|
const list = Array.isArray(roles) ? roles : Object.values(roles ?? {});
|
|
253
280
|
const role = list.find((r) => !!(r.name && r.name.toLowerCase() === arg.trim().toLowerCase()));
|
|
254
281
|
if (role) {
|
|
@@ -271,7 +298,7 @@ var Guild = class extends Base {
|
|
|
271
298
|
body.delete_message_days = options.delete_message_days;
|
|
272
299
|
if (options?.ban_duration_seconds != null)
|
|
273
300
|
body.ban_duration_seconds = options.ban_duration_seconds;
|
|
274
|
-
await this.client.rest.put(
|
|
301
|
+
await this.client.rest.put(Routes2.guildBan(this.id, userId), {
|
|
275
302
|
body: Object.keys(body).length ? body : void 0,
|
|
276
303
|
auth: true
|
|
277
304
|
});
|
|
@@ -282,7 +309,7 @@ var Guild = class extends Base {
|
|
|
282
309
|
*/
|
|
283
310
|
async fetchBans() {
|
|
284
311
|
const { GuildBan } = await import("./GuildBan-7CXLTPKY.mjs");
|
|
285
|
-
const data = await this.client.rest.get(
|
|
312
|
+
const data = await this.client.rest.get(Routes2.guildBans(this.id));
|
|
286
313
|
const list = Array.isArray(data) ? data : data?.bans ?? [];
|
|
287
314
|
return list.map((b) => new GuildBan(this.client, { ...b, guild_id: this.id }, this.id));
|
|
288
315
|
}
|
|
@@ -292,7 +319,7 @@ var Guild = class extends Base {
|
|
|
292
319
|
* Requires Ban Members permission.
|
|
293
320
|
*/
|
|
294
321
|
async unban(userId) {
|
|
295
|
-
await this.client.rest.delete(
|
|
322
|
+
await this.client.rest.delete(Routes2.guildBan(this.id, userId), { auth: true });
|
|
296
323
|
}
|
|
297
324
|
/**
|
|
298
325
|
* Kick a member from this guild.
|
|
@@ -300,7 +327,7 @@ var Guild = class extends Base {
|
|
|
300
327
|
* Requires Kick Members permission.
|
|
301
328
|
*/
|
|
302
329
|
async kick(userId) {
|
|
303
|
-
await this.client.rest.delete(
|
|
330
|
+
await this.client.rest.delete(Routes2.guildMember(this.id, userId), { auth: true });
|
|
304
331
|
}
|
|
305
332
|
/**
|
|
306
333
|
* Fetch a guild member by user ID.
|
|
@@ -312,7 +339,7 @@ var Guild = class extends Base {
|
|
|
312
339
|
async fetchMember(userId) {
|
|
313
340
|
try {
|
|
314
341
|
const data = await this.client.rest.get(
|
|
315
|
-
|
|
342
|
+
Routes2.guildMember(this.id, userId)
|
|
316
343
|
);
|
|
317
344
|
const member = new GuildMember(this.client, { ...data, guild_id: this.id }, this);
|
|
318
345
|
this.members.set(member.id, member);
|
|
@@ -340,13 +367,13 @@ var Guild = class extends Base {
|
|
|
340
367
|
if (options?.userId) params.set("user_id", options.userId);
|
|
341
368
|
if (options?.actionType != null) params.set("action_type", String(options.actionType));
|
|
342
369
|
const qs = params.toString();
|
|
343
|
-
const url =
|
|
370
|
+
const url = Routes2.guildAuditLogs(this.id) + (qs ? `?${qs}` : "");
|
|
344
371
|
return this.client.rest.get(url);
|
|
345
372
|
}
|
|
346
373
|
/** Fetch all webhooks in this guild. Returned webhooks do not include the token (cannot send). */
|
|
347
374
|
async fetchWebhooks() {
|
|
348
|
-
const { Webhook } = await import("./Webhook-
|
|
349
|
-
const data = await this.client.rest.get(
|
|
375
|
+
const { Webhook } = await import("./Webhook-IWPKKMWD.mjs");
|
|
376
|
+
const data = await this.client.rest.get(Routes2.guildWebhooks(this.id));
|
|
350
377
|
const list = Array.isArray(data) ? data : Object.values(data ?? {});
|
|
351
378
|
return list.map((w) => new Webhook(this.client, w));
|
|
352
379
|
}
|
|
@@ -356,8 +383,8 @@ var Guild = class extends Base {
|
|
|
356
383
|
* Requires Manage Channels permission.
|
|
357
384
|
*/
|
|
358
385
|
async createChannel(data) {
|
|
359
|
-
const { Channel } = await import("./Channel-
|
|
360
|
-
const created = await this.client.rest.post(
|
|
386
|
+
const { Channel } = await import("./Channel-L6UE2MAF.mjs");
|
|
387
|
+
const created = await this.client.rest.post(Routes2.guildChannels(this.id), {
|
|
361
388
|
body: data,
|
|
362
389
|
auth: true
|
|
363
390
|
});
|
|
@@ -373,8 +400,8 @@ var Guild = class extends Base {
|
|
|
373
400
|
* @returns Array of GuildChannel objects (cached in guild.channels and client.channels)
|
|
374
401
|
*/
|
|
375
402
|
async fetchChannels() {
|
|
376
|
-
const { Channel } = await import("./Channel-
|
|
377
|
-
const data = await this.client.rest.get(
|
|
403
|
+
const { Channel } = await import("./Channel-L6UE2MAF.mjs");
|
|
404
|
+
const data = await this.client.rest.get(Routes2.guildChannels(this.id));
|
|
378
405
|
const list = Array.isArray(data) ? data : Object.values(data ?? {});
|
|
379
406
|
const channels = [];
|
|
380
407
|
for (const ch of list) {
|
|
@@ -387,17 +414,163 @@ var Guild = class extends Base {
|
|
|
387
414
|
}
|
|
388
415
|
return channels;
|
|
389
416
|
}
|
|
417
|
+
/**
|
|
418
|
+
* Edit this guild. PATCH /guilds/{id}.
|
|
419
|
+
* Requires guild owner or Administrator.
|
|
420
|
+
*/
|
|
421
|
+
async edit(options) {
|
|
422
|
+
const data = await this.client.rest.patch(Routes2.guild(this.id), {
|
|
423
|
+
body: options,
|
|
424
|
+
auth: true
|
|
425
|
+
});
|
|
426
|
+
this.name = data.name;
|
|
427
|
+
this.icon = data.icon ?? this.icon;
|
|
428
|
+
this.banner = data.banner ?? this.banner;
|
|
429
|
+
this.splash = data.splash ?? this.splash;
|
|
430
|
+
this.systemChannelId = data.system_channel_id ?? this.systemChannelId;
|
|
431
|
+
this.afkChannelId = data.afk_channel_id ?? this.afkChannelId;
|
|
432
|
+
this.afkTimeout = data.afk_timeout ?? this.afkTimeout;
|
|
433
|
+
this.verificationLevel = data.verification_level ?? this.verificationLevel;
|
|
434
|
+
this.mfaLevel = data.mfa_level ?? this.mfaLevel;
|
|
435
|
+
this.explicitContentFilter = data.explicit_content_filter ?? this.explicitContentFilter;
|
|
436
|
+
this.defaultMessageNotifications = data.default_message_notifications ?? this.defaultMessageNotifications;
|
|
437
|
+
this.features = data.features ?? this.features;
|
|
438
|
+
return this;
|
|
439
|
+
}
|
|
440
|
+
/**
|
|
441
|
+
* Delete this guild. POST /guilds/{id}/delete.
|
|
442
|
+
* Must be the guild owner.
|
|
443
|
+
*/
|
|
444
|
+
async delete() {
|
|
445
|
+
await this.client.rest.post(Routes2.guildDelete(this.id), { auth: true });
|
|
446
|
+
this.client.guilds.delete(this.id);
|
|
447
|
+
}
|
|
448
|
+
/**
|
|
449
|
+
* Fetch vanity URL for this guild. GET /guilds/{id}/vanity-url.
|
|
450
|
+
* Requires Manage Guild permission.
|
|
451
|
+
*/
|
|
452
|
+
async fetchVanityURL() {
|
|
453
|
+
return this.client.rest.get(Routes2.guildVanityUrl(this.id), { auth: true });
|
|
454
|
+
}
|
|
455
|
+
/**
|
|
456
|
+
* Transfer guild ownership to another user. POST /guilds/{id}/transfer-ownership.
|
|
457
|
+
* Must be the guild owner.
|
|
458
|
+
*/
|
|
459
|
+
async transferOwnership(newOwnerId, password) {
|
|
460
|
+
await this.client.rest.post(Routes2.guildTransferOwnership(this.id), {
|
|
461
|
+
body: { new_owner_id: newOwnerId, ...password != null && { password } },
|
|
462
|
+
auth: true
|
|
463
|
+
});
|
|
464
|
+
}
|
|
465
|
+
/**
|
|
466
|
+
* Set text channel flexible names feature. PATCH /guilds/{id}/text-channel-flexible-names.
|
|
467
|
+
*/
|
|
468
|
+
setTextChannelFlexibleNames(enabled) {
|
|
469
|
+
return this.client.rest.patch(Routes2.guildTextChannelFlexibleNames(this.id), {
|
|
470
|
+
body: { enabled },
|
|
471
|
+
auth: true
|
|
472
|
+
}).then(() => this);
|
|
473
|
+
}
|
|
474
|
+
/**
|
|
475
|
+
* Set detached banner feature. PATCH /guilds/{id}/detached-banner.
|
|
476
|
+
*/
|
|
477
|
+
setDetachedBanner(enabled) {
|
|
478
|
+
return this.client.rest.patch(Routes2.guildDetachedBanner(this.id), {
|
|
479
|
+
body: { enabled },
|
|
480
|
+
auth: true
|
|
481
|
+
}).then(() => this);
|
|
482
|
+
}
|
|
483
|
+
/**
|
|
484
|
+
* Set disallow unclaimed accounts. PATCH /guilds/{id}/disallow-unclaimed-accounts.
|
|
485
|
+
*/
|
|
486
|
+
setDisallowUnclaimedAccounts(enabled) {
|
|
487
|
+
return this.client.rest.patch(Routes2.guildDisallowUnclaimedAccounts(this.id), {
|
|
488
|
+
body: { enabled },
|
|
489
|
+
auth: true
|
|
490
|
+
}).then(() => this);
|
|
491
|
+
}
|
|
492
|
+
/**
|
|
493
|
+
* Update role positions. PATCH /guilds/{id}/roles.
|
|
494
|
+
* @param updates - Array of { id, position? }
|
|
495
|
+
*/
|
|
496
|
+
async setRolePositions(updates) {
|
|
497
|
+
const data = await this.client.rest.patch(
|
|
498
|
+
Routes2.guildRoles(this.id),
|
|
499
|
+
{ body: updates, auth: true }
|
|
500
|
+
);
|
|
501
|
+
const list = Array.isArray(data) ? data : Object.values(data ?? {});
|
|
502
|
+
for (const r of list) {
|
|
503
|
+
this.roles.set(r.id, new Role(this.client, r, this.id));
|
|
504
|
+
}
|
|
505
|
+
return list;
|
|
506
|
+
}
|
|
507
|
+
/**
|
|
508
|
+
* Update role hoist positions. PATCH /guilds/{id}/roles/hoist-positions.
|
|
509
|
+
*/
|
|
510
|
+
async setRoleHoistPositions(updates) {
|
|
511
|
+
const data = await this.client.rest.patch(
|
|
512
|
+
Routes2.guildRolesHoistPositions(this.id),
|
|
513
|
+
{ body: updates, auth: true }
|
|
514
|
+
);
|
|
515
|
+
const list = Array.isArray(data) ? data : Object.values(data ?? {});
|
|
516
|
+
for (const r of list) {
|
|
517
|
+
this.roles.set(r.id, new Role(this.client, r, this.id));
|
|
518
|
+
}
|
|
519
|
+
return list;
|
|
520
|
+
}
|
|
521
|
+
/**
|
|
522
|
+
* Reset role hoist positions. DELETE /guilds/{id}/roles/hoist-positions.
|
|
523
|
+
*/
|
|
524
|
+
async resetRoleHoistPositions() {
|
|
525
|
+
const data = await this.client.rest.delete(
|
|
526
|
+
Routes2.guildRolesHoistPositions(this.id),
|
|
527
|
+
{ auth: true }
|
|
528
|
+
);
|
|
529
|
+
const list = Array.isArray(data) ? data : Object.values(data ?? {});
|
|
530
|
+
for (const r of list) {
|
|
531
|
+
this.roles.set(r.id, new Role(this.client, r, this.id));
|
|
532
|
+
}
|
|
533
|
+
return list;
|
|
534
|
+
}
|
|
390
535
|
/**
|
|
391
536
|
* Update channel positions.
|
|
392
537
|
* @param updates - Array of { id, position?, parent_id?, lock_permissions? }
|
|
393
538
|
* Requires Manage Channels permission.
|
|
394
539
|
*/
|
|
395
540
|
async setChannelPositions(updates) {
|
|
396
|
-
await this.client.rest.patch(
|
|
541
|
+
await this.client.rest.patch(Routes2.guildChannels(this.id), {
|
|
397
542
|
body: updates,
|
|
398
543
|
auth: true
|
|
399
544
|
});
|
|
400
545
|
}
|
|
546
|
+
/**
|
|
547
|
+
* Bulk create emojis. POST /guilds/{id}/emojis/bulk.
|
|
548
|
+
* @param emojis - Array of { name, image } (base64), 1-50 emojis
|
|
549
|
+
* @returns Array of created GuildEmoji objects
|
|
550
|
+
*/
|
|
551
|
+
async createEmojisBulk(emojis) {
|
|
552
|
+
const { GuildEmoji } = await import("./GuildEmoji-SOGQ4C32.mjs");
|
|
553
|
+
const data = await this.client.rest.post(Routes2.guildEmojisBulk(this.id), {
|
|
554
|
+
body: { emojis },
|
|
555
|
+
auth: true
|
|
556
|
+
});
|
|
557
|
+
const list = Array.isArray(data) ? data : data?.emojis ?? [];
|
|
558
|
+
return list.map((e) => new GuildEmoji(this.client, { ...e, guild_id: this.id }, this.id));
|
|
559
|
+
}
|
|
560
|
+
/**
|
|
561
|
+
* Bulk create stickers. POST /guilds/{id}/stickers/bulk.
|
|
562
|
+
* @param stickers - Array of { name, image, description?, tags? }, 1-50 stickers
|
|
563
|
+
* @returns Array of created GuildSticker objects
|
|
564
|
+
*/
|
|
565
|
+
async createStickersBulk(stickers) {
|
|
566
|
+
const { GuildSticker } = await import("./GuildSticker-3QYT6ZIY.mjs");
|
|
567
|
+
const data = await this.client.rest.post(Routes2.guildStickersBulk(this.id), {
|
|
568
|
+
body: { stickers },
|
|
569
|
+
auth: true
|
|
570
|
+
});
|
|
571
|
+
const list = Array.isArray(data) ? data : data?.stickers ?? [];
|
|
572
|
+
return list.map((s) => new GuildSticker(this.client, { ...s, guild_id: this.id }, this.id));
|
|
573
|
+
}
|
|
401
574
|
};
|
|
402
575
|
|
|
403
576
|
export {
|