@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.
Files changed (117) hide show
  1. package/dist/{Channel-OSOB6ELO.mjs → Channel-ICWNKXBR.mjs} +1 -1
  2. package/dist/{ClientUser-RNDKHQ3Z.mjs → ClientUser-WWXUMO5O.mjs} +1 -2
  3. package/dist/{Guild-GOQZ7XP4.mjs → Guild-TM6YGJWB.mjs} +3 -1
  4. package/dist/GuildBan-M4PA3HAA.mjs +7 -0
  5. package/dist/{GuildMember-BJJNCL6W.mjs → GuildMember-RZWZ3OCG.mjs} +1 -2
  6. package/dist/{Webhook-AG6QFM2I.mjs → Invite-UM5BU5A6.mjs} +3 -3
  7. package/dist/{Message-QXPHQOVC.mjs → Message-6IYEYSV6.mjs} +1 -2
  8. package/dist/MessageReaction-XRPYZDSC.mjs +7 -0
  9. package/dist/{Webhook-NUQCJAWZ.mjs → Role-SVLWIAMN.mjs} +3 -3
  10. package/dist/{Webhook-2RHBXH7R.mjs → Webhook-32VJD4AL.mjs} +1 -1
  11. package/dist/{chunk-T2NSVWBH.mjs → chunk-53Y37KRG.mjs} +35 -1
  12. package/dist/chunk-DSPSRPHF.mjs +200 -0
  13. package/dist/{chunk-WYSHH4LR.mjs → chunk-FJS5FBXO.mjs} +98 -6
  14. package/dist/{chunk-J3EIGOXQ.mjs → chunk-GCIJYVRC.mjs} +20 -6
  15. package/dist/{chunk-NISGA2YZ.mjs → chunk-GFUJVQ7L.mjs} +13 -4
  16. package/dist/chunk-HBF5QEDH.mjs +42 -0
  17. package/dist/chunk-QEXIYXXU.mjs +62 -0
  18. package/dist/chunk-RCP27MRC.mjs +33 -0
  19. package/dist/chunk-SQVCCSNN.mjs +41 -0
  20. package/dist/chunk-X77DFNE3.mjs +136 -0
  21. package/dist/index.d.mts +520 -55
  22. package/dist/index.d.ts +520 -55
  23. package/dist/index.js +1333 -404
  24. package/dist/index.mjs +616 -189
  25. package/package.json +27 -8
  26. package/dist/Channel-2WNJ445K.mjs +0 -17
  27. package/dist/Channel-BEZOW4VC.mjs +0 -17
  28. package/dist/Channel-DPLLHL7Y.mjs +0 -19
  29. package/dist/Channel-HM2UY4DN.mjs +0 -17
  30. package/dist/Channel-IKL3SJXN.mjs +0 -17
  31. package/dist/Channel-KILNV5V3.mjs +0 -17
  32. package/dist/Channel-KOTARBSF.mjs +0 -17
  33. package/dist/Channel-ON7O3D3M.mjs +0 -17
  34. package/dist/Channel-TOAQGSRX.mjs +0 -17
  35. package/dist/Channel-VENHOL7S.mjs +0 -17
  36. package/dist/Channel-YVGPVOVB.mjs +0 -17
  37. package/dist/ClientUser-6HBAPU6H.mjs +0 -8
  38. package/dist/ClientUser-ALGC4FNY.mjs +0 -8
  39. package/dist/ClientUser-J6HQVSDJ.mjs +0 -9
  40. package/dist/ClientUser-LLL6WX35.mjs +0 -8
  41. package/dist/ClientUser-N7ZXYAQ3.mjs +0 -8
  42. package/dist/Guild-36EGAAEW.mjs +0 -8
  43. package/dist/Guild-5UBZNIGD.mjs +0 -9
  44. package/dist/Guild-CA3W6DOD.mjs +0 -8
  45. package/dist/Guild-GIXJJBFM.mjs +0 -9
  46. package/dist/Guild-NHNQ5TIA.mjs +0 -8
  47. package/dist/Guild-S436SLOP.mjs +0 -9
  48. package/dist/Guild-WAFXK2EX.mjs +0 -9
  49. package/dist/Guild-XPOMHZZG.mjs +0 -9
  50. package/dist/Guild-ZOFF5LFR.mjs +0 -8
  51. package/dist/GuildMember-FX2JAWES.mjs +0 -8
  52. package/dist/GuildMember-K5FLBNHV.mjs +0 -8
  53. package/dist/GuildMember-RGVPVUAG.mjs +0 -9
  54. package/dist/GuildMember-UBNHZBCO.mjs +0 -8
  55. package/dist/GuildMember-UU26WJGN.mjs +0 -8
  56. package/dist/GuildMember-XF7K2R45.mjs +0 -9
  57. package/dist/Message-23Z3RPCZ.mjs +0 -9
  58. package/dist/Message-33APPS76.mjs +0 -9
  59. package/dist/Message-6RSAGIRP.mjs +0 -8
  60. package/dist/Message-OXTQHFCF.mjs +0 -8
  61. package/dist/Message-PZUU7ZFR.mjs +0 -9
  62. package/dist/Message-R7GZYIQQ.mjs +0 -8
  63. package/dist/Message-W624MHJF.mjs +0 -8
  64. package/dist/Message-XB5WNMHL.mjs +0 -9
  65. package/dist/Message-ZCS7IGJX.mjs +0 -8
  66. package/dist/Webhook-TGAZZRQQ.mjs +0 -7
  67. package/dist/chunk-2FIZRRSO.mjs +0 -88
  68. package/dist/chunk-3CNUPFDI.mjs +0 -59
  69. package/dist/chunk-4DBGMFOQ.mjs +0 -14
  70. package/dist/chunk-5HQRX3KJ.mjs +0 -70
  71. package/dist/chunk-62S4AB2S.mjs +0 -54
  72. package/dist/chunk-6CEMF2LO.mjs +0 -14
  73. package/dist/chunk-6EBNOON4.mjs +0 -86
  74. package/dist/chunk-72OY7B3D.mjs +0 -72
  75. package/dist/chunk-7FYM4D2E.mjs +0 -50
  76. package/dist/chunk-7GZN6JXT.mjs +0 -50
  77. package/dist/chunk-7H3TKJUT.mjs +0 -53
  78. package/dist/chunk-7SIS5CUA.mjs +0 -14
  79. package/dist/chunk-BGJSL6JI.mjs +0 -14
  80. package/dist/chunk-BUEXP5SZ.mjs +0 -70
  81. package/dist/chunk-BYTAODAO.mjs +0 -70
  82. package/dist/chunk-CQ5ZVTLX.mjs +0 -71
  83. package/dist/chunk-DJBCSVZX.mjs +0 -102
  84. package/dist/chunk-DLROMCIJ.mjs +0 -50
  85. package/dist/chunk-DPZHAYCK.mjs +0 -71
  86. package/dist/chunk-E75ZVY3I.mjs +0 -14
  87. package/dist/chunk-EF32ILJL.mjs +0 -102
  88. package/dist/chunk-F2EEQP5O.mjs +0 -86
  89. package/dist/chunk-FK5X6HFL.mjs +0 -111
  90. package/dist/chunk-FNFID6QB.mjs +0 -45
  91. package/dist/chunk-G4L7WAJS.mjs +0 -64
  92. package/dist/chunk-GUNWHOQO.mjs +0 -42
  93. package/dist/chunk-IPHFDI2L.mjs +0 -68
  94. package/dist/chunk-JJHZBWZM.mjs +0 -118
  95. package/dist/chunk-L25ON7WB.mjs +0 -52
  96. package/dist/chunk-LBBIQOSH.mjs +0 -53
  97. package/dist/chunk-LVMFPATK.mjs +0 -54
  98. package/dist/chunk-NOLYW3V4.mjs +0 -140
  99. package/dist/chunk-OHIHIQAS.mjs +0 -102
  100. package/dist/chunk-P4IRDGB4.mjs +0 -43
  101. package/dist/chunk-PO5JZQVN.mjs +0 -111
  102. package/dist/chunk-PYYXC7US.mjs +0 -76
  103. package/dist/chunk-QDCFQF6J.mjs +0 -36
  104. package/dist/chunk-QDNFJVVE.mjs +0 -70
  105. package/dist/chunk-QXJNV5EJ.mjs +0 -110
  106. package/dist/chunk-RXHJYGSJ.mjs +0 -53
  107. package/dist/chunk-SW6KNICI.mjs +0 -52
  108. package/dist/chunk-TE5IC7IP.mjs +0 -36
  109. package/dist/chunk-TMDZALIN.mjs +0 -110
  110. package/dist/chunk-WFONGZGK.mjs +0 -42
  111. package/dist/chunk-WZVY7DA6.mjs +0 -44
  112. package/dist/chunk-XTDZQD4A.mjs +0 -110
  113. package/dist/chunk-XXCBJJZE.mjs +0 -88
  114. package/dist/chunk-YKP7JHV2.mjs +0 -102
  115. package/dist/chunk-YSKZR66G.mjs +0 -102
  116. package/dist/chunk-ZHRQQZ4X.mjs +0 -102
  117. package/dist/chunk-ZMIMAMO2.mjs +0 -14
