lunibee 0.2.2 → 0.2.4
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/LICENSE +21 -21
- package/README.md +225 -225
- package/dist/builders/attachment.d.ts +10 -2
- package/dist/builders/commands.d.ts +161 -101
- package/dist/builders/components.d.ts +54 -75
- package/dist/builders/embed.d.ts +68 -35
- package/dist/builders/index.d.ts +1 -1
- package/dist/builders/index.js +108 -133
- package/dist/builders/index.js.map +8 -8
- package/dist/collection/cache.d.ts +13 -6
- package/dist/collection/index.d.ts +90 -17
- package/dist/collection/index.js +442 -266
- package/dist/collection/index.js.map +4 -4
- package/dist/core/index.d.ts +9 -0
- package/dist/core/index.js +791 -436
- package/dist/core/index.js.map +47 -47
- package/dist/core/permissions.d.ts +9 -5
- package/dist/formatters/index.js +9 -5
- package/dist/formatters/index.js.map +3 -3
- package/dist/handlers/index.js +5 -10
- package/dist/handlers/index.js.map +3 -3
- package/dist/index.js +1010 -679
- package/dist/index.js.map +66 -65
- package/dist/managers/base.d.ts +26 -14
- package/dist/managers/emoji.d.ts +7 -1
- package/dist/managers/guild-resources.d.ts +11 -3
- package/dist/managers/guild.d.ts +13 -5
- package/dist/managers/index.d.ts +28 -14
- package/dist/managers/index.js +580 -340
- package/dist/managers/index.js.map +26 -26
- package/dist/managers/member.d.ts +5 -3
- package/dist/managers/message.d.ts +7 -3
- package/dist/managers/role.d.ts +13 -1
- package/dist/rest/error-codes.d.ts +48 -0
- package/dist/rest/errors.d.ts +14 -6
- package/dist/rest/index.d.ts +25 -12
- package/dist/rest/index.js +105 -18
- package/dist/rest/index.js.map +15 -14
- package/dist/rest/redis.d.ts +1 -1
- package/dist/rest/route.d.ts +8 -4
- package/dist/rest/routes.d.ts +102 -46
- package/dist/rest/transport.d.ts +10 -5
- package/dist/rest/webhook.d.ts +9 -5
- package/dist/sharding/bus.d.ts +34 -17
- package/dist/sharding/index.d.ts +34 -17
- package/dist/sharding/index.js +68 -36
- package/dist/sharding/index.js.map +17 -17
- package/dist/structures/base.d.ts +28 -10
- package/dist/structures/channels.d.ts +28 -14
- package/dist/structures/index.d.ts +6 -6
- package/dist/structures/index.js +81 -99
- package/dist/structures/index.js.map +19 -18
- package/dist/structures/interactions.d.ts +98 -50
- package/dist/structures/resources.d.ts +90 -46
- package/dist/types/gateway.d.ts +1 -1
- package/dist/types/index.d.ts +43 -18
- package/dist/types/index.js +20 -22
- package/dist/types/index.js.map +4 -4
- package/dist/utils/index.js.map +2 -2
- package/dist/voice/index.d.ts +12 -4
- package/dist/voice/index.js +17 -20
- package/dist/voice/index.js.map +3 -3
- package/dist/ws/decoder.d.ts +6 -2
- package/dist/ws/index.d.ts +25 -13
- package/dist/ws/index.js +63 -31
- package/dist/ws/index.js.map +14 -14
- package/dist/ws/protocol.d.ts +10 -2
- package/dist/ws/session.d.ts +14 -4
- package/dist/ws/state.d.ts +22 -11
- package/package.json +16 -15
|
@@ -14,22 +14,22 @@ export interface ResourceContext {
|
|
|
14
14
|
editMessage(channelId: string, messageId: string, options: Record<string, unknown> & {
|
|
15
15
|
content?: string;
|
|
16
16
|
}): Promise<import("./index.js").Message>;
|
|
17
|
-
deleteMessage(channelId: string, messageId: string): Promise<void>;
|
|
17
|
+
deleteMessage(channelId: string, messageId: string, reason?: string): Promise<void>;
|
|
18
18
|
crosspostMessage(channelId: string, messageId: string): Promise<import("./index.js").Message>;
|
|
19
19
|
editChannel?(channelId: string, options: Record<string, unknown>): Promise<import("./base.js").Channel>;
|
|
20
|
-
deleteChannel?(channelId: string): Promise<void>;
|
|
20
|
+
deleteChannel?(channelId: string, reason?: string): Promise<void>;
|
|
21
21
|
addReaction?(channelId: string, messageId: string, emoji: string): Promise<void>;
|
|
22
22
|
removeOwnReaction?(channelId: string, messageId: string, emoji: string): Promise<void>;
|
|
23
23
|
removeReaction?(channelId: string, messageId: string, emoji: string, userId: string): Promise<void>;
|
|
24
24
|
removeAllReactions?(channelId: string, messageId: string): Promise<void>;
|
|
25
|
-
pinMessage?(channelId: string, messageId: string): Promise<void>;
|
|
26
|
-
unpinMessage?(channelId: string, messageId: string): Promise<void>;
|
|
25
|
+
pinMessage?(channelId: string, messageId: string, reason?: string): Promise<void>;
|
|
26
|
+
unpinMessage?(channelId: string, messageId: string, reason?: string): Promise<void>;
|
|
27
27
|
/**
|
|
28
28
|
* A member's permissions from cached state: guild-level, or channel-level
|
|
29
29
|
* (with overwrites) when a channel ID is given. Null when the guild (or
|
|
30
30
|
* channel) is not cached.
|
|
31
31
|
*/
|
|
32
|
-
memberPermissions?(guildId: string, memberId: string, roleIds: readonly string[], channelId?: string): import("@lunibee/core").PermissionSet | null;
|
|
32
|
+
memberPermissions?(guildId: string, memberId: string, roleIds: readonly string[], channelId?: string, timedOutUntil?: Date | null): import("@lunibee/core").PermissionSet | null;
|
|
33
33
|
kickMember?(guildId: string, userId: string, reason?: string): Promise<void>;
|
|
34
34
|
banMember?(guildId: string, userId: string, options?: {
|
|
35
35
|
reason?: string;
|
|
@@ -97,11 +97,11 @@ export declare class Channel extends BaseStructure {
|
|
|
97
97
|
/** Creates a channel structure from Discord channel data. */
|
|
98
98
|
constructor(data: import("@lunibee/types").APIChannel, context?: ResourceContext);
|
|
99
99
|
/** Sends a message to this channel. @param options Message payload. @returns The created message. @throws {Error} If the channel is not attached to a client. */
|
|
100
|
-
|
|
100
|
+
send(options: Record<string, unknown> & {
|
|
101
101
|
content?: string;
|
|
102
102
|
}): Promise<import("./index.js").Message>;
|
|
103
|
-
/**
|
|
104
|
-
|
|
103
|
+
/** @deprecated Use {@link Channel.send}. Removed in 0.3.0. */
|
|
104
|
+
sendMessage(options: Record<string, unknown> & {
|
|
105
105
|
content?: string;
|
|
106
106
|
}): Promise<import("./index.js").Message>;
|
|
107
107
|
/** Edits this channel. @param options Channel fields to change. @returns The updated channel. @throws {Error} If the channel is not attached to a client. */
|
|
@@ -123,8 +123,8 @@ export declare class Channel extends BaseStructure {
|
|
|
123
123
|
reason?: string;
|
|
124
124
|
}): Promise<void>;
|
|
125
125
|
editParent(parentId: string | null): Promise<Channel>;
|
|
126
|
-
/** Deletes this channel. @returns A promise fulfilled when Discord confirms deletion. @throws {Error} If the channel is not attached to a client. */
|
|
127
|
-
delete(): Promise<void>;
|
|
126
|
+
/** Deletes this channel. @param reason Audit-log reason. @returns A promise fulfilled when Discord confirms deletion. @throws {Error} If the channel is not attached to a client. */
|
|
127
|
+
delete(reason?: string): Promise<void>;
|
|
128
128
|
/** Updates this channel using the same resource operation as edit. @param options Channel fields to change. @returns The updated channel. @throws {Error} If the channel is not attached to a client. */
|
|
129
129
|
update(options: Record<string, unknown>): Promise<Channel>;
|
|
130
130
|
/** Whether this is a thread (announcement, public or private). */
|
|
@@ -170,6 +170,24 @@ export declare class Guild extends BaseStructure {
|
|
|
170
170
|
explicitContentFilter: number;
|
|
171
171
|
/** Default notification level for new members. */
|
|
172
172
|
defaultMessageNotifications: number;
|
|
173
|
+
/** AFK voice channel, or null. */
|
|
174
|
+
afkChannelId: string | null;
|
|
175
|
+
/** Seconds before a silent member is moved to the AFK channel. */
|
|
176
|
+
afkTimeout?: number;
|
|
177
|
+
/** Whether the server widget is on. */
|
|
178
|
+
widgetEnabled: boolean;
|
|
179
|
+
/** Channel the widget invites to, or null. */
|
|
180
|
+
widgetChannelId: string | null;
|
|
181
|
+
/** Application that created the guild, if a bot did. */
|
|
182
|
+
applicationId: string | null;
|
|
183
|
+
/** Channel for Discord's community updates, or null. */
|
|
184
|
+
publicUpdatesChannelId: string | null;
|
|
185
|
+
/** Channel for safety alerts, or null. */
|
|
186
|
+
safetyAlertsChannelId: string | null;
|
|
187
|
+
/** Maximum presences (null for the default limit). */
|
|
188
|
+
maxPresences: number | null;
|
|
189
|
+
/** Maximum users in a video channel. */
|
|
190
|
+
maxVideoChannelUsers?: number;
|
|
173
191
|
constructor(data: import("@lunibee/types").APIGuild);
|
|
174
192
|
/** Returns the guild icon URL, or null if no icon is set. */
|
|
175
193
|
iconURL(options?: ImageURLOptions): string | null;
|
|
@@ -6,16 +6,22 @@ export declare class NewsChannel extends TextChannel {
|
|
|
6
6
|
}
|
|
7
7
|
/** A direct-message or group DM channel. */
|
|
8
8
|
export declare class DMChannel extends Channel {
|
|
9
|
-
/** Users in the conversation. */
|
|
10
|
-
|
|
9
|
+
/** Users in the conversation. */
|
|
10
|
+
readonly recipients: User[];
|
|
11
|
+
/** Owner of a group DM. */
|
|
12
|
+
readonly ownerId: string | null;
|
|
11
13
|
constructor(data: APIChannel, context?: ResourceContext);
|
|
12
14
|
}
|
|
13
15
|
/** A guild voice channel. */
|
|
14
16
|
export declare class VoiceChannel extends Channel {
|
|
15
|
-
/** Bitrate in bits per second. */
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
|
|
17
|
+
/** Bitrate in bits per second. */
|
|
18
|
+
bitrate: number;
|
|
19
|
+
/** User limit (0 = unlimited). */
|
|
20
|
+
userLimit: number;
|
|
21
|
+
/** Voice region override, or null for automatic. */
|
|
22
|
+
rtcRegion: string | null;
|
|
23
|
+
/** Camera video quality mode. */
|
|
24
|
+
videoQualityMode: number;
|
|
19
25
|
constructor(data: APIChannel, context?: ResourceContext);
|
|
20
26
|
}
|
|
21
27
|
/** A guild stage channel. */
|
|
@@ -26,10 +32,14 @@ export declare class CategoryChannel extends Channel {
|
|
|
26
32
|
}
|
|
27
33
|
/** A thread (announcement, public or private). */
|
|
28
34
|
export declare class ThreadChannel extends Channel {
|
|
29
|
-
/** User who created the thread. */
|
|
30
|
-
|
|
31
|
-
/** Approximate
|
|
32
|
-
|
|
35
|
+
/** User who created the thread. */
|
|
36
|
+
readonly ownerId: string | null;
|
|
37
|
+
/** Approximate message count. */
|
|
38
|
+
messageCount: number;
|
|
39
|
+
/** Approximate member count (stops counting at 50). */
|
|
40
|
+
memberCount: number;
|
|
41
|
+
/** Thread metadata. */
|
|
42
|
+
metadata: APIThreadMetadata | null;
|
|
33
43
|
constructor(data: APIChannel, context?: ResourceContext);
|
|
34
44
|
/** Whether the thread is archived. */
|
|
35
45
|
get archived(): boolean;
|
|
@@ -40,10 +50,14 @@ export declare class ThreadChannel extends Channel {
|
|
|
40
50
|
}
|
|
41
51
|
/** A guild forum channel. */
|
|
42
52
|
export declare class ForumChannel extends Channel {
|
|
43
|
-
/** Tags that threads can apply. */
|
|
44
|
-
|
|
45
|
-
/** Default
|
|
46
|
-
|
|
53
|
+
/** Tags that threads can apply. */
|
|
54
|
+
availableTags: APIForumTag[];
|
|
55
|
+
/** Default reaction for new threads. */
|
|
56
|
+
defaultReactionEmoji: APIPartialEmoji | null;
|
|
57
|
+
/** Default slowmode for new threads. */
|
|
58
|
+
defaultThreadRateLimitPerUser: number;
|
|
59
|
+
/** Default auto-archive duration for new threads. */
|
|
60
|
+
defaultAutoArchiveDuration: number | null;
|
|
47
61
|
constructor(data: APIChannel, context?: ResourceContext);
|
|
48
62
|
}
|
|
49
63
|
/** A guild media channel. */
|
|
@@ -61,8 +61,8 @@ export declare class Message extends BaseStructure {
|
|
|
61
61
|
update(options: Record<string, unknown> & {
|
|
62
62
|
content?: string;
|
|
63
63
|
}): Promise<Message>;
|
|
64
|
-
/** Deletes this message. @returns A promise fulfilled when Discord confirms deletion. @throws {Error} If the message is not attached to a client. */
|
|
65
|
-
delete(): Promise<void>;
|
|
64
|
+
/** Deletes this message. @param reason Audit-log reason (shown when deleting someone else's message). @returns A promise fulfilled when Discord confirms deletion. @throws {Error} If the message is not attached to a client. */
|
|
65
|
+
delete(reason?: string): Promise<void>;
|
|
66
66
|
/** Replies to this message. @param options Message content or payload. @returns The created reply message. @throws {Error} If the message is not attached to a client. */
|
|
67
67
|
reply(options: string | (Record<string, unknown> & {
|
|
68
68
|
content?: string;
|
|
@@ -90,10 +90,10 @@ export declare class Message extends BaseStructure {
|
|
|
90
90
|
removeReaction(emoji: string, userId?: string): Promise<void>;
|
|
91
91
|
/** Removes all reactions from this message. @returns A promise fulfilled when reactions are removed. @throws {Error} If reaction operations are unavailable. */
|
|
92
92
|
removeAllReactions(): Promise<void>;
|
|
93
|
-
/** Pins this message. @returns A promise fulfilled when the message is pinned. @throws {Error} If pin operations are unavailable. */
|
|
94
|
-
pin(): Promise<void>;
|
|
95
|
-
/** Unpins this message. @returns A promise fulfilled when the message is unpinned. @throws {Error} If pin operations are unavailable. */
|
|
96
|
-
unpin(): Promise<void>;
|
|
93
|
+
/** Pins this message. @param reason Audit-log reason. @returns A promise fulfilled when the message is pinned. @throws {Error} If pin operations are unavailable. */
|
|
94
|
+
pin(reason?: string): Promise<void>;
|
|
95
|
+
/** Unpins this message. @param reason Audit-log reason. @returns A promise fulfilled when the message is unpinned. @throws {Error} If pin operations are unavailable. */
|
|
96
|
+
unpin(reason?: string): Promise<void>;
|
|
97
97
|
/** Whether this message was sent ephemerally (only visible to the recipient). */
|
|
98
98
|
get isEphemeral(): boolean;
|
|
99
99
|
/** Whether this message is currently pinned in its channel. */
|
package/dist/structures/index.js
CHANGED
|
@@ -19,7 +19,7 @@ function cdnURL(path, hash, options = {}) {
|
|
|
19
19
|
const isAnimated = hash.startsWith("a_") && !options.forceStatic;
|
|
20
20
|
const ext = options.extension ?? (isAnimated ? "gif" : "png");
|
|
21
21
|
const size = options.size ? `?size=${options.size}` : "";
|
|
22
|
-
return `${CDN_BASE}${path}/${hash}.${ext}${size}`;
|
|
22
|
+
return `${CDN_BASE}${path}/${encodeURIComponent(hash)}.${ext}${size}`;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
class User extends BaseStructure {
|
|
@@ -88,13 +88,13 @@ class Channel extends BaseStructure {
|
|
|
88
88
|
this.permissionOverwrites = (data.permission_overwrites ?? []).map((overwrite) => ({ ...overwrite }));
|
|
89
89
|
this.#context = context;
|
|
90
90
|
}
|
|
91
|
-
|
|
91
|
+
send(options) {
|
|
92
92
|
if (!this.#context)
|
|
93
93
|
throw new Error("This channel is not attached to a client.");
|
|
94
94
|
return this.#context.sendMessage(this.id, options);
|
|
95
95
|
}
|
|
96
|
-
|
|
97
|
-
return this.
|
|
96
|
+
sendMessage(options) {
|
|
97
|
+
return this.send(options);
|
|
98
98
|
}
|
|
99
99
|
edit(options) {
|
|
100
100
|
if (!this.#context?.editChannel)
|
|
@@ -117,10 +117,10 @@ class Channel extends BaseStructure {
|
|
|
117
117
|
editParent(parentId) {
|
|
118
118
|
return this.edit({ parent_id: parentId });
|
|
119
119
|
}
|
|
120
|
-
delete() {
|
|
120
|
+
delete(reason) {
|
|
121
121
|
if (!this.#context?.deleteChannel)
|
|
122
122
|
throw new Error("This channel is not attached to a client.");
|
|
123
|
-
return this.#context.deleteChannel(this.id);
|
|
123
|
+
return this.#context.deleteChannel(this.id, reason);
|
|
124
124
|
}
|
|
125
125
|
update(options) {
|
|
126
126
|
return this.edit(options);
|
|
@@ -167,6 +167,15 @@ class Guild extends BaseStructure {
|
|
|
167
167
|
mfaLevel;
|
|
168
168
|
explicitContentFilter;
|
|
169
169
|
defaultMessageNotifications;
|
|
170
|
+
afkChannelId;
|
|
171
|
+
afkTimeout;
|
|
172
|
+
widgetEnabled;
|
|
173
|
+
widgetChannelId;
|
|
174
|
+
applicationId;
|
|
175
|
+
publicUpdatesChannelId;
|
|
176
|
+
safetyAlertsChannelId;
|
|
177
|
+
maxPresences;
|
|
178
|
+
maxVideoChannelUsers;
|
|
170
179
|
constructor(data) {
|
|
171
180
|
super(data.id);
|
|
172
181
|
if (!data.name)
|
|
@@ -188,14 +197,22 @@ class Guild extends BaseStructure {
|
|
|
188
197
|
this.vanityUrlCode = data.vanity_url_code ?? null;
|
|
189
198
|
this.nsfwLevel = data.nsfw_level ?? 0;
|
|
190
199
|
this.discoverySplash = data.discovery_splash ?? null;
|
|
191
|
-
|
|
192
|
-
this.
|
|
193
|
-
this.
|
|
194
|
-
this.
|
|
195
|
-
this.
|
|
196
|
-
this.
|
|
197
|
-
this.
|
|
198
|
-
this.
|
|
200
|
+
this.rulesChannelId = data.rules_channel_id ?? null;
|
|
201
|
+
this.systemChannelId = data.system_channel_id ?? null;
|
|
202
|
+
this.systemChannelFlags = data.system_channel_flags ?? 0;
|
|
203
|
+
this.maxMembers = data.max_members ?? 0;
|
|
204
|
+
this.mfaLevel = data.mfa_level ?? 0;
|
|
205
|
+
this.explicitContentFilter = data.explicit_content_filter ?? 0;
|
|
206
|
+
this.defaultMessageNotifications = data.default_message_notifications ?? 0;
|
|
207
|
+
this.afkChannelId = data.afk_channel_id ?? null;
|
|
208
|
+
this.afkTimeout = data.afk_timeout;
|
|
209
|
+
this.widgetEnabled = data.widget_enabled ?? false;
|
|
210
|
+
this.widgetChannelId = data.widget_channel_id ?? null;
|
|
211
|
+
this.applicationId = data.application_id ?? null;
|
|
212
|
+
this.publicUpdatesChannelId = data.public_updates_channel_id ?? null;
|
|
213
|
+
this.safetyAlertsChannelId = data.safety_alerts_channel_id ?? null;
|
|
214
|
+
this.maxPresences = data.max_presences ?? null;
|
|
215
|
+
this.maxVideoChannelUsers = data.max_video_channel_users;
|
|
199
216
|
}
|
|
200
217
|
iconURL(options = {}) {
|
|
201
218
|
if (!this.icon)
|
|
@@ -358,60 +375,7 @@ var Permissions = {
|
|
|
358
375
|
PinMessages: 1n << 51n,
|
|
359
376
|
BypassSlowmode: 1n << 52n
|
|
360
377
|
};
|
|
361
|
-
var PermissionFlagsBits =
|
|
362
|
-
CreateInstantInvite: 1n << 0n,
|
|
363
|
-
KickMembers: 1n << 1n,
|
|
364
|
-
BanMembers: 1n << 2n,
|
|
365
|
-
Administrator: 1n << 3n,
|
|
366
|
-
ManageChannels: 1n << 4n,
|
|
367
|
-
ManageGuild: 1n << 5n,
|
|
368
|
-
AddReactions: 1n << 6n,
|
|
369
|
-
ViewAuditLog: 1n << 7n,
|
|
370
|
-
PrioritySpeaker: 1n << 8n,
|
|
371
|
-
Stream: 1n << 9n,
|
|
372
|
-
ViewChannel: 1n << 10n,
|
|
373
|
-
SendMessages: 1n << 11n,
|
|
374
|
-
SendTTSMessages: 1n << 12n,
|
|
375
|
-
ManageMessages: 1n << 13n,
|
|
376
|
-
EmbedLinks: 1n << 14n,
|
|
377
|
-
AttachFiles: 1n << 15n,
|
|
378
|
-
ReadMessageHistory: 1n << 16n,
|
|
379
|
-
MentionEveryone: 1n << 17n,
|
|
380
|
-
UseExternalEmojis: 1n << 18n,
|
|
381
|
-
ViewGuildInsights: 1n << 19n,
|
|
382
|
-
Connect: 1n << 20n,
|
|
383
|
-
Speak: 1n << 21n,
|
|
384
|
-
MuteMembers: 1n << 22n,
|
|
385
|
-
DeafenMembers: 1n << 23n,
|
|
386
|
-
MoveMembers: 1n << 24n,
|
|
387
|
-
UseVAD: 1n << 25n,
|
|
388
|
-
ChangeNickname: 1n << 26n,
|
|
389
|
-
ManageNicknames: 1n << 27n,
|
|
390
|
-
ManageRoles: 1n << 28n,
|
|
391
|
-
ManageWebhooks: 1n << 29n,
|
|
392
|
-
ManageGuildExpressions: 1n << 30n,
|
|
393
|
-
UseApplicationCommands: 1n << 31n,
|
|
394
|
-
RequestToSpeak: 1n << 32n,
|
|
395
|
-
ManageEvents: 1n << 33n,
|
|
396
|
-
ManageThreads: 1n << 34n,
|
|
397
|
-
CreatePublicThreads: 1n << 35n,
|
|
398
|
-
CreatePrivateThreads: 1n << 36n,
|
|
399
|
-
UseExternalStickers: 1n << 37n,
|
|
400
|
-
SendMessagesInThreads: 1n << 38n,
|
|
401
|
-
UseEmbeddedActivities: 1n << 39n,
|
|
402
|
-
ModerateMembers: 1n << 40n,
|
|
403
|
-
ViewCreatorMonetizationAnalytics: 1n << 41n,
|
|
404
|
-
UseSoundboard: 1n << 42n,
|
|
405
|
-
CreateGuildExpressions: 1n << 43n,
|
|
406
|
-
CreateEvents: 1n << 44n,
|
|
407
|
-
UseExternalSounds: 1n << 45n,
|
|
408
|
-
SendVoiceMessages: 1n << 46n,
|
|
409
|
-
SetVoiceChannelStatus: 1n << 48n,
|
|
410
|
-
SendPolls: 1n << 49n,
|
|
411
|
-
UseExternalApps: 1n << 50n,
|
|
412
|
-
PinMessages: 1n << 51n,
|
|
413
|
-
BypassSlowmode: 1n << 52n
|
|
414
|
-
};
|
|
378
|
+
var PermissionFlagsBits = Permissions;
|
|
415
379
|
|
|
416
380
|
class PermissionSet {
|
|
417
381
|
bitfield;
|
|
@@ -749,22 +713,28 @@ var InteractionResponseEnum = {
|
|
|
749
713
|
Modal: 9
|
|
750
714
|
};
|
|
751
715
|
var InteractionResponseType = InteractionResponseEnum;
|
|
716
|
+
// packages/collection/src/index.ts
|
|
717
|
+
var mapGet = Map.prototype.get;
|
|
718
|
+
var mapHas = Map.prototype.has;
|
|
752
719
|
// packages/rest/package.json
|
|
753
720
|
var package_default = {
|
|
754
721
|
name: "@lunibee/rest",
|
|
755
|
-
version: "0.2.
|
|
722
|
+
version: "0.2.4",
|
|
756
723
|
type: "module",
|
|
757
724
|
module: "./src/index.ts",
|
|
758
725
|
types: "./src/index.ts",
|
|
759
726
|
exports: {
|
|
760
727
|
".": "./src/index.ts"
|
|
728
|
+
},
|
|
729
|
+
dependencies: {
|
|
730
|
+
"@lunibee/types": "workspace:*"
|
|
761
731
|
}
|
|
762
732
|
};
|
|
763
733
|
|
|
764
734
|
// packages/rest/src/index.ts
|
|
765
735
|
var LIBRARY_VERSION = package_default.version;
|
|
766
736
|
var LIBRARY_URL = "https://github.com/Ekretos/lunibee";
|
|
767
|
-
var USER_AGENT = `DiscordBot (${LIBRARY_URL}, ${
|
|
737
|
+
var USER_AGENT = `DiscordBot (${LIBRARY_URL}, ${LIBRARY_VERSION})`;
|
|
768
738
|
var REQUEST_DATA_KEYS = new Set([
|
|
769
739
|
"body",
|
|
770
740
|
"files",
|
|
@@ -851,10 +821,10 @@ class GuildMember {
|
|
|
851
821
|
get permissions() {
|
|
852
822
|
if (this.#suppliedPermissions)
|
|
853
823
|
return this.#suppliedPermissions;
|
|
854
|
-
return new PermissionsBitField(this.#context?.memberPermissions?.(this.guildId, this.user.id, this.roleIds) ?? 0n);
|
|
824
|
+
return new PermissionsBitField(this.#context?.memberPermissions?.(this.guildId, this.user.id, this.roleIds, undefined, this.timedOutUntil) ?? 0n);
|
|
855
825
|
}
|
|
856
826
|
permissionsIn(channelId) {
|
|
857
|
-
const computed = this.#context?.memberPermissions?.(this.guildId, this.user.id, this.roleIds, channelId);
|
|
827
|
+
const computed = this.#context?.memberPermissions?.(this.guildId, this.user.id, this.roleIds, channelId, this.timedOutUntil);
|
|
858
828
|
return computed ? new PermissionsBitField(computed) : null;
|
|
859
829
|
}
|
|
860
830
|
#action(name) {
|
|
@@ -1115,7 +1085,7 @@ class WelcomeScreenChannel {
|
|
|
1115
1085
|
}
|
|
1116
1086
|
}
|
|
1117
1087
|
|
|
1118
|
-
class
|
|
1088
|
+
class GuildWelcomeScreen {
|
|
1119
1089
|
description;
|
|
1120
1090
|
channels;
|
|
1121
1091
|
constructor(data) {
|
|
@@ -1158,7 +1128,7 @@ class OnboardingPrompt extends BaseStructure {
|
|
|
1158
1128
|
}
|
|
1159
1129
|
}
|
|
1160
1130
|
|
|
1161
|
-
class
|
|
1131
|
+
class GuildOnboarding extends BaseStructure {
|
|
1162
1132
|
prompts;
|
|
1163
1133
|
defaultChannelIds;
|
|
1164
1134
|
enabled;
|
|
@@ -1290,6 +1260,13 @@ var OptionType = {
|
|
|
1290
1260
|
class CommandOptions {
|
|
1291
1261
|
#options;
|
|
1292
1262
|
#resolved;
|
|
1263
|
+
#lookup(kind, id) {
|
|
1264
|
+
const group = this.#resolved?.[kind];
|
|
1265
|
+
if (typeof group !== "object" || group === null)
|
|
1266
|
+
return;
|
|
1267
|
+
const entry = group[id];
|
|
1268
|
+
return typeof entry === "object" && entry !== null ? entry : undefined;
|
|
1269
|
+
}
|
|
1293
1270
|
constructor(options, resolved = {}) {
|
|
1294
1271
|
let currentOptions = options;
|
|
1295
1272
|
let group = null;
|
|
@@ -1378,7 +1355,7 @@ class CommandOptions {
|
|
|
1378
1355
|
return null;
|
|
1379
1356
|
}
|
|
1380
1357
|
const userId = String(opt.value);
|
|
1381
|
-
const resolved = this.#
|
|
1358
|
+
const resolved = this.#lookup("users", userId) ?? null;
|
|
1382
1359
|
if (!resolved && required)
|
|
1383
1360
|
throw new TypeError(`Resolved user for option "${name}" is missing.`);
|
|
1384
1361
|
return resolved;
|
|
@@ -1391,7 +1368,7 @@ class CommandOptions {
|
|
|
1391
1368
|
return null;
|
|
1392
1369
|
}
|
|
1393
1370
|
const channelId = String(opt.value);
|
|
1394
|
-
const resolved = this.#
|
|
1371
|
+
const resolved = this.#lookup("channels", channelId) ?? null;
|
|
1395
1372
|
if (!resolved && required)
|
|
1396
1373
|
throw new TypeError(`Resolved channel for option "${name}" is missing.`);
|
|
1397
1374
|
return resolved;
|
|
@@ -1404,7 +1381,7 @@ class CommandOptions {
|
|
|
1404
1381
|
return null;
|
|
1405
1382
|
}
|
|
1406
1383
|
const roleId = String(opt.value);
|
|
1407
|
-
const resolved = this.#
|
|
1384
|
+
const resolved = this.#lookup("roles", roleId) ?? null;
|
|
1408
1385
|
if (!resolved && required)
|
|
1409
1386
|
throw new TypeError(`Resolved role for option "${name}" is missing.`);
|
|
1410
1387
|
return resolved;
|
|
@@ -1417,7 +1394,7 @@ class CommandOptions {
|
|
|
1417
1394
|
return null;
|
|
1418
1395
|
}
|
|
1419
1396
|
const id = String(opt.value);
|
|
1420
|
-
const resolved = this.#
|
|
1397
|
+
const resolved = this.#lookup("users", id) ?? this.#lookup("roles", id) ?? null;
|
|
1421
1398
|
if (!resolved && required)
|
|
1422
1399
|
throw new TypeError(`Resolved mentionable for option "${name}" is missing.`);
|
|
1423
1400
|
return resolved;
|
|
@@ -1427,9 +1404,9 @@ class CommandOptions {
|
|
|
1427
1404
|
if (!opt || opt.type !== OptionType.Mentionable)
|
|
1428
1405
|
return null;
|
|
1429
1406
|
const id = String(opt.value);
|
|
1430
|
-
if (this.#
|
|
1407
|
+
if (this.#lookup("users", id))
|
|
1431
1408
|
return "user";
|
|
1432
|
-
if (this.#
|
|
1409
|
+
if (this.#lookup("roles", id))
|
|
1433
1410
|
return "role";
|
|
1434
1411
|
return null;
|
|
1435
1412
|
}
|
|
@@ -1441,7 +1418,7 @@ class CommandOptions {
|
|
|
1441
1418
|
return null;
|
|
1442
1419
|
}
|
|
1443
1420
|
const attachmentId = String(opt.value);
|
|
1444
|
-
const resolved = this.#
|
|
1421
|
+
const resolved = this.#lookup("attachments", attachmentId) ?? null;
|
|
1445
1422
|
if (!resolved && required)
|
|
1446
1423
|
throw new TypeError(`Resolved attachment for option "${name}" is missing.`);
|
|
1447
1424
|
return resolved;
|
|
@@ -1745,16 +1722,19 @@ class ContextMenuCommandInteraction extends CommandInteraction {
|
|
|
1745
1722
|
|
|
1746
1723
|
class ComponentInteraction extends Interaction {
|
|
1747
1724
|
get customId() {
|
|
1748
|
-
|
|
1725
|
+
const id = this.data.data?.custom_id;
|
|
1726
|
+
return typeof id === "string" ? id : "";
|
|
1749
1727
|
}
|
|
1750
1728
|
get messageId() {
|
|
1751
|
-
return this.data
|
|
1729
|
+
return this.data.message?.id;
|
|
1752
1730
|
}
|
|
1753
1731
|
get componentType() {
|
|
1754
|
-
|
|
1732
|
+
const type = this.data.data?.component_type;
|
|
1733
|
+
return typeof type === "number" ? type : 0;
|
|
1755
1734
|
}
|
|
1756
1735
|
get values() {
|
|
1757
|
-
|
|
1736
|
+
const values = this.data.data?.values;
|
|
1737
|
+
return Array.isArray(values) ? values : [];
|
|
1758
1738
|
}
|
|
1759
1739
|
async deferUpdate(options = {}) {
|
|
1760
1740
|
const withResponse = options.withResponse === true;
|
|
@@ -1766,10 +1746,11 @@ class ComponentInteraction extends Interaction {
|
|
|
1766
1746
|
|
|
1767
1747
|
class ModalSubmitInteraction extends Interaction {
|
|
1768
1748
|
get customId() {
|
|
1769
|
-
|
|
1749
|
+
const id = this.data.data?.custom_id;
|
|
1750
|
+
return typeof id === "string" ? id : "";
|
|
1770
1751
|
}
|
|
1771
1752
|
getInputValue(customId) {
|
|
1772
|
-
const rows = this.data
|
|
1753
|
+
const rows = this.data.data?.components ?? [];
|
|
1773
1754
|
for (const row of rows) {
|
|
1774
1755
|
for (const comp of row.components ?? []) {
|
|
1775
1756
|
if (comp.custom_id === customId)
|
|
@@ -1793,11 +1774,12 @@ class AutocompleteInteraction extends Interaction {
|
|
|
1793
1774
|
this.options = new CommandOptions(data.data?.options ?? []);
|
|
1794
1775
|
}
|
|
1795
1776
|
get commandName() {
|
|
1796
|
-
|
|
1777
|
+
const name = this.data.data?.name;
|
|
1778
|
+
return typeof name === "string" ? name : "";
|
|
1797
1779
|
}
|
|
1798
1780
|
get focusedOption() {
|
|
1799
|
-
const options = this.data
|
|
1800
|
-
return findFocused(options);
|
|
1781
|
+
const options = this.data.data?.options;
|
|
1782
|
+
return findFocused(Array.isArray(options) ? options : []);
|
|
1801
1783
|
}
|
|
1802
1784
|
async respond(choices) {
|
|
1803
1785
|
if (!Array.isArray(choices))
|
|
@@ -2081,10 +2063,10 @@ class Message extends BaseStructure {
|
|
|
2081
2063
|
update(options) {
|
|
2082
2064
|
return this.edit(options);
|
|
2083
2065
|
}
|
|
2084
|
-
delete() {
|
|
2066
|
+
delete(reason) {
|
|
2085
2067
|
if (!this.#context)
|
|
2086
2068
|
throw new Error("This message is not attached to a client.");
|
|
2087
|
-
return this.#context.deleteMessage(this.channelId, this.id);
|
|
2069
|
+
return this.#context.deleteMessage(this.channelId, this.id, reason);
|
|
2088
2070
|
}
|
|
2089
2071
|
reply(options) {
|
|
2090
2072
|
if (!this.#context)
|
|
@@ -2131,15 +2113,15 @@ class Message extends BaseStructure {
|
|
|
2131
2113
|
throw new Error("This message is not attached to a client.");
|
|
2132
2114
|
return this.#context.removeAllReactions(this.channelId, this.id);
|
|
2133
2115
|
}
|
|
2134
|
-
pin() {
|
|
2116
|
+
pin(reason) {
|
|
2135
2117
|
if (!this.#context?.pinMessage)
|
|
2136
2118
|
throw new Error("This message is not attached to a client.");
|
|
2137
|
-
return this.#context.pinMessage(this.channelId, this.id);
|
|
2119
|
+
return this.#context.pinMessage(this.channelId, this.id, reason);
|
|
2138
2120
|
}
|
|
2139
|
-
unpin() {
|
|
2121
|
+
unpin(reason) {
|
|
2140
2122
|
if (!this.#context?.unpinMessage)
|
|
2141
2123
|
throw new Error("This message is not attached to a client.");
|
|
2142
|
-
return this.#context.unpinMessage(this.channelId, this.id);
|
|
2124
|
+
return this.#context.unpinMessage(this.channelId, this.id, reason);
|
|
2143
2125
|
}
|
|
2144
2126
|
get isEphemeral() {
|
|
2145
2127
|
return (this.flags & 64) !== 0;
|
|
@@ -2206,8 +2188,8 @@ export {
|
|
|
2206
2188
|
ForumChannel,
|
|
2207
2189
|
Guild,
|
|
2208
2190
|
GuildMember,
|
|
2209
|
-
|
|
2210
|
-
|
|
2191
|
+
GuildOnboarding,
|
|
2192
|
+
GuildWelcomeScreen,
|
|
2211
2193
|
Interaction,
|
|
2212
2194
|
InteractionEnum,
|
|
2213
2195
|
InteractionResponse,
|
|
@@ -2237,4 +2219,4 @@ export {
|
|
|
2237
2219
|
createInteraction
|
|
2238
2220
|
};
|
|
2239
2221
|
|
|
2240
|
-
//# debugId=
|
|
2222
|
+
//# debugId=6D582A31B8A2B2AE64756E2164756E21
|