@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/index.mjs CHANGED
@@ -1,13 +1,19 @@
1
+ import {
2
+ GuildBan
3
+ } from "./chunk-RCP27MRC.mjs";
4
+ import {
5
+ Invite
6
+ } from "./chunk-QEXIYXXU.mjs";
1
7
  import {
2
8
  ClientUser,
3
9
  User
4
- } from "./chunk-4GCZFOS5.mjs";
10
+ } from "./chunk-GCIJYVRC.mjs";
5
11
  import {
6
12
  Webhook
7
- } from "./chunk-ZGMM6IPQ.mjs";
13
+ } from "./chunk-53Y37KRG.mjs";
8
14
  import {
9
15
  Message
10
- } from "./chunk-CO5EL5LH.mjs";
16
+ } from "./chunk-DSPSRPHF.mjs";
11
17
  import {
12
18
  CategoryChannel,
13
19
  Channel,
@@ -17,14 +23,16 @@ import {
17
23
  MessageManager,
18
24
  TextChannel,
19
25
  VoiceChannel
20
- } from "./chunk-CZIO2D7F.mjs";
26
+ } from "./chunk-FJS5FBXO.mjs";
21
27
  import {
22
28
  Guild
23
- } from "./chunk-TJVZEILY.mjs";
24
- import "./chunk-HQMYRYMY.mjs";
29
+ } from "./chunk-X77DFNE3.mjs";
30
+ import {
31
+ CDN_URL
32
+ } from "./chunk-HQMYRYMY.mjs";
25
33
  import {
26
34
  GuildMember
27
- } from "./chunk-JVEOQFUX.mjs";
35
+ } from "./chunk-GFUJVQ7L.mjs";
28
36
  import {
29
37
  Role
30
38
  } from "./chunk-SQVCCSNN.mjs";