@@ -1,45 +0,0 @@
1
- import {
2
- User
3
- } from "./chunk-WZVY7DA6.mjs";
4
- import {
5
- Base
6
- } from "./chunk-XNS4O6QJ.mjs";
7
-
8
- // src/structures/GuildMember.ts
9
- import { Routes } from "@fluxerjs/types";
10
- var GuildMember = class extends Base {
11
- client;
12
- id;
13
- user;
14
- guild;
15
- nick;
16
- roles;
17
- joinedAt;
18
- communicationDisabledUntil;
19
- constructor(client, data, guild) {
20
- super();
21
- this.client = client;
22
- this.user = new User(client, data.user);
23
- this.id = data.user.id;
24
- this.guild = guild;
25
- this.nick = data.nick ?? null;
26
- this.roles = data.roles ?? [];
27
- this.joinedAt = new Date(data.joined_at);
28
- this.communicationDisabledUntil = data.communication_disabled_until ? new Date(data.communication_disabled_until) : null;
29
- }
30
- get displayName() {
31
- return this.nick ?? this.user.globalName ?? this.user.username;
32
- }
33
- /** Add a role to this member. Requires Manage Roles permission. */
34
- async addRole(roleId) {
35
- await this.client.rest.put(Routes.guildMemberRole(this.guild.id, this.id, roleId));
36
- }
37
- /** Remove a role from this member. Requires Manage Roles permission. */
38
- async removeRole(roleId) {
39
- await this.client.rest.delete(Routes.guildMemberRole(this.guild.id, this.id, roleId));
40
- }
41
- };
42
-
43
- export {
44
- GuildMember
45
- };
@@ -1,64 +0,0 @@
1
- import {
2
- GuildMember
3
- } from "./chunk-FNFID6QB.mjs";
4
- import {
5
- CDN_URL
6
- } from "./chunk-WZVY7DA6.mjs";
7
- import {
8
- Base
9
- } from "./chunk-XNS4O6QJ.mjs";
10
-
11
- // src/structures/Guild.ts
12
- import { Collection } from "@fluxerjs/collection";
13
- import { Routes } from "@fluxerjs/types";
14
- var Guild = class extends Base {
15
- client;
16
- id;
17
- name;
18
- icon;
19
- banner;
20
- ownerId;
21
- members = new Collection();
22
- channels = new Collection();
23
- constructor(client, data) {
24
- super();
25
- this.client = client;
26
- this.id = data.id;
27
- this.name = data.name;
28
- this.icon = data.icon ?? null;
29
- this.banner = data.banner ?? null;
30
- this.ownerId = data.owner_id;
31
- }
32
- iconURL(options) {
33
- if (!this.icon) return null;
34
- const size = options?.size ? `?size=${options.size}` : "";
35
- return `${CDN_URL}/icons/${this.id}/${this.icon}.png${size}`;
36
- }
37
- bannerURL(options) {
38
- if (!this.banner) return null;
39
- const size = options?.size ? `?size=${options.size}` : "";
40
- return `${CDN_URL}/banners/${this.id}/${this.banner}.png${size}`;
41
- }
42
- /** Fetch a guild member by user ID. Returns null if the member is not in the guild. */
43
- async fetchMember(userId) {
44
- try {
45
- const data = await this.client.rest.get(
46
- Routes.guildMember(this.id, userId)
47
- );
48
- return new GuildMember(this.client, { ...data, guild_id: this.id }, this);
49
- } catch {
50
- return null;
51
- }
52
- }
53
- /** Fetch all webhooks in this guild. Returned webhooks do not include the token (cannot send). */
54
- async fetchWebhooks() {
55
- const { Webhook } = await import("./Webhook-2RHBXH7R.mjs");
56
- const data = await this.client.rest.get(Routes.guildWebhooks(this.id));
57
- const list = Array.isArray(data) ? data : Object.values(data ?? {});
58
- return list.map((w) => new Webhook(this.client, w));
59
- }
60
- };
61
-
62
- export {
63
- Guild
64
- };
@@ -1,42 +0,0 @@
1
- import {
2
- CDN_URL
3
- } from "./chunk-HQMYRYMY.mjs";
4
- import {
5
- Base
6
- } from "./chunk-XNS4O6QJ.mjs";
7
-
8
- // src/structures/Guild.ts
9
- import { Collection } from "@fluxerjs/collection";
10
- var Guild = class extends Base {
11
- client;
12
- id;
13
- name;
14
- icon;
15
- banner;
16
- ownerId;
17
- members = new Collection();
18
- channels = new Collection();
19
- constructor(client, data) {
20
- super();
21
- this.client = client;
22
- this.id = data.id;
23
- this.name = data.name;
24
- this.icon = data.icon ?? null;
25
- this.banner = data.banner ?? null;
26
- this.ownerId = data.owner_id;
27
- }
28
- iconURL(options) {
29
- if (!this.icon) return null;
30
- const size = options?.size ? `?size=${options.size}` : "";
31
- return `${CDN_URL}/icons/${this.id}/${this.icon}.png${size}`;
32
- }
33
- bannerURL(options) {
34
- if (!this.banner) return null;
35
- const size = options?.size ? `?size=${options.size}` : "";
36
- return `${CDN_URL}/banners/${this.id}/${this.banner}.png${size}`;
37
- }
38
- };
39
-
40
- export {
41
- Guild
42
- };
@@ -1,68 +0,0 @@
1
- import {
2
- GuildMember
3
- } from "./chunk-RXHJYGSJ.mjs";
4
- import {
5
- CDN_URL
6
- } from "./chunk-WZVY7DA6.mjs";
7
- import {
8
- Base
9
- } from "./chunk-XNS4O6QJ.mjs";
10
-
11
- // src/structures/Guild.ts
12
- import { Collection } from "@fluxerjs/collection";
13
- import { Routes } from "@fluxerjs/types";
14
- var Guild = class extends Base {
15
- client;
16
- id;
17
- name;
18
- icon;
19
- banner;
20
- ownerId;
21
- members = new Collection();
22
- channels = new Collection();
23
- constructor(client, data) {
24
- super();
25
- this.client = client;
26
- this.id = data.id;
27
- this.name = data.name;
28
- this.icon = data.icon ?? null;
29
- this.banner = data.banner ?? null;
30
- this.ownerId = data.owner_id;
31
- }
32
- iconURL(options) {
33
- if (!this.icon) return null;
34
- const size = options?.size ? `?size=${options.size}` : "";
35
- return `${CDN_URL}/icons/${this.id}/${this.icon}.png${size}`;
36
- }
37
- bannerURL(options) {
38
- if (!this.banner) return null;
39
- const size = options?.size ? `?size=${options.size}` : "";
40
- return `${CDN_URL}/banners/${this.id}/${this.banner}.png${size}`;
41
- }
42
- /**
43
- * Fetch a guild member by user ID.
44
- * @param userId - The user ID of the member to fetch
45
- * @returns The guild member, or null if not found
46
- */
47
- async fetchMember(userId) {
48
- try {
49
- const data = await this.client.rest.get(
50
- Routes.guildMember(this.id, userId)
51
- );
52
- return new GuildMember(this.client, { ...data, guild_id: this.id }, this);
53
- } catch {
54
- return null;
55
- }
56
- }
57
- /** Fetch all webhooks in this guild. Returned webhooks do not include the token (cannot send). */
58
- async fetchWebhooks() {
59
- const { Webhook } = await import("./Webhook-2RHBXH7R.mjs");
60
- const data = await this.client.rest.get(Routes.guildWebhooks(this.id));
61
- const list = Array.isArray(data) ? data : Object.values(data ?? {});
62
- return list.map((w) => new Webhook(this.client, w));
63
- }
64
- };
65
-
66
- export {
67
- Guild
68
- };
@@ -1,118 +0,0 @@
1
- import {
2
- Base
3
- } from "./chunk-XNS4O6QJ.mjs";
4
-
5
- // src/structures/Channel.ts
6
- import { ChannelType, Routes } from "@fluxerjs/types";
7
- var Channel = class extends Base {
8
- client;
9
- id;
10
- type;
11
- constructor(client, data) {
12
- super();
13
- this.client = client;
14
- this.id = data.id;
15
- this.type = data.type;
16
- }
17
- /**
18
- * Create the appropriate channel subclass from API data.
19
- * @param client - The client instance
20
- * @param data - Channel data from the API
21
- */
22
- static from(client, data) {
23
- const type = data.type ?? 0;
24
- if (type === ChannelType.GuildText) return new TextChannel(client, data);
25
- if (type === ChannelType.GuildCategory) return new CategoryChannel(client, data);
26
- if (type === ChannelType.GuildVoice) return new VoiceChannel(client, data);
27
- if (type === ChannelType.GuildLink) return new LinkChannel(client, data);
28
- return new GuildChannel(client, data);
29
- }
30
- };
31
- var GuildChannel = class extends Channel {
32
- guildId;
33
- name;
34
- position;
35
- parentId;
36
- constructor(client, data) {
37
- super(client, data);
38
- this.guildId = data.guild_id ?? "";
39
- this.name = data.name ?? null;
40
- this.position = data.position;
41
- this.parentId = data.parent_id ?? null;
42
- }
43
- /**
44
- * Create a webhook in this channel.
45
- * @param options - Webhook name and optional avatar URL
46
- * @returns The webhook with token (required for send()). Requires Manage Webhooks permission.
47
- */
48
- async createWebhook(options) {
49
- const { Webhook } = await import("./Webhook-AG6QFM2I.mjs");
50
- const data = await this.client.rest.post(Routes.channelWebhooks(this.id), {
51
- body: options,
52
- auth: true
53
- });
54
- return new Webhook(this.client, data);
55
- }
56
- /**
57
- * Fetch all webhooks in this channel.
58
- * @returns Webhooks without token (cannot send). Requires Manage Webhooks permission.
59
- */
60
- async fetchWebhooks() {
61
- const { Webhook } = await import("./Webhook-AG6QFM2I.mjs");
62
- const data = await this.client.rest.get(Routes.channelWebhooks(this.id));
63
- const list = Array.isArray(data) ? data : Object.values(data ?? {});
64
- return list.map((w) => new Webhook(this.client, w));
65
- }
66
- };
67
- var TextChannel = class extends GuildChannel {
68
- topic;
69
- nsfw;
70
- rateLimitPerUser;
71
- lastMessageId;
72
- constructor(client, data) {
73
- super(client, data);
74
- this.topic = data.topic ?? null;
75
- this.nsfw = data.nsfw ?? false;
76
- this.rateLimitPerUser = data.rate_limit_per_user ?? 0;
77
- this.lastMessageId = data.last_message_id ?? null;
78
- }
79
- /**
80
- * Send a message to this channel.
81
- * @param options - Text content or object with `content` and/or `embeds`
82
- */
83
- async send(options) {
84
- const body = typeof options === "string" ? { content: options } : options;
85
- const { Message } = await import("./Message-QXPHQOVC.mjs");
86
- const data = await this.client.rest.post(Routes.channelMessages(this.id), { body });
87
- return new Message(this.client, data);
88
- }
89
- };
90
- var CategoryChannel = class extends GuildChannel {
91
- };
92
- var VoiceChannel = class extends GuildChannel {
93
- bitrate;
94
- userLimit;
95
- rtcRegion;
96
- constructor(client, data) {
97
- super(client, data);
98
- this.bitrate = data.bitrate ?? null;
99
- this.userLimit = data.user_limit ?? null;
100
- this.rtcRegion = data.rtc_region ?? null;
101
- }
102
- };
103
- var LinkChannel = class extends GuildChannel {
104
- url;
105
- constructor(client, data) {
106
- super(client, data);
107
- this.url = data.url ?? null;
108
- }
109
- };
110
-
111
- export {
112
- Channel,
113
- GuildChannel,
114
- TextChannel,
115
- CategoryChannel,
116
- VoiceChannel,
117
- LinkChannel
118
- };
@@ -1,52 +0,0 @@
1
- import {
2
- CDN_URL
3
- } from "./chunk-HQMYRYMY.mjs";
4
- import {
5
- Base
6
- } from "./chunk-XNS4O6QJ.mjs";
7
-
8
- // src/structures/Guild.ts
9
- import { Collection } from "@fluxerjs/collection";
10
- var Guild = class extends Base {
11
- client;
12
- /** Snowflake ID. */
13
- id;
14
- /** Guild name. */
15
- name;
16
- /** Icon hash, or null. */
17
- icon;
18
- /** Banner hash, or null. */
19
- banner;
20
- /** Owner user ID. */
21
- ownerId;
22
- /** Cached members. */
23
- members = new Collection();
24
- /** Cached channels. */
25
- channels = new Collection();
26
- /** @internal */
27
- constructor(client, data) {
28
- super();
29
- this.client = client;
30
- this.id = data.id;
31
- this.name = data.name;
32
- this.icon = data.icon ?? null;
33
- this.banner = data.banner ?? null;
34
- this.ownerId = data.owner_id;
35
- }
36
- /** CDN URL for the guild icon. */
37
- iconURL(options) {
38
- if (!this.icon) return null;
39
- const size = options?.size ? `?size=${options.size}` : "";
40
- return `${CDN_URL}/icons/${this.id}/${this.icon}.png${size}`;
41
- }
42
- /** CDN URL for the guild banner. */
43
- bannerURL(options) {
44
- if (!this.banner) return null;
45
- const size = options?.size ? `?size=${options.size}` : "";
46
- return `${CDN_URL}/banners/${this.id}/${this.banner}.png${size}`;
47
- }
48
- };
49
-
50
- export {
51
- Guild
52
- };
@@ -1,53 +0,0 @@
1
- import {
2
- User
3
- } from "./chunk-P4IRDGB4.mjs";
4
- import {
5
- Base
6
- } from "./chunk-XNS4O6QJ.mjs";
7
-
8
- // src/structures/Message.ts
9
- import { Collection } from "@fluxerjs/collection";
10
- import { Routes } from "@fluxerjs/types";
11
- var Message = class _Message extends Base {
12
- client;
13
- id;
14
- channelId;
15
- guildId;
16
- author;
17
- content;
18
- createdAt;
19
- editedAt;
20
- pinned;
21
- attachments;
22
- channel;
23
- constructor(client, data) {
24
- super();
25
- this.client = client;
26
- this.id = data.id;
27
- this.channelId = data.channel_id;
28
- this.guildId = data.guild_id ?? null;
29
- this.author = new User(client, data.author);
30
- this.content = data.content;
31
- this.createdAt = new Date(data.timestamp);
32
- this.editedAt = data.edited_timestamp ? new Date(data.edited_timestamp) : null;
33
- this.pinned = data.pinned;
34
- this.attachments = new Collection();
35
- for (const a of data.attachments ?? []) this.attachments.set(a.id, a);
36
- }
37
- async reply(options) {
38
- 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 } };
39
- const data = await this.client.rest.post(Routes.channelMessages(this.channelId), { body });
40
- return new _Message(this.client, data);
41
- }
42
- async edit(options) {
43
- const data = await this.client.rest.patch(Routes.channelMessage(this.channelId, this.id), { body: options });
44
- return new _Message(this.client, data);
45
- }
46
- async delete() {
47
- await this.client.rest.delete(Routes.channelMessage(this.channelId, this.id));
48
- }
49
- };
50
-
51
- export {
52
- Message
53
- };
@@ -1,54 +0,0 @@
1
- import {
2
- User
3
- } from "./chunk-DLROMCIJ.mjs";
4
- import {
5
- Base
6
- } from "./chunk-XNS4O6QJ.mjs";
7
-
8
- // src/structures/GuildMember.ts
9
- import { Routes } from "@fluxerjs/types";
10
- var GuildMember = class extends Base {
11
- client;
12
- id;
13
- user;
14
- guild;
15
- nick;
16
- roles;
17
- joinedAt;
18
- communicationDisabledUntil;
19
- constructor(client, data, guild) {
20
- super();
21
- this.client = client;
22
- this.user = new User(client, data.user);
23
- this.id = data.user.id;
24
- this.guild = guild;
25
- this.nick = data.nick ?? null;
26
- this.roles = data.roles ?? [];
27
- this.joinedAt = new Date(data.joined_at);
28
- this.communicationDisabledUntil = data.communication_disabled_until ? new Date(data.communication_disabled_until) : null;
29
- }
30
- /** Nickname, or global name, or username. */
31
- get displayName() {
32
- return this.nick ?? this.user.globalName ?? this.user.username;
33
- }
34
- /**
35
- * Add a role to this member.
36
- * @param roleId - The role ID to add
37
- * Requires Manage Roles permission.
38
- */
39
- async addRole(roleId) {
40
- await this.client.rest.put(Routes.guildMemberRole(this.guild.id, this.id, roleId));
41
- }
42
- /**
43
- * Remove a role from this member.
44
- * @param roleId - The role ID to remove
45
- * Requires Manage Roles permission.
46
- */
47
- async removeRole(roleId) {
48
- await this.client.rest.delete(Routes.guildMemberRole(this.guild.id, this.id, roleId));
49
- }
50
- };
51
-
52
- export {
53
- GuildMember
54
- };
@@ -1,140 +0,0 @@
1
- import {
2
- Base
3
- } from "./chunk-XNS4O6QJ.mjs";
4
-
5
- // src/structures/Channel.ts
6
- import { ChannelType, Routes } from "@fluxerjs/types";
7
- var Channel = class extends Base {
8
- /** Create a DM channel from API data (type DM or GroupDM). */
9
- static createDM(client, data) {
10
- return new DMChannel(client, data);
11
- }
12
- client;
13
- id;
14
- type;
15
- constructor(client, data) {
16
- super();
17
- this.client = client;
18
- this.id = data.id;
19
- this.type = data.type;
20
- }
21
- /**
22
- * Create the appropriate channel subclass from API data.
23
- * @param client - The client instance
24
- * @param data - Channel data from the API
25
- */
26
- static from(client, data) {
27
- const type = data.type ?? 0;
28
- if (type === ChannelType.GuildText) return new TextChannel(client, data);
29
- if (type === ChannelType.GuildCategory) return new CategoryChannel(client, data);
30
- if (type === ChannelType.GuildVoice) return new VoiceChannel(client, data);
31
- if (type === ChannelType.GuildLink) return new LinkChannel(client, data);
32
- return new GuildChannel(client, data);
33
- }
34
- };
35
- var GuildChannel = class extends Channel {
36
- guildId;
37
- name;
38
- position;
39
- parentId;
40
- constructor(client, data) {
41
- super(client, data);
42
- this.guildId = data.guild_id ?? "";
43
- this.name = data.name ?? null;
44
- this.position = data.position;
45
- this.parentId = data.parent_id ?? null;
46
- }
47
- /**
48
- * Create a webhook in this channel.
49
- * @param options - Webhook name and optional avatar URL
50
- * @returns The webhook with token (required for send()). Requires Manage Webhooks permission.
51
- */
52
- async createWebhook(options) {
53
- const { Webhook } = await import("./Webhook-AG6QFM2I.mjs");
54
- const data = await this.client.rest.post(Routes.channelWebhooks(this.id), {
55
- body: options,
56
- auth: true
57
- });
58
- return new Webhook(this.client, data);
59
- }
60
- /**
61
- * Fetch all webhooks in this channel.
62
- * @returns Webhooks without token (cannot send). Requires Manage Webhooks permission.
63
- */
64
- async fetchWebhooks() {
65
- const { Webhook } = await import("./Webhook-AG6QFM2I.mjs");
66
- const data = await this.client.rest.get(Routes.channelWebhooks(this.id));
67
- const list = Array.isArray(data) ? data : Object.values(data ?? {});
68
- return list.map((w) => new Webhook(this.client, w));
69
- }
70
- };
71
- var TextChannel = class extends GuildChannel {
72
- topic;
73
- nsfw;
74
- rateLimitPerUser;
75
- lastMessageId;
76
- constructor(client, data) {
77
- super(client, data);
78
- this.topic = data.topic ?? null;
79
- this.nsfw = data.nsfw ?? false;
80
- this.rateLimitPerUser = data.rate_limit_per_user ?? 0;
81
- this.lastMessageId = data.last_message_id ?? null;
82
- }
83
- /**
84
- * Send a message to this channel.
85
- * @param options - Text content or object with `content` and/or `embeds`
86
- */
87
- async send(options) {
88
- const body = typeof options === "string" ? { content: options } : options;
89
- const { Message } = await import("./Message-ZCS7IGJX.mjs");
90
- const data = await this.client.rest.post(Routes.channelMessages(this.id), { body });
91
- return new Message(this.client, data);
92
- }
93
- };
94
- var CategoryChannel = class extends GuildChannel {
95
- };
96
- var VoiceChannel = class extends GuildChannel {
97
- bitrate;
98
- userLimit;
99
- rtcRegion;
100
- constructor(client, data) {
101
- super(client, data);
102
- this.bitrate = data.bitrate ?? null;
103
- this.userLimit = data.user_limit ?? null;
104
- this.rtcRegion = data.rtc_region ?? null;
105
- }
106
- };
107
- var LinkChannel = class extends GuildChannel {
108
- url;
109
- constructor(client, data) {
110
- super(client, data);
111
- this.url = data.url ?? null;
112
- }
113
- };
114
- var DMChannel = class extends Channel {
115
- lastMessageId;
116
- constructor(client, data) {
117
- super(client, data);
118
- this.lastMessageId = data.last_message_id ?? null;
119
- }
120
- /**
121
- * Send a message to this DM channel.
122
- * @param options - Text content or object with `content` and/or `embeds`
123
- */
124
- async send(options) {
125
- const body = typeof options === "string" ? { content: options } : options;
126
- const { Message } = await import("./Message-ZCS7IGJX.mjs");
127
- const data = await this.client.rest.post(Routes.channelMessages(this.id), { body });
128
- return new Message(this.client, data);
129
- }
130
- };
131
-
132
- export {
133
- Channel,
134
- GuildChannel,
135
- TextChannel,
136
- CategoryChannel,
137
- VoiceChannel,
138
- LinkChannel,
139
- DMChannel
140
- };