@fluxerjs/core 1.0.5 → 1.0.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.
Files changed (69) hide show
  1. package/dist/Channel-BEZOW4VC.mjs +17 -0
  2. package/dist/Channel-DPLLHL7Y.mjs +19 -0
  3. package/dist/Channel-IKL3SJXN.mjs +17 -0
  4. package/dist/Channel-KOTARBSF.mjs +17 -0
  5. package/dist/Channel-ON7O3D3M.mjs +17 -0
  6. package/dist/Channel-OSOB6ELO.mjs +19 -0
  7. package/dist/Channel-YVGPVOVB.mjs +17 -0
  8. package/dist/ClientUser-6HBAPU6H.mjs +8 -0
  9. package/dist/ClientUser-ALGC4FNY.mjs +8 -0
  10. package/dist/ClientUser-LLL6WX35.mjs +8 -0
  11. package/dist/ClientUser-N7ZXYAQ3.mjs +8 -0
  12. package/dist/Guild-5UBZNIGD.mjs +9 -0
  13. package/dist/Guild-GIXJJBFM.mjs +9 -0
  14. package/dist/Guild-S436SLOP.mjs +9 -0
  15. package/dist/Guild-WAFXK2EX.mjs +9 -0
  16. package/dist/Guild-XPOMHZZG.mjs +9 -0
  17. package/dist/GuildMember-BJJNCL6W.mjs +8 -0
  18. package/dist/GuildMember-FX2JAWES.mjs +8 -0
  19. package/dist/GuildMember-K5FLBNHV.mjs +8 -0
  20. package/dist/GuildMember-UBNHZBCO.mjs +8 -0
  21. package/dist/GuildMember-UU26WJGN.mjs +8 -0
  22. package/dist/Message-33APPS76.mjs +9 -0
  23. package/dist/Message-6RSAGIRP.mjs +8 -0
  24. package/dist/Message-OXTQHFCF.mjs +8 -0
  25. package/dist/Message-QXPHQOVC.mjs +8 -0
  26. package/dist/Message-R7GZYIQQ.mjs +8 -0
  27. package/dist/Message-W624MHJF.mjs +8 -0
  28. package/dist/Message-ZCS7IGJX.mjs +8 -0
  29. package/dist/Webhook-AG6QFM2I.mjs +7 -0
  30. package/dist/Webhook-TGAZZRQQ.mjs +7 -0
  31. package/dist/chunk-2FIZRRSO.mjs +88 -0
  32. package/dist/chunk-3CNUPFDI.mjs +59 -0
  33. package/dist/chunk-5HQRX3KJ.mjs +70 -0
  34. package/dist/chunk-62S4AB2S.mjs +54 -0
  35. package/dist/chunk-7SIS5CUA.mjs +14 -0
  36. package/dist/chunk-BGJSL6JI.mjs +14 -0
  37. package/dist/chunk-BYTAODAO.mjs +70 -0
  38. package/dist/chunk-CQ5ZVTLX.mjs +71 -0
  39. package/dist/chunk-DJBCSVZX.mjs +102 -0
  40. package/dist/chunk-DLROMCIJ.mjs +50 -0
  41. package/dist/chunk-DPZHAYCK.mjs +71 -0
  42. package/dist/chunk-E75ZVY3I.mjs +14 -0
  43. package/dist/chunk-FK5X6HFL.mjs +111 -0
  44. package/dist/chunk-FNFID6QB.mjs +45 -0
  45. package/dist/chunk-G4L7WAJS.mjs +64 -0
  46. package/dist/chunk-IPHFDI2L.mjs +68 -0
  47. package/dist/chunk-J3EIGOXQ.mjs +72 -0
  48. package/dist/chunk-JJHZBWZM.mjs +118 -0
  49. package/dist/chunk-LVMFPATK.mjs +54 -0
  50. package/dist/chunk-NISGA2YZ.mjs +55 -0
  51. package/dist/chunk-NOLYW3V4.mjs +140 -0
  52. package/dist/chunk-OHIHIQAS.mjs +102 -0
  53. package/dist/chunk-PO5JZQVN.mjs +111 -0
  54. package/dist/chunk-PYYXC7US.mjs +76 -0
  55. package/dist/chunk-QXJNV5EJ.mjs +110 -0
  56. package/dist/chunk-RXHJYGSJ.mjs +53 -0
  57. package/dist/chunk-T2NSVWBH.mjs +77 -0
  58. package/dist/chunk-TMDZALIN.mjs +110 -0
  59. package/dist/chunk-WYSHH4LR.mjs +141 -0
  60. package/dist/chunk-WZVY7DA6.mjs +44 -0
  61. package/dist/chunk-XTDZQD4A.mjs +110 -0
  62. package/dist/chunk-YKP7JHV2.mjs +102 -0
  63. package/dist/chunk-YSKZR66G.mjs +102 -0
  64. package/dist/chunk-ZMIMAMO2.mjs +14 -0
  65. package/dist/index.d.mts +208 -51
  66. package/dist/index.d.ts +208 -51
  67. package/dist/index.js +361 -177
  68. package/dist/index.mjs +38 -25
  69. package/package.json +7 -7
