@fluxerjs/core 1.0.8 → 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-TWPDKW2P.mjs → Channel-ICWNKXBR.mjs} +1 -1
- package/dist/{ClientUser-2K2BACK7.mjs → ClientUser-WWXUMO5O.mjs} +1 -1
- package/dist/{Guild-CMZGA6DW.mjs → Guild-TM6YGJWB.mjs} +2 -2
- package/dist/GuildBan-M4PA3HAA.mjs +7 -0
- package/dist/{GuildMember-DW2N6ITI.mjs → GuildMember-RZWZ3OCG.mjs} +1 -1
- package/dist/Invite-UM5BU5A6.mjs +7 -0
- package/dist/{Message-G2QIKZQK.mjs → Message-6IYEYSV6.mjs} +1 -1
- package/dist/{Webhook-2MQESB7Z.mjs → Webhook-32VJD4AL.mjs} +1 -1
- package/dist/{chunk-ZGMM6IPQ.mjs → chunk-53Y37KRG.mjs} +32 -0
- package/dist/{chunk-CO5EL5LH.mjs → chunk-DSPSRPHF.mjs} +33 -1
- package/dist/{chunk-CZIO2D7F.mjs → chunk-FJS5FBXO.mjs} +30 -4
- package/dist/{chunk-4GCZFOS5.mjs → chunk-GCIJYVRC.mjs} +1 -1
- package/dist/{chunk-JVEOQFUX.mjs → chunk-GFUJVQ7L.mjs} +12 -0
- package/dist/chunk-QEXIYXXU.mjs +62 -0
- package/dist/chunk-RCP27MRC.mjs +33 -0
- package/dist/{chunk-TJVZEILY.mjs → chunk-X77DFNE3.mjs} +18 -2
- package/dist/index.d.mts +234 -82
- package/dist/index.d.ts +234 -82
- package/dist/index.js +346 -9
- package/dist/index.mjs +142 -28
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -87,6 +87,38 @@ var init_Webhook = __esm({
|
|
|
87
87
|
async delete() {
|
|
88
88
|
await this.client.rest.delete(import_types.Routes.webhook(this.id), { auth: true });
|
|
89
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
|
+
}
|
|
90
122
|
/**
|
|
91
123
|
* Send a message via this webhook. Requires the webhook token (only present when created, not when fetched).
|
|
92
124
|
* @throws Error if token is not available
|
|
@@ -159,6 +191,17 @@ var init_Message = __esm({
|
|
|
159
191
|
editedAt;
|
|
160
192
|
pinned;
|
|
161
193
|
attachments;
|
|
194
|
+
type;
|
|
195
|
+
flags;
|
|
196
|
+
mentionEveryone;
|
|
197
|
+
tts;
|
|
198
|
+
embeds;
|
|
199
|
+
stickers;
|
|
200
|
+
reactions;
|
|
201
|
+
messageReference;
|
|
202
|
+
messageSnapshots;
|
|
203
|
+
call;
|
|
204
|
+
referencedMessage;
|
|
162
205
|
/** Channel where this message was sent. Resolved from cache; null if not cached (e.g. DM channel not in cache). */
|
|
163
206
|
get channel() {
|
|
164
207
|
return this.client.channels.get(this.channelId) ?? null;
|
|
@@ -181,6 +224,17 @@ var init_Message = __esm({
|
|
|
181
224
|
this.pinned = data.pinned;
|
|
182
225
|
this.attachments = new import_collection.Collection();
|
|
183
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;
|
|
184
238
|
}
|
|
185
239
|
/**
|
|
186
240
|
* Send a message to this channel without replying. Use when you want a standalone message.
|
|
@@ -258,6 +312,16 @@ var init_Message = __esm({
|
|
|
258
312
|
async delete() {
|
|
259
313
|
await this.client.rest.delete(import_types2.Routes.channelMessage(this.channelId, this.id));
|
|
260
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
|
+
}
|
|
261
325
|
/**
|
|
262
326
|
* Format emoji for reaction API: unicode string or "name:id" for custom.
|
|
263
327
|
* For string resolution (e.g. :name:), use client.resolveEmoji; Message methods resolve automatically when guildId is available.
|
|
@@ -439,6 +503,19 @@ var init_Channel = __esm({
|
|
|
439
503
|
get messages() {
|
|
440
504
|
return new MessageManager(this.client, this.id);
|
|
441
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
|
+
}
|
|
442
519
|
/**
|
|
443
520
|
* Fetch a message by ID from this channel.
|
|
444
521
|
* @param messageId - Snowflake of the message
|
|
@@ -489,6 +566,19 @@ var init_Channel = __esm({
|
|
|
489
566
|
get messages() {
|
|
490
567
|
return new MessageManager(this.client, this.id);
|
|
491
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
|
+
}
|
|
492
582
|
/**
|
|
493
583
|
* Fetch a message by ID from this DM channel.
|
|
494
584
|
* @param messageId - Snowflake of the message
|
|
@@ -522,6 +612,12 @@ var init_GuildMember = __esm({
|
|
|
522
612
|
roles;
|
|
523
613
|
joinedAt;
|
|
524
614
|
communicationDisabledUntil;
|
|
615
|
+
mute;
|
|
616
|
+
deaf;
|
|
617
|
+
avatar;
|
|
618
|
+
banner;
|
|
619
|
+
accentColor;
|
|
620
|
+
profileFlags;
|
|
525
621
|
/** @param data - API guild member from GET /guilds/{id}/members or GET /guilds/{id}/members/{user_id} */
|
|
526
622
|
constructor(client, data, guild) {
|
|
527
623
|
super();
|
|
@@ -533,6 +629,12 @@ var init_GuildMember = __esm({
|
|
|
533
629
|
this.roles = data.roles ?? [];
|
|
534
630
|
this.joinedAt = new Date(data.joined_at);
|
|
535
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;
|
|
634
|
+
this.avatar = data.avatar ?? null;
|
|
635
|
+
this.banner = data.banner ?? null;
|
|
636
|
+
this.accentColor = data.accent_color ?? null;
|
|
637
|
+
this.profileFlags = data.profile_flags ?? null;
|
|
536
638
|
}
|
|
537
639
|
/** Nickname, or global name, or username. */
|
|
538
640
|
get displayName() {
|
|
@@ -719,6 +821,22 @@ var init_Guild = __esm({
|
|
|
719
821
|
return null;
|
|
720
822
|
}
|
|
721
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
|
+
}
|
|
722
840
|
/** Fetch all webhooks in this guild. Returned webhooks do not include the token (cannot send). */
|
|
723
841
|
async fetchWebhooks() {
|
|
724
842
|
const { Webhook: Webhook2 } = await Promise.resolve().then(() => (init_Webhook(), Webhook_exports));
|
|
@@ -852,6 +970,109 @@ var init_MessageReaction = __esm({
|
|
|
852
970
|
}
|
|
853
971
|
});
|
|
854
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
|
+
|
|
855
1076
|
// src/client/ClientUser.ts
|
|
856
1077
|
var ClientUser_exports = {};
|
|
857
1078
|
__export(ClientUser_exports, {
|
|
@@ -885,17 +1106,21 @@ __export(index_exports, {
|
|
|
885
1106
|
ErrorCodes: () => ErrorCodes,
|
|
886
1107
|
Events: () => Events,
|
|
887
1108
|
FluxerError: () => FluxerError,
|
|
888
|
-
GatewayOpcodes: () =>
|
|
1109
|
+
GatewayOpcodes: () => import_types14.GatewayOpcodes,
|
|
889
1110
|
Guild: () => Guild,
|
|
1111
|
+
GuildBan: () => GuildBan,
|
|
890
1112
|
GuildChannel: () => GuildChannel,
|
|
1113
|
+
GuildEmoji: () => GuildEmoji,
|
|
891
1114
|
GuildMember: () => GuildMember,
|
|
1115
|
+
GuildSticker: () => GuildSticker,
|
|
1116
|
+
Invite: () => Invite,
|
|
892
1117
|
LinkChannel: () => LinkChannel,
|
|
893
1118
|
Message: () => Message,
|
|
894
1119
|
MessageManager: () => MessageManager,
|
|
895
1120
|
MessagePayload: () => import_builders2.MessagePayload,
|
|
896
1121
|
MessageReaction: () => MessageReaction,
|
|
897
1122
|
Role: () => Role,
|
|
898
|
-
Routes: () =>
|
|
1123
|
+
Routes: () => import_types14.Routes,
|
|
899
1124
|
TextChannel: () => TextChannel,
|
|
900
1125
|
User: () => User,
|
|
901
1126
|
VoiceChannel: () => VoiceChannel,
|
|
@@ -907,7 +1132,7 @@ module.exports = __toCommonJS(index_exports);
|
|
|
907
1132
|
var import_events = require("events");
|
|
908
1133
|
var import_rest = require("@fluxerjs/rest");
|
|
909
1134
|
var import_ws = require("@fluxerjs/ws");
|
|
910
|
-
var
|
|
1135
|
+
var import_types11 = require("@fluxerjs/types");
|
|
911
1136
|
var import_collection5 = require("@fluxerjs/collection");
|
|
912
1137
|
|
|
913
1138
|
// src/client/ChannelManager.ts
|
|
@@ -1225,10 +1450,16 @@ handlers.set("MESSAGE_DELETE_BULK", async (client, d) => {
|
|
|
1225
1450
|
client.emit(Events.MessageDeleteBulk, d);
|
|
1226
1451
|
});
|
|
1227
1452
|
handlers.set("GUILD_BAN_ADD", async (client, d) => {
|
|
1228
|
-
|
|
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);
|
|
1229
1457
|
});
|
|
1230
1458
|
handlers.set("GUILD_BAN_REMOVE", async (client, d) => {
|
|
1231
|
-
|
|
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);
|
|
1232
1463
|
});
|
|
1233
1464
|
handlers.set("GUILD_EMOJIS_UPDATE", async (client, d) => {
|
|
1234
1465
|
client.emit(Events.GuildEmojisUpdate, d);
|
|
@@ -1276,7 +1507,9 @@ handlers.set("CHANNEL_PINS_UPDATE", async (client, d) => {
|
|
|
1276
1507
|
client.emit(Events.ChannelPinsUpdate, d);
|
|
1277
1508
|
});
|
|
1278
1509
|
handlers.set("INVITE_CREATE", async (client, d) => {
|
|
1279
|
-
|
|
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));
|
|
1280
1513
|
});
|
|
1281
1514
|
handlers.set("INVITE_DELETE", async (client, d) => {
|
|
1282
1515
|
client.emit(Events.InviteDelete, d);
|
|
@@ -1345,7 +1578,7 @@ var Client = class extends import_events.EventEmitter {
|
|
|
1345
1578
|
if (!parsed) throw new Error("Invalid emoji");
|
|
1346
1579
|
if (parsed.id) return (0, import_util2.formatEmoji)(parsed);
|
|
1347
1580
|
if (guildId) {
|
|
1348
|
-
const emojis = await this.rest.get(
|
|
1581
|
+
const emojis = await this.rest.get(import_types11.Routes.guildEmojis(guildId));
|
|
1349
1582
|
const list = Array.isArray(emojis) ? emojis : Object.values(emojis ?? {});
|
|
1350
1583
|
const found = list.find((e) => e.name && e.name.toLowerCase() === parsed.name.toLowerCase());
|
|
1351
1584
|
if (found) return (0, import_util2.formatEmoji)({ ...parsed, id: found.id, animated: found.animated });
|
|
@@ -1501,7 +1734,7 @@ var Client = class extends import_events.EventEmitter {
|
|
|
1501
1734
|
return this.readyAt !== null && this.user !== null;
|
|
1502
1735
|
}
|
|
1503
1736
|
static get Routes() {
|
|
1504
|
-
return
|
|
1737
|
+
return import_types11.Routes;
|
|
1505
1738
|
}
|
|
1506
1739
|
};
|
|
1507
1740
|
|
|
@@ -1517,6 +1750,106 @@ init_MessageReaction();
|
|
|
1517
1750
|
init_Webhook();
|
|
1518
1751
|
init_GuildMember();
|
|
1519
1752
|
init_Role();
|
|
1753
|
+
init_Invite();
|
|
1754
|
+
init_GuildBan();
|
|
1755
|
+
|
|
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;
|
|
1851
|
+
}
|
|
1852
|
+
};
|
|
1520
1853
|
|
|
1521
1854
|
// src/errors/ErrorCodes.ts
|
|
1522
1855
|
var ErrorCodes = {
|
|
@@ -1526,7 +1859,7 @@ var ErrorCodes = {
|
|
|
1526
1859
|
|
|
1527
1860
|
// src/index.ts
|
|
1528
1861
|
var import_builders2 = require("@fluxerjs/builders");
|
|
1529
|
-
var
|
|
1862
|
+
var import_types14 = require("@fluxerjs/types");
|
|
1530
1863
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1531
1864
|
0 && (module.exports = {
|
|
1532
1865
|
AttachmentBuilder,
|
|
@@ -1543,8 +1876,12 @@ var import_types10 = require("@fluxerjs/types");
|
|
|
1543
1876
|
FluxerError,
|
|
1544
1877
|
GatewayOpcodes,
|
|
1545
1878
|
Guild,
|
|
1879
|
+
GuildBan,
|
|
1546
1880
|
GuildChannel,
|
|
1881
|
+
GuildEmoji,
|
|
1547
1882
|
GuildMember,
|
|
1883
|
+
GuildSticker,
|
|
1884
|
+
Invite,
|
|
1548
1885
|
LinkChannel,
|
|
1549
1886
|
Message,
|
|
1550
1887
|
MessageManager,
|