@fluxerjs/core 1.0.6 → 1.0.8

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 (59) hide show
  1. package/dist/{Channel-2WNJ445K.mjs → Channel-TWPDKW2P.mjs} +3 -1
  2. package/dist/{ClientUser-J6HQVSDJ.mjs → ClientUser-2K2BACK7.mjs} +1 -2
  3. package/dist/{Guild-GOQZ7XP4.mjs → Guild-CMZGA6DW.mjs} +3 -1
  4. package/dist/GuildMember-DW2N6ITI.mjs +7 -0
  5. package/dist/{Webhook-NUQCJAWZ.mjs → Message-G2QIKZQK.mjs} +3 -3
  6. package/dist/MessageReaction-XRPYZDSC.mjs +7 -0
  7. package/dist/Role-SVLWIAMN.mjs +7 -0
  8. package/dist/{Webhook-2RHBXH7R.mjs → Webhook-2MQESB7Z.mjs} +1 -1
  9. package/dist/chunk-4GCZFOS5.mjs +86 -0
  10. package/dist/chunk-CO5EL5LH.mjs +168 -0
  11. package/dist/chunk-CZIO2D7F.mjs +207 -0
  12. package/dist/chunk-HBF5QEDH.mjs +42 -0
  13. package/dist/chunk-JVEOQFUX.mjs +52 -0
  14. package/dist/chunk-SQVCCSNN.mjs +41 -0
  15. package/dist/chunk-TJVZEILY.mjs +120 -0
  16. package/dist/{chunk-BUEXP5SZ.mjs → chunk-ZGMM6IPQ.mjs} +12 -3
  17. package/dist/index.d.mts +539 -73
  18. package/dist/index.d.ts +539 -73
  19. package/dist/index.js +1125 -355
  20. package/dist/index.mjs +520 -194
  21. package/package.json +27 -8
  22. package/dist/Channel-HM2UY4DN.mjs +0 -17
  23. package/dist/Channel-IKL3SJXN.mjs +0 -17
  24. package/dist/Channel-KILNV5V3.mjs +0 -17
  25. package/dist/Channel-TOAQGSRX.mjs +0 -17
  26. package/dist/Channel-VENHOL7S.mjs +0 -17
  27. package/dist/ClientUser-RNDKHQ3Z.mjs +0 -9
  28. package/dist/Guild-36EGAAEW.mjs +0 -8
  29. package/dist/Guild-CA3W6DOD.mjs +0 -8
  30. package/dist/Guild-NHNQ5TIA.mjs +0 -8
  31. package/dist/Guild-ZOFF5LFR.mjs +0 -8
  32. package/dist/GuildMember-RGVPVUAG.mjs +0 -9
  33. package/dist/GuildMember-XF7K2R45.mjs +0 -9
  34. package/dist/Message-23Z3RPCZ.mjs +0 -9
  35. package/dist/Message-33APPS76.mjs +0 -9
  36. package/dist/Message-PZUU7ZFR.mjs +0 -9
  37. package/dist/Message-XB5WNMHL.mjs +0 -9
  38. package/dist/chunk-3CNUPFDI.mjs +0 -59
  39. package/dist/chunk-4DBGMFOQ.mjs +0 -14
  40. package/dist/chunk-6CEMF2LO.mjs +0 -14
  41. package/dist/chunk-6EBNOON4.mjs +0 -86
  42. package/dist/chunk-72OY7B3D.mjs +0 -72
  43. package/dist/chunk-7FYM4D2E.mjs +0 -50
  44. package/dist/chunk-7GZN6JXT.mjs +0 -50
  45. package/dist/chunk-7H3TKJUT.mjs +0 -53
  46. package/dist/chunk-EF32ILJL.mjs +0 -102
  47. package/dist/chunk-F2EEQP5O.mjs +0 -86
  48. package/dist/chunk-GUNWHOQO.mjs +0 -42
  49. package/dist/chunk-L25ON7WB.mjs +0 -52
  50. package/dist/chunk-LBBIQOSH.mjs +0 -53
  51. package/dist/chunk-OHIHIQAS.mjs +0 -102
  52. package/dist/chunk-P4IRDGB4.mjs +0 -43
  53. package/dist/chunk-QDCFQF6J.mjs +0 -36
  54. package/dist/chunk-QDNFJVVE.mjs +0 -70
  55. package/dist/chunk-SW6KNICI.mjs +0 -52
  56. package/dist/chunk-TE5IC7IP.mjs +0 -36
  57. package/dist/chunk-WFONGZGK.mjs +0 -42
  58. package/dist/chunk-XXCBJJZE.mjs +0 -88
  59. package/dist/chunk-ZHRQQZ4X.mjs +0 -102