@@ -62,7 +70,7 @@ var ChannelManager = class extends Collection {
62
70
  const cached = this.get(channelId);
63
71
  if (cached) return cached;
64
72
  try {
65
- const { Channel: Channel2 } = await import("./Channel-TWPDKW2P.mjs");
73
+ const { Channel: Channel2 } = await import("./Channel-ICWNKXBR.mjs");
66
74
  const data = await this.client.rest.get(
67
75
  Routes.channel(channelId)
68
76
  );
@@ -85,7 +93,7 @@ var ChannelManager = class extends Collection {
85
93
  */
86
94
  async fetchMessage(channelId, messageId) {
87
95
  try {
88
- const { Message: Message2 } = await import("./Message-G2QIKZQK.mjs");
96
+ const { Message: Message2 } = await import("./Message-6IYEYSV6.mjs");
89
97
  const data = await this.client.rest.get(
90
98
  Routes.channelMessage(channelId, messageId)
91
99
  );
@@ -106,7 +114,7 @@ var ChannelManager = class extends Collection {
106
114
  */
107
115
  async send(channelId, payload) {
108
116
  const body = typeof payload === "string" ? { content: payload } : payload;
109
- const { Message: Message2 } = await import("./Message-G2QIKZQK.mjs");
117
+ const { Message: Message2 } = await import("./Message-6IYEYSV6.mjs");
110
118
  const data = await this.client.rest.post(Routes.channelMessages(channelId), { body });
111
119
  return new Message2(this.client, data);
112
120
  }
@@ -132,7 +140,7 @@ var GuildManager = class extends Collection2 {
132
140
  const cached = this.get(guildId);
133
141
  if (cached) return cached;
134
142
  try {
135
- const { Guild: Guild2 } = await import("./Guild-CMZGA6DW.mjs");
143
+ const { Guild: Guild2 } = await import("./Guild-TM6YGJWB.mjs");
136
144
  const data = await this.client.rest.get(
137
145
  Routes2.guild(guildId)
138
146
  );
@@ -207,11 +215,11 @@ import { formatEmoji, parseEmoji } from "@fluxerjs/util";
207
215
  // src/client/EventHandlerRegistry.ts
208
216
  var handlers = /* @__PURE__ */ new Map();
209
217
  handlers.set("MESSAGE_CREATE", async (client, d) => {
210
- const { Message: Message2 } = await import("./Message-G2QIKZQK.mjs");
218
+ const { Message: Message2 } = await import("./Message-6IYEYSV6.mjs");
211
219
  client.emit(Events.MessageCreate, new Message2(client, d));
212
220
  });
213
221
  handlers.set("MESSAGE_UPDATE", async (client, d) => {
214
- const { Message: Message2 } = await import("./Message-G2QIKZQK.mjs");
222
+ const { Message: Message2 } = await import("./Message-6IYEYSV6.mjs");
215
223
  client.emit(Events.MessageUpdate, null, new Message2(client, d));
216
224
  });
217
225
  handlers.set("MESSAGE_DELETE", async (client, d) => {
@@ -255,8 +263,8 @@ handlers.set("MESSAGE_REACTION_REMOVE_EMOJI", async (client, d) => {
255
263
  );
256
264
  });
257
265
  handlers.set("GUILD_CREATE", async (client, d) => {
258
- const { Guild: Guild2 } = await import("./Guild-CMZGA6DW.mjs");
259
- const { Channel: Channel2 } = await import("./Channel-TWPDKW2P.mjs");
266
+ const { Guild: Guild2 } = await import("./Guild-TM6YGJWB.mjs");
267
+ const { Channel: Channel2 } = await import("./Channel-ICWNKXBR.mjs");
260
268
  const guild = new Guild2(client, d);
261
269
  client.guilds.set(guild.id, guild);
262
270
  const g = d;
@@ -270,7 +278,7 @@ handlers.set("GUILD_CREATE", async (client, d) => {
270
278
  }
271
279
  });
272
280
  handlers.set("GUILD_UPDATE", async (client, d) => {
273
- const { Guild: Guild2 } = await import("./Guild-CMZGA6DW.mjs");
281
+ const { Guild: Guild2 } = await import("./Guild-TM6YGJWB.mjs");
274
282
  const g = d;
275
283
  const old = client.guilds.get(g.id);
276
284
  const updated = new Guild2(client, g);
@@ -286,7 +294,7 @@ handlers.set("GUILD_DELETE", async (client, d) => {
286
294
  }
287
295
  });
288
296
  handlers.set("CHANNEL_CREATE", async (client, d) => {
289
- const { Channel: Channel2 } = await import("./Channel-TWPDKW2P.mjs");
297
+ const { Channel: Channel2 } = await import("./Channel-ICWNKXBR.mjs");
290
298
  const ch = Channel2.from(client, d);
291
299
  if (ch) {
292
300
  client.channels.set(ch.id, ch);
@@ -294,7 +302,7 @@ handlers.set("CHANNEL_CREATE", async (client, d) => {
294
302
  }
295
303
  });
296
304
  handlers.set("CHANNEL_UPDATE", async (client, d) => {
297
- const { Channel: Channel2 } = await import("./Channel-TWPDKW2P.mjs");
305
+ const { Channel: Channel2 } = await import("./Channel-ICWNKXBR.mjs");
298
306
  const ch = d;
299
307
  const oldCh = client.channels.get(ch.id);
300
308
  const newCh = Channel2.from(client, ch);
@@ -312,7 +320,7 @@ handlers.set("CHANNEL_DELETE", async (client, d) => {
312
320
  }
313
321
  });
314
322
  handlers.set("GUILD_MEMBER_ADD", async (client, d) => {
315
- const { GuildMember: GuildMember2 } = await import("./GuildMember-DW2N6ITI.mjs");
323
+ const { GuildMember: GuildMember2 } = await import("./GuildMember-RZWZ3OCG.mjs");
316
324
  const data = d;
317
325
  const guild = client.guilds.get(data.guild_id);
318
326
  if (guild) {
@@ -322,7 +330,7 @@ handlers.set("GUILD_MEMBER_ADD", async (client, d) => {
322
330
  }
323
331
  });
324
332
  handlers.set("GUILD_MEMBER_UPDATE", async (client, d) => {
325
- const { GuildMember: GuildMember2 } = await import("./GuildMember-DW2N6ITI.mjs");
333
+ const { GuildMember: GuildMember2 } = await import("./GuildMember-RZWZ3OCG.mjs");
326
334
  const data = d;
327
335
  const guild = client.guilds.get(data.guild_id);
328
336
  if (guild) {
@@ -356,10 +364,16 @@ handlers.set("MESSAGE_DELETE_BULK", async (client, d) => {
356
364
  client.emit(Events.MessageDeleteBulk, d);
357
365
  });
358
366
  handlers.set("GUILD_BAN_ADD", async (client, d) => {
359
- client.emit(Events.GuildBanAdd, d);
367
+ const data = d;
368
+ const { GuildBan: GuildBan2 } = await import("./GuildBan-M4PA3HAA.mjs");
369
+ const ban = new GuildBan2(client, data, data.guild_id);
370
+ client.emit(Events.GuildBanAdd, ban);
360
371
  });
361
372
  handlers.set("GUILD_BAN_REMOVE", async (client, d) => {
362
- client.emit(Events.GuildBanRemove, d);
373
+ const data = d;
374
+ const { GuildBan: GuildBan2 } = await import("./GuildBan-M4PA3HAA.mjs");
375
+ const ban = new GuildBan2(client, { ...data, reason: null }, data.guild_id);
376
+ client.emit(Events.GuildBanRemove, ban);
363
377
  });
364
378
  handlers.set("GUILD_EMOJIS_UPDATE", async (client, d) => {
365
379
  client.emit(Events.GuildEmojisUpdate, d);
@@ -407,7 +421,9 @@ handlers.set("CHANNEL_PINS_UPDATE", async (client, d) => {
407
421
  client.emit(Events.ChannelPinsUpdate, d);
408
422
  });
409
423
  handlers.set("INVITE_CREATE", async (client, d) => {
410
- client.emit(Events.InviteCreate, d);
424
+ const data = d;
425
+ const { Invite: Invite2 } = await import("./Invite-UM5BU5A6.mjs");
426
+ client.emit(Events.InviteCreate, new Invite2(client, data));
411
427
  });
412
428
  handlers.set("INVITE_DELETE", async (client, d) => {
413
429
  client.emit(Events.InviteDelete, d);
@@ -586,9 +602,9 @@ var Client = class extends EventEmitter {
586
602
  async ({
587
603
  data
588
604
  }) => {
589
- const { ClientUser: ClientUser2 } = await import("./ClientUser-2K2BACK7.mjs");
590
- const { Guild: Guild2 } = await import("./Guild-CMZGA6DW.mjs");
591
- const { Channel: Channel2 } = await import("./Channel-TWPDKW2P.mjs");
605
+ const { ClientUser: ClientUser2 } = await import("./ClientUser-WWXUMO5O.mjs");
606
+ const { Guild: Guild2 } = await import("./Guild-TM6YGJWB.mjs");
607
+ const { Channel: Channel2 } = await import("./Channel-ICWNKXBR.mjs");
592
608
  this.user = new ClientUser2(this, data.user);
593
609
  for (const g of data.guilds ?? []) {
594
610
  const guild = new Guild2(this, g);
@@ -636,6 +652,100 @@ var Client = class extends EventEmitter {
636
652
  }
637
653
  };
638
654
 
655
+ // src/structures/GuildEmoji.ts
656
+ import { Routes as Routes4 } from "@fluxerjs/types";
657
+ var GuildEmoji = class extends Base {
658
+ client;
659
+ id;
660
+ guildId;
661
+ name;
662
+ animated;
663
+ /** @param data - API emoji from GET /guilds/{id}/emojis or guild emoji events */
664
+ constructor(client, data, guildId) {
665
+ super();
666
+ this.client = client;
667
+ this.id = data.id;
668
+ this.guildId = data.guild_id ?? guildId;
669
+ this.name = data.name;
670
+ this.animated = data.animated ?? false;
671
+ }
672
+ /** CDN URL for this emoji image. */
673
+ get url() {
674
+ const ext = this.animated ? "gif" : "png";
675
+ return `${CDN_URL}/emojis/${this.id}.${ext}`;
676
+ }
677
+ /** Emoji identifier for use in reactions: `name:id` */
678
+ get identifier() {
679
+ return `${this.name}:${this.id}`;
680
+ }
681
+ /** Delete this emoji. Requires Manage Emojis and Stickers permission. */
682
+ async delete() {
683
+ await this.client.rest.delete(Routes4.guildEmoji(this.guildId, this.id), {
684
+ auth: true
685
+ });
686
+ }
687
+ /**
688
+ * Edit this emoji's name.
689
+ * Requires Manage Emojis and Stickers permission.
690
+ */
691
+ async edit(options) {
692
+ const data = await this.client.rest.patch(Routes4.guildEmoji(this.guildId, this.id), {
693
+ body: options,
694
+ auth: true
695
+ });
696
+ this.name = data.name;
697
+ return this;
698
+ }
699
+ };
700
+
701
+ // src/structures/GuildSticker.ts
702
+ import { Routes as Routes5 } from "@fluxerjs/types";
703
+ var GuildSticker = class extends Base {
704
+ client;
705
+ id;
706
+ guildId;
707
+ name;
708
+ description;
709
+ tags;
710
+ animated;
711
+ /** @param data - API sticker from GET /guilds/{id}/stickers or guild sticker events */
712
+ constructor(client, data, guildId) {
713
+ super();
714
+ this.client = client;
715
+ this.id = data.id;
716
+ this.guildId = data.guild_id ?? guildId;
717
+ this.name = data.name;
718
+ this.description = data.description ?? "";
719
+ this.tags = data.tags ?? [];
720
+ this.animated = data.animated ?? false;
721
+ }
722
+ /** CDN URL for this sticker image. */
723
+ get url() {
724
+ const ext = this.animated ? "gif" : "png";
725
+ return `${CDN_URL}/stickers/${this.id}.${ext}`;
726
+ }
727
+ /** Delete this sticker. Requires Manage Emojis and Stickers permission. */
728
+ async delete() {
729
+ await this.client.rest.delete(Routes5.guildSticker(this.guildId, this.id), {
730
+ auth: true
731
+ });
732
+ }
733
+ /**
734
+ * Edit this sticker's name and/or description.
735
+ * Requires Manage Emojis and Stickers permission.
736
+ */
737
+ async edit(options) {
738
+ const data = await this.client.rest.patch(Routes5.guildSticker(this.guildId, this.id), {
739
+ body: options,
740
+ auth: true
741
+ });
742
+ const s = data;
743
+ this.name = s.name;
744
+ this.description = s.description ?? "";
745
+ return this;
746
+ }
747
+ };
748
+
639
749
  // src/errors/ErrorCodes.ts
640
750
  var ErrorCodes = {
641
751
  ClientNotReady: "CLIENT_NOT_READY",
@@ -644,7 +754,7 @@ var ErrorCodes = {
644
754
 
645
755
  // src/index.ts
646
756
  import { EmbedBuilder, MessagePayload, AttachmentBuilder } from "@fluxerjs/builders";
647
- import { Routes as Routes4, GatewayOpcodes } from "@fluxerjs/types";
757
+ import { Routes as Routes6, GatewayOpcodes } from "@fluxerjs/types";
648
758
  export {
649
759
  AttachmentBuilder,
650
760
  Base,
@@ -660,15 +770,19 @@ export {
660
770
  FluxerError,
661
771
  GatewayOpcodes,
662
772
  Guild,
773
+ GuildBan,
663
774
  GuildChannel,
775
+ GuildEmoji,
664
776
  GuildMember,
777
+ GuildSticker,
778
+ Invite,
665
779
  LinkChannel,
666
780
  Message,
667
781
  MessageManager,
668
782
  MessagePayload,
669
783
  MessageReaction,
670
784
  Role,
671
- Routes4 as Routes,
785
+ Routes6 as Routes,
672
786
  TextChannel,
673
787
  User,
674
788
  VoiceChannel,
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.0.8",
6
+ "version": "1.0.9",
7
7
  "description": "A fully-featured SDK for Fluxer bots",
8
8
  "repository": {
9
9
  "type": "git",
@@ -34,12 +34,12 @@
34
34
  "dist"
35
35
  ],
36
36
  "dependencies": {
37
- "@fluxerjs/rest": "1.0.8",
38
- "@fluxerjs/ws": "1.0.8",
39
- "@fluxerjs/collection": "1.0.8",
40
- "@fluxerjs/util": "1.0.8",
41
- "@fluxerjs/types": "1.0.8",
42
- "@fluxerjs/builders": "1.0.8"
37
+ "@fluxerjs/rest": "1.0.9",
38
+ "@fluxerjs/builders": "1.0.9",
39
+ "@fluxerjs/ws": "1.0.9",
40
+ "@fluxerjs/collection": "1.0.9",
41
+ "@fluxerjs/types": "1.0.9",
42
+ "@fluxerjs/util": "1.0.9"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@types/node": "^20.0.0",