@@ -0,0 +1,76 @@
1
+ import {
2
+ Base
3
+ } from "./chunk-XNS4O6QJ.mjs";
4
+
5
+ // src/structures/Webhook.ts
6
+ import { Routes } from "@fluxerjs/types";
7
+ var Webhook = class _Webhook extends Base {
8
+ client;
9
+ id;
10
+ guildId;
11
+ channelId;
12
+ name;
13
+ avatar;
14
+ /** Present only when webhook was created via createWebhook(); not returned when fetching. */
15
+ token;
16
+ constructor(client, data) {
17
+ super();
18
+ this.client = client;
19
+ this.id = data.id;
20
+ this.guildId = data.guild_id;
21
+ this.channelId = data.channel_id;
22
+ this.name = data.name ?? "Unknown";
23
+ this.avatar = data.avatar ?? null;
24
+ this.token = data.token ?? null;
25
+ }
26
+ /** Delete this webhook. Requires bot token with Manage Webhooks permission. */
27
+ async delete() {
28
+ await this.client.rest.delete(Routes.webhook(this.id), { auth: true });
29
+ }
30
+ /**
31
+ * Send a message via this webhook. Requires the webhook token (only present when created, not when fetched).
32
+ * @throws Error if token is not available
33
+ */
34
+ async send(options) {
35
+ if (!this.token) {
36
+ throw new Error("Webhook token is required to send. The token is only returned when creating a webhook; fetched webhooks cannot send.");
37
+ }
38
+ const body = typeof options === "string" ? { content: options } : options;
39
+ await this.client.rest.post(Routes.webhookExecute(this.id, this.token), {
40
+ body,
41
+ auth: false
42
+ });
43
+ }
44
+ /**
45
+ * Fetch a webhook by ID using bot auth.
46
+ * @param client - The client instance
47
+ * @param webhookId - The webhook ID
48
+ * @returns Webhook without token (cannot send)
49
+ */
50
+ static async fetch(client, webhookId) {
51
+ const data = await client.rest.get(Routes.webhook(webhookId));
52
+ return new _Webhook(client, data);
53
+ }
54
+ /**
55
+ * Create a Webhook instance from an ID and token (e.g. from a stored webhook URL).
56
+ * @param client - The client instance
57
+ * @param webhookId - The webhook ID
58
+ * @param token - The webhook token (from createWebhook or stored)
59
+ * @param options - Optional channelId, guildId, name for display
60
+ */
61
+ static fromToken(client, webhookId, token, options) {
62
+ return new _Webhook(client, {
63
+ id: webhookId,
64
+ guild_id: options?.guildId ?? "",
65
+ channel_id: options?.channelId ?? "",
66
+ name: options?.name ?? "Webhook",
67
+ avatar: null,
68
+ token,
69
+ user: { id: "", username: "webhook", discriminator: "0" }
70
+ });
71
+ }
72
+ };
73
+
74
+ export {
75
+ Webhook
76
+ };
@@ -0,0 +1,110 @@
1
+ import {
2
+ User
3
+ } from "./chunk-WZVY7DA6.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
+ import { EmbedBuilder } from "@fluxerjs/builders";
12
+ var Message = class _Message extends Base {
13
+ client;
14
+ id;
15
+ channelId;
16
+ guildId;
17
+ author;
18
+ content;
19
+ createdAt;
20
+ editedAt;
21
+ pinned;
22
+ attachments;
23
+ channel;
24
+ constructor(client, data) {
25
+ super();
26
+ this.client = client;
27
+ this.id = data.id;
28
+ this.channelId = data.channel_id;
29
+ this.guildId = data.guild_id ?? null;
30
+ this.author = new User(client, data.author);
31
+ this.content = data.content;
32
+ this.createdAt = new Date(data.timestamp);
33
+ this.editedAt = data.edited_timestamp ? new Date(data.edited_timestamp) : null;
34
+ this.pinned = data.pinned;
35
+ this.attachments = new Collection();
36
+ for (const a of data.attachments ?? []) this.attachments.set(a.id, a);
37
+ }
38
+ /**
39
+ * Reply to this message.
40
+ * @param options - Text content or object with content and/or embeds
41
+ */
42
+ async reply(options) {
43
+ 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 } };
44
+ const data = await this.client.rest.post(Routes.channelMessages(this.channelId), { body });
45
+ return new _Message(this.client, data);
46
+ }
47
+ /**
48
+ * Edit this message. Only the author (or admins) can edit.
49
+ * @param options - New content and/or embeds
50
+ */
51
+ async edit(options) {
52
+ const body = {};
53
+ if (options.content !== void 0) body.content = options.content;
54
+ if (options.embeds?.length) {
55
+ body.embeds = options.embeds.map((e) => e instanceof EmbedBuilder ? e.toJSON() : e);
56
+ }
57
+ const data = await this.client.rest.patch(Routes.channelMessage(this.channelId, this.id), { body });
58
+ return new _Message(this.client, data);
59
+ }
60
+ /** Delete this message. */
61
+ async delete() {
62
+ await this.client.rest.delete(Routes.channelMessage(this.channelId, this.id));
63
+ }
64
+ /**
65
+ * Format emoji for reaction API: unicode string or "name:id" for custom.
66
+ * @param emoji - Unicode emoji (e.g. "👍") or custom { name, id } or "name:id" string
67
+ */
68
+ static formatEmoji(emoji) {
69
+ if (typeof emoji === "string") return emoji;
70
+ return `${emoji.name}:${emoji.id}`;
71
+ }
72
+ /**
73
+ * Add a reaction to this message (as the bot).
74
+ * @param emoji - Unicode emoji (e.g. `👍`) or custom emoji `{ name, id }`
75
+ */
76
+ async react(emoji) {
77
+ const emojiStr = _Message.formatEmoji(emoji);
78
+ const route = `${Routes.channelMessageReaction(this.channelId, this.id, emojiStr)}/@me`;
79
+ await this.client.rest.put(route);
80
+ }
81
+ /**
82
+ * Remove the bot's reaction, or a specific user's reaction if userId is provided.
83
+ * @param emoji - Unicode emoji or custom `{ name, id }`
84
+ * @param userId - If provided, removes that user's reaction (requires moderator permissions)
85
+ */
86
+ async removeReaction(emoji, userId) {
87
+ const emojiStr = _Message.formatEmoji(emoji);
88
+ const route = `${Routes.channelMessageReaction(this.channelId, this.id, emojiStr)}/${userId ?? "@me"}`;
89
+ await this.client.rest.delete(route);
90
+ }
91
+ /**
92
+ * Remove all reactions from this message.
93
+ * Requires moderator permissions.
94
+ */
95
+ async removeAllReactions() {
96
+ await this.client.rest.delete(Routes.channelMessageReactions(this.channelId, this.id));
97
+ }
98
+ /**
99
+ * Remove all reactions of a specific emoji from this message.
100
+ * @param emoji - Unicode emoji or custom `{ name, id }`. Requires moderator permissions.
101
+ */
102
+ async removeReactionEmoji(emoji) {
103
+ const emojiStr = _Message.formatEmoji(emoji);
104
+ await this.client.rest.delete(Routes.channelMessageReaction(this.channelId, this.id, emojiStr));
105
+ }
106
+ };
107
+
108
+ export {
109
+ Message
110
+ };
@@ -0,0 +1,53 @@
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
+ /**
34
+ * Add a role to this member.
35
+ * @param roleId - The role ID to add
36
+ * Requires Manage Roles permission.
37
+ */
38
+ async addRole(roleId) {
39
+ await this.client.rest.put(Routes.guildMemberRole(this.guild.id, this.id, roleId));
40
+ }
41
+ /**
42
+ * Remove a role from this member.
43
+ * @param roleId - The role ID to remove
44
+ * Requires Manage Roles permission.
45
+ */
46
+ async removeRole(roleId) {
47
+ await this.client.rest.delete(Routes.guildMemberRole(this.guild.id, this.id, roleId));
48
+ }
49
+ };
50
+
51
+ export {
52
+ GuildMember
53
+ };
@@ -0,0 +1,77 @@
1
+ import {
2
+ Base
3
+ } from "./chunk-XNS4O6QJ.mjs";
4
+
5
+ // src/structures/Webhook.ts
6
+ import { Routes } from "@fluxerjs/types";
7
+ var Webhook = class _Webhook extends Base {
8
+ client;
9
+ id;
10
+ guildId;
11
+ channelId;
12
+ name;
13
+ avatar;
14
+ /** Present only when webhook was created via createWebhook(); not returned when fetching. */
15
+ token;
16
+ /** @param data - API webhook from POST /channels/{id}/webhooks (has token) or GET /webhooks/{id} (no token) */
17
+ constructor(client, data) {
18
+ super();
19
+ this.client = client;
20
+ this.id = data.id;
21
+ this.guildId = data.guild_id;
22
+ this.channelId = data.channel_id;
23
+ this.name = data.name ?? "Unknown";
24
+ this.avatar = data.avatar ?? null;
25
+ this.token = data.token ?? null;
26
+ }
27
+ /** Delete this webhook. Requires bot token with Manage Webhooks permission. */
28
+ async delete() {
29
+ await this.client.rest.delete(Routes.webhook(this.id), { auth: true });
30
+ }
31
+ /**
32
+ * Send a message via this webhook. Requires the webhook token (only present when created, not when fetched).
33
+ * @throws Error if token is not available
34
+ */
35
+ async send(options) {
36
+ if (!this.token) {
37
+ throw new Error("Webhook token is required to send. The token is only returned when creating a webhook; fetched webhooks cannot send.");
38
+ }
39
+ const body = typeof options === "string" ? { content: options } : options;
40
+ await this.client.rest.post(Routes.webhookExecute(this.id, this.token), {
41
+ body,
42
+ auth: false
43
+ });
44
+ }
45
+ /**
46
+ * Fetch a webhook by ID using bot auth.
47
+ * @param client - The client instance
48
+ * @param webhookId - The webhook ID
49
+ * @returns Webhook without token (cannot send)
50
+ */
51
+ static async fetch(client, webhookId) {
52
+ const data = await client.rest.get(Routes.webhook(webhookId));
53
+ return new _Webhook(client, data);
54
+ }
55
+ /**
56
+ * Create a Webhook instance from an ID and token (e.g. from a stored webhook URL).
57
+ * @param client - The client instance
58
+ * @param webhookId - The webhook ID
59
+ * @param token - The webhook token (from createWebhook or stored)
60
+ * @param options - Optional channelId, guildId, name for display
61
+ */
62
+ static fromToken(client, webhookId, token, options) {
63
+ return new _Webhook(client, {
64
+ id: webhookId,
65
+ guild_id: options?.guildId ?? "",
66
+ channel_id: options?.channelId ?? "",
67
+ name: options?.name ?? "Webhook",
68
+ avatar: null,
69
+ token,
70
+ user: { id: "", username: "webhook", discriminator: "0" }
71
+ });
72
+ }
73
+ };
74
+
75
+ export {
76
+ Webhook
77
+ };
@@ -0,0 +1,110 @@
1
+ import {
2
+ User
3
+ } from "./chunk-CQ5ZVTLX.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
+ import { EmbedBuilder } from "@fluxerjs/builders";
12
+ var Message = class _Message extends Base {
13
+ client;
14
+ id;
15
+ channelId;
16
+ guildId;
17
+ author;
18
+ content;
19
+ createdAt;
20
+ editedAt;
21
+ pinned;
22
+ attachments;
23
+ channel;
24
+ constructor(client, data) {
25
+ super();
26
+ this.client = client;
27
+ this.id = data.id;
28
+ this.channelId = data.channel_id;
29
+ this.guildId = data.guild_id ?? null;
30
+ this.author = new User(client, data.author);
31
+ this.content = data.content;
32
+ this.createdAt = new Date(data.timestamp);
33
+ this.editedAt = data.edited_timestamp ? new Date(data.edited_timestamp) : null;
34
+ this.pinned = data.pinned;
35
+ this.attachments = new Collection();
36
+ for (const a of data.attachments ?? []) this.attachments.set(a.id, a);
37
+ }
38
+ /**
39
+ * Reply to this message.
40
+ * @param options - Text content or object with content and/or embeds
41
+ */
42
+ async reply(options) {
43
+ 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 } };
44
+ const data = await this.client.rest.post(Routes.channelMessages(this.channelId), { body });
45
+ return new _Message(this.client, data);
46
+ }
47
+ /**
48
+ * Edit this message. Only the author (or admins) can edit.
49
+ * @param options - New content and/or embeds
50
+ */
51
+ async edit(options) {
52
+ const body = {};
53
+ if (options.content !== void 0) body.content = options.content;
54
+ if (options.embeds?.length) {
55
+ body.embeds = options.embeds.map((e) => e instanceof EmbedBuilder ? e.toJSON() : e);
56
+ }
57
+ const data = await this.client.rest.patch(Routes.channelMessage(this.channelId, this.id), { body });
58
+ return new _Message(this.client, data);
59
+ }
60
+ /** Delete this message. */
61
+ async delete() {
62
+ await this.client.rest.delete(Routes.channelMessage(this.channelId, this.id));
63
+ }
64
+ /**
65
+ * Format emoji for reaction API: unicode string or "name:id" for custom.
66
+ * @param emoji - Unicode emoji (e.g. "👍") or custom { name, id } or "name:id" string
67
+ */
68
+ static formatEmoji(emoji) {
69
+ if (typeof emoji === "string") return emoji;
70
+ return `${emoji.name}:${emoji.id}`;
71
+ }
72
+ /**
73
+ * Add a reaction to this message (as the bot).
74
+ * @param emoji - Unicode emoji (e.g. `👍`) or custom emoji `{ name, id }`
75
+ */
76
+ async react(emoji) {
77
+ const emojiStr = _Message.formatEmoji(emoji);
78
+ const route = `${Routes.channelMessageReaction(this.channelId, this.id, emojiStr)}/@me`;
79
+ await this.client.rest.put(route);
80
+ }
81
+ /**
82
+ * Remove the bot's reaction, or a specific user's reaction if userId is provided.
83
+ * @param emoji - Unicode emoji or custom `{ name, id }`
84
+ * @param userId - If provided, removes that user's reaction (requires moderator permissions)
85
+ */
86
+ async removeReaction(emoji, userId) {
87
+ const emojiStr = _Message.formatEmoji(emoji);
88
+ const route = `${Routes.channelMessageReaction(this.channelId, this.id, emojiStr)}/${userId ?? "@me"}`;
89
+ await this.client.rest.delete(route);
90
+ }
91
+ /**
92
+ * Remove all reactions from this message.
93
+ * Requires moderator permissions.
94
+ */
95
+ async removeAllReactions() {
96
+ await this.client.rest.delete(Routes.channelMessageReactions(this.channelId, this.id));
97
+ }
98
+ /**
99
+ * Remove all reactions of a specific emoji from this message.
100
+ * @param emoji - Unicode emoji or custom `{ name, id }`. Requires moderator permissions.
101
+ */
102
+ async removeReactionEmoji(emoji) {
103
+ const emojiStr = _Message.formatEmoji(emoji);
104
+ await this.client.rest.delete(Routes.channelMessageReaction(this.channelId, this.id, emojiStr));
105
+ }
106
+ };
107
+
108
+ export {
109
+ Message
110
+ };
@@ -0,0 +1,141 @@
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
+ /** @param data - API channel from GET /channels/{id} or GET /guilds/{id}/channels */
16
+ constructor(client, data) {
17
+ super();
18
+ this.client = client;
19
+ this.id = data.id;
20
+ this.type = data.type;
21
+ }
22
+ /**
23
+ * Create the appropriate channel subclass from API data.
24
+ * @param client - The client instance
25
+ * @param data - Channel data from the API
26
+ */
27
+ static from(client, data) {
28
+ const type = data.type ?? 0;
29
+ if (type === ChannelType.GuildText) return new TextChannel(client, data);
30
+ if (type === ChannelType.GuildCategory) return new CategoryChannel(client, data);
31
+ if (type === ChannelType.GuildVoice) return new VoiceChannel(client, data);
32
+ if (type === ChannelType.GuildLink || type === ChannelType.GuildLinkExtended) return new LinkChannel(client, data);
33
+ return new GuildChannel(client, data);
34
+ }
35
+ };
36
+ var GuildChannel = class extends Channel {
37
+ guildId;
38
+ name;
39
+ position;
40
+ parentId;
41
+ constructor(client, data) {
42
+ super(client, data);
43
+ this.guildId = data.guild_id ?? "";
44
+ this.name = data.name ?? null;
45
+ this.position = data.position;
46
+ this.parentId = data.parent_id ?? null;
47
+ }
48
+ /**
49
+ * Create a webhook in this channel.
50
+ * @param options - Webhook name and optional avatar URL
51
+ * @returns The webhook with token (required for send()). Requires Manage Webhooks permission.
52
+ */
53
+ async createWebhook(options) {
54
+ const { Webhook } = await import("./Webhook-TGAZZRQQ.mjs");
55
+ const data = await this.client.rest.post(Routes.channelWebhooks(this.id), {
56
+ body: options,
57
+ auth: true
58
+ });
59
+ return new Webhook(this.client, data);
60
+ }
61
+ /**
62
+ * Fetch all webhooks in this channel.
63
+ * @returns Webhooks (includes token when listing from channel; can send via send())
64
+ */
65
+ async fetchWebhooks() {
66
+ const { Webhook } = await import("./Webhook-TGAZZRQQ.mjs");
67
+ const data = await this.client.rest.get(Routes.channelWebhooks(this.id));
68
+ const list = Array.isArray(data) ? data : Object.values(data ?? {});
69
+ return list.map((w) => new Webhook(this.client, w));
70
+ }
71
+ };
72
+ var TextChannel = class extends GuildChannel {
73
+ topic;
74
+ nsfw;
75
+ rateLimitPerUser;
76
+ lastMessageId;
77
+ constructor(client, data) {
78
+ super(client, data);
79
+ this.topic = data.topic ?? null;
80
+ this.nsfw = data.nsfw ?? false;
81
+ this.rateLimitPerUser = data.rate_limit_per_user ?? 0;
82
+ this.lastMessageId = data.last_message_id ?? null;
83
+ }
84
+ /**
85
+ * Send a message to this channel.
86
+ * @param options - Text content or object with `content` and/or `embeds`
87
+ */
88
+ async send(options) {
89
+ const body = typeof options === "string" ? { content: options } : options;
90
+ const { Message } = await import("./Message-W624MHJF.mjs");
91
+ const data = await this.client.rest.post(Routes.channelMessages(this.id), { body });
92
+ return new Message(this.client, data);
93
+ }
94
+ };
95
+ var CategoryChannel = class extends GuildChannel {
96
+ };
97
+ var VoiceChannel = class extends GuildChannel {
98
+ bitrate;
99
+ userLimit;
100
+ rtcRegion;
101
+ constructor(client, data) {
102
+ super(client, data);
103
+ this.bitrate = data.bitrate ?? null;
104
+ this.userLimit = data.user_limit ?? null;
105
+ this.rtcRegion = data.rtc_region ?? null;
106
+ }
107
+ };
108
+ var LinkChannel = class extends GuildChannel {
109
+ url;
110
+ constructor(client, data) {
111
+ super(client, data);
112
+ this.url = data.url ?? null;
113
+ }
114
+ };
115
+ var DMChannel = class extends Channel {
116
+ lastMessageId;
117
+ constructor(client, data) {
118
+ super(client, data);
119
+ this.lastMessageId = data.last_message_id ?? null;
120
+ }
121
+ /**
122
+ * Send a message to this DM channel.
123
+ * @param options - Text content or object with `content` and/or `embeds`
124
+ */
125
+ async send(options) {
126
+ const body = typeof options === "string" ? { content: options } : options;
127
+ const { Message } = await import("./Message-W624MHJF.mjs");
128
+ const data = await this.client.rest.post(Routes.channelMessages(this.id), { body });
129
+ return new Message(this.client, data);
130
+ }
131
+ };
132
+
133
+ export {
134
+ Channel,
135
+ GuildChannel,
136
+ TextChannel,
137
+ CategoryChannel,
138
+ VoiceChannel,
139
+ LinkChannel,
140
+ DMChannel
141
+ };
@@ -0,0 +1,44 @@
1
+ import {
2
+ Base
3
+ } from "./chunk-XNS4O6QJ.mjs";
4
+
5
+ // src/util/Constants.ts
6
+ var CDN_URL = "https://fluxerusercontent.com";
7
+
8
+ // src/structures/User.ts
9
+ var User = class extends Base {
10
+ client;
11
+ id;
12
+ username;
13
+ discriminator;
14
+ globalName;
15
+ avatar;
16
+ bot;
17
+ constructor(client, data) {
18
+ super();
19
+ this.client = client;
20
+ this.id = data.id;
21
+ this.username = data.username;
22
+ this.discriminator = data.discriminator;
23
+ this.globalName = data.global_name ?? null;
24
+ this.avatar = data.avatar ?? null;
25
+ this.bot = !!data.bot;
26
+ }
27
+ avatarURL(options) {
28
+ if (!this.avatar) return null;
29
+ const ext = options?.extension ?? "png";
30
+ const size = options?.size ? `?size=${options.size}` : "";
31
+ return `${CDN_URL}/avatars/${this.id}/${this.avatar}.${ext}${size}`;
32
+ }
33
+ displayAvatarURL(options) {
34
+ return this.avatarURL(options) ?? `${CDN_URL}/avatars/0/0.png`;
35
+ }
36
+ toString() {
37
+ return `<@${this.id}>`;
38
+ }
39
+ };
40
+
41
+ export {
42
+ CDN_URL,
43
+ User
44
+ };