@@ -1,102 +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
- static from(client, data) {
18
- const type = data.type ?? 0;
19
- if (type === ChannelType.GuildText) return new TextChannel(client, data);
20
- if (type === ChannelType.GuildCategory) return new CategoryChannel(client, data);
21
- if (type === ChannelType.GuildVoice) return new VoiceChannel(client, data);
22
- if (type === ChannelType.GuildLink) return new LinkChannel(client, data);
23
- return new GuildChannel(client, data);
24
- }
25
- };
26
- var GuildChannel = class extends Channel {
27
- guildId;
28
- name;
29
- position;
30
- parentId;
31
- constructor(client, data) {
32
- super(client, data);
33
- this.guildId = data.guild_id ?? "";
34
- this.name = data.name ?? null;
35
- this.position = data.position;
36
- this.parentId = data.parent_id ?? null;
37
- }
38
- /** Create a webhook in this channel. Returns the webhook with token (required for send()). */
39
- async createWebhook(options) {
40
- const { Webhook } = await import("./Webhook-NUQCJAWZ.mjs");
41
- const data = await this.client.rest.post(Routes.channelWebhooks(this.id), {
42
- body: options,
43
- auth: true
44
- });
45
- return new Webhook(this.client, data);
46
- }
47
- /** Fetch all webhooks in this channel. Returned webhooks do not include the token (cannot send). */
48
- async fetchWebhooks() {
49
- const { Webhook } = await import("./Webhook-NUQCJAWZ.mjs");
50
- const data = await this.client.rest.get(Routes.channelWebhooks(this.id));
51
- const list = Array.isArray(data) ? data : Object.values(data ?? {});
52
- return list.map((w) => new Webhook(this.client, w));
53
- }
54
- };
55
- var TextChannel = class extends GuildChannel {
56
- topic;
57
- nsfw;
58
- rateLimitPerUser;
59
- lastMessageId;
60
- constructor(client, data) {
61
- super(client, data);
62
- this.topic = data.topic ?? null;
63
- this.nsfw = data.nsfw ?? false;
64
- this.rateLimitPerUser = data.rate_limit_per_user ?? 0;
65
- this.lastMessageId = data.last_message_id ?? null;
66
- }
67
- async send(options) {
68
- const body = typeof options === "string" ? { content: options } : options;
69
- const { Message } = await import("./Message-23Z3RPCZ.mjs");
70
- const data = await this.client.rest.post(Routes.channelMessages(this.id), { body });
71
- return new Message(this.client, data);
72
- }
73
- };
74
- var CategoryChannel = class extends GuildChannel {
75
- };
76
- var VoiceChannel = class extends GuildChannel {
77
- bitrate;
78
- userLimit;
79
- rtcRegion;
80
- constructor(client, data) {
81
- super(client, data);
82
- this.bitrate = data.bitrate ?? null;
83
- this.userLimit = data.user_limit ?? null;
84
- this.rtcRegion = data.rtc_region ?? null;
85
- }
86
- };
87
- var LinkChannel = class extends GuildChannel {
88
- url;
89
- constructor(client, data) {
90
- super(client, data);
91
- this.url = data.url ?? null;
92
- }
93
- };
94
-
95
- export {
96
- Channel,
97
- GuildChannel,
98
- TextChannel,
99
- CategoryChannel,
100
- VoiceChannel,
101
- LinkChannel
102
- };
@@ -1,86 +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
- static from(client, data) {
18
- const type = data.type ?? 0;
19
- if (type === ChannelType.GuildText) return new TextChannel(client, data);
20
- if (type === ChannelType.GuildCategory) return new CategoryChannel(client, data);
21
- if (type === ChannelType.GuildVoice) return new VoiceChannel(client, data);
22
- if (type === ChannelType.GuildLink) return new LinkChannel(client, data);
23
- return new GuildChannel(client, data);
24
- }
25
- };
26
- var GuildChannel = class extends Channel {
27
- guildId;
28
- name;
29
- position;
30
- parentId;
31
- constructor(client, data) {
32
- super(client, data);
33
- this.guildId = data.guild_id ?? "";
34
- this.name = data.name ?? null;
35
- this.position = data.position;
36
- this.parentId = data.parent_id ?? null;
37
- }
38
- };
39
- var TextChannel = class extends GuildChannel {
40
- topic;
41
- nsfw;
42
- rateLimitPerUser;
43
- lastMessageId;
44
- constructor(client, data) {
45
- super(client, data);
46
- this.topic = data.topic ?? null;
47
- this.nsfw = data.nsfw ?? false;
48
- this.rateLimitPerUser = data.rate_limit_per_user ?? 0;
49
- this.lastMessageId = data.last_message_id ?? null;
50
- }
51
- async send(options) {
52
- const body = typeof options === "string" ? { content: options } : options;
53
- const { Message } = await import("./Message-23Z3RPCZ.mjs");
54
- const data = await this.client.rest.post(Routes.channelMessages(this.id), { body });
55
- return new Message(this.client, data);
56
- }
57
- };
58
- var CategoryChannel = class extends GuildChannel {
59
- };
60
- var VoiceChannel = class extends GuildChannel {
61
- bitrate;
62
- userLimit;
63
- rtcRegion;
64
- constructor(client, data) {
65
- super(client, data);
66
- this.bitrate = data.bitrate ?? null;
67
- this.userLimit = data.user_limit ?? null;
68
- this.rtcRegion = data.rtc_region ?? null;
69
- }
70
- };
71
- var LinkChannel = class extends GuildChannel {
72
- url;
73
- constructor(client, data) {
74
- super(client, data);
75
- this.url = data.url ?? null;
76
- }
77
- };
78
-
79
- export {
80
- Channel,
81
- GuildChannel,
82
- TextChannel,
83
- CategoryChannel,
84
- VoiceChannel,
85
- LinkChannel
86
- };
@@ -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,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,102 +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
- static from(client, data) {
18
- const type = data.type ?? 0;
19
- if (type === ChannelType.GuildText) return new TextChannel(client, data);
20
- if (type === ChannelType.GuildCategory) return new CategoryChannel(client, data);
21
- if (type === ChannelType.GuildVoice) return new VoiceChannel(client, data);
22
- if (type === ChannelType.GuildLink) return new LinkChannel(client, data);
23
- return new GuildChannel(client, data);
24
- }
25
- };
26
- var GuildChannel = class extends Channel {
27
- guildId;
28
- name;
29
- position;
30
- parentId;
31
- constructor(client, data) {
32
- super(client, data);
33
- this.guildId = data.guild_id ?? "";
34
- this.name = data.name ?? null;
35
- this.position = data.position;
36
- this.parentId = data.parent_id ?? null;
37
- }
38
- /** Create a webhook in this channel. Returns the webhook with token (required for send()). */
39
- async createWebhook(options) {
40
- const { Webhook } = await import("./Webhook-2RHBXH7R.mjs");
41
- const data = await this.client.rest.post(Routes.channelWebhooks(this.id), {
42
- body: options,
43
- auth: true
44
- });
45
- return new Webhook(this.client, data);
46
- }
47
- /** Fetch all webhooks in this channel. Returned webhooks do not include the token (cannot send). */
48
- async fetchWebhooks() {
49
- const { Webhook } = await import("./Webhook-2RHBXH7R.mjs");
50
- const data = await this.client.rest.get(Routes.channelWebhooks(this.id));
51
- const list = Array.isArray(data) ? data : Object.values(data ?? {});
52
- return list.map((w) => new Webhook(this.client, w));
53
- }
54
- };
55
- var TextChannel = class extends GuildChannel {
56
- topic;
57
- nsfw;
58
- rateLimitPerUser;
59
- lastMessageId;
60
- constructor(client, data) {
61
- super(client, data);
62
- this.topic = data.topic ?? null;
63
- this.nsfw = data.nsfw ?? false;
64
- this.rateLimitPerUser = data.rate_limit_per_user ?? 0;
65
- this.lastMessageId = data.last_message_id ?? null;
66
- }
67
- async send(options) {
68
- const body = typeof options === "string" ? { content: options } : options;
69
- const { Message } = await import("./Message-33APPS76.mjs");
70
- const data = await this.client.rest.post(Routes.channelMessages(this.id), { body });
71
- return new Message(this.client, data);
72
- }
73
- };
74
- var CategoryChannel = class extends GuildChannel {
75
- };
76
- var VoiceChannel = class extends GuildChannel {
77
- bitrate;
78
- userLimit;
79
- rtcRegion;
80
- constructor(client, data) {
81
- super(client, data);
82
- this.bitrate = data.bitrate ?? null;
83
- this.userLimit = data.user_limit ?? null;
84
- this.rtcRegion = data.rtc_region ?? null;
85
- }
86
- };
87
- var LinkChannel = class extends GuildChannel {
88
- url;
89
- constructor(client, data) {
90
- super(client, data);
91
- this.url = data.url ?? null;
92
- }
93
- };
94
-
95
- export {
96
- Channel,
97
- GuildChannel,
98
- TextChannel,
99
- CategoryChannel,
100
- VoiceChannel,
101
- LinkChannel
102
- };
@@ -1,43 +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/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
- User
43
- };
@@ -1,36 +0,0 @@
1
- import {
2
- User
3
- } from "./chunk-SW6KNICI.mjs";
4
- import {
5
- Base
6
- } from "./chunk-XNS4O6QJ.mjs";
7
-
8
- // src/structures/GuildMember.ts
9
- var GuildMember = class extends Base {
10
- client;
11
- id;
12
- user;
13
- guild;
14
- nick;
15
- roles;
16
- joinedAt;
17
- communicationDisabledUntil;
18
- constructor(client, data, guild) {
19
- super();
20
- this.client = client;
21
- this.user = new User(client, data.user);
22
- this.id = data.user.id;
23
- this.guild = guild;
24
- this.nick = data.nick ?? null;
25
- this.roles = data.roles ?? [];
26
- this.joinedAt = new Date(data.joined_at);
27
- this.communicationDisabledUntil = data.communication_disabled_until ? new Date(data.communication_disabled_until) : null;
28
- }
29
- get displayName() {
30
- return this.nick ?? this.user.globalName ?? this.user.username;
31
- }
32
- };
33
-
34
- export {
35
- GuildMember
36
- };
@@ -1,70 +0,0 @@
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. The returned webhook will not have a token (cannot send).
46
- */
47
- static async fetch(client, webhookId) {
48
- const data = await client.rest.get(Routes.webhook(webhookId));
49
- return new _Webhook(client, data);
50
- }
51
- /**
52
- * Create a Webhook instance from an ID and token (e.g. from a stored webhook URL).
53
- * Useful when you have the token from a previous createWebhook() call.
54
- */
55
- static fromToken(client, webhookId, token, options) {
56
- return new _Webhook(client, {
57
- id: webhookId,
58
- guild_id: options?.guildId ?? "",
59
- channel_id: options?.channelId ?? "",
60
- name: options?.name ?? "Webhook",
61
- avatar: null,
62
- token,
63
- user: { id: "", username: "webhook" }
64
- });
65
- }
66
- };
67
-
68
- export {
69
- Webhook
70
- };
@@ -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/User.ts
9
- var User = class extends Base {
10
- client;
11
- /** Snowflake ID. */
12
- id;
13
- /** Username. */
14
- username;
15
- /** Discriminator (legacy). */
16
- discriminator;
17
- /** Global display name, or null. */
18
- globalName;
19
- /** Avatar hash, or null. */
20
- avatar;
21
- /** Whether this user is a bot. */
22
- bot;
23
- /** @internal */
24
- constructor(client, data) {
25
- super();
26
- this.client = client;
27
- this.id = data.id;
28
- this.username = data.username;
29
- this.discriminator = data.discriminator;
30
- this.globalName = data.global_name ?? null;
31
- this.avatar = data.avatar ?? null;
32
- this.bot = !!data.bot;
33
- }
34
- /** CDN URL for the avatar. */
35
- avatarURL(options) {
36
- if (!this.avatar) return null;
37
- const ext = options?.extension ?? "png";
38
- const size = options?.size ? `?size=${options.size}` : "";
39
- return `${CDN_URL}/avatars/${this.id}/${this.avatar}.${ext}${size}`;
40
- }
41
- /** Avatar URL or default avatar if none. */
42
- displayAvatarURL(options) {
43
- return this.avatarURL(options) ?? `${CDN_URL}/avatars/0/0.png`;
44
- }
45
- toString() {
46
- return `<@${this.id}>`;
47
- }
48
- };
49
-
50
- export {
51
- User
52
- };
@@ -1,36 +0,0 @@
1
- import {
2
- User
3
- } from "./chunk-P4IRDGB4.mjs";
4
- import {
5
- Base
6
- } from "./chunk-XNS4O6QJ.mjs";
7
-
8
- // src/structures/GuildMember.ts
9
- var GuildMember = class extends Base {
10
- client;
11
- id;
12
- user;
13
- guild;
14
- nick;
15
- roles;
16
- joinedAt;
17
- communicationDisabledUntil;
18
- constructor(client, data, guild) {
19
- super();
20
- this.client = client;
21
- this.user = new User(client, data.user);
22
- this.id = data.user.id;
23
- this.guild = guild;
24
- this.nick = data.nick ?? null;
25
- this.roles = data.roles ?? [];
26
- this.joinedAt = new Date(data.joined_at);
27
- this.communicationDisabledUntil = data.communication_disabled_until ? new Date(data.communication_disabled_until) : null;
28
- }
29
- get displayName() {
30
- return this.nick ?? this.user.globalName ?? this.user.username;
31
- }
32
- };
33
-
34
- export {
35
- GuildMember
36
- };