lunibee 0.2.3 → 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 +8 -0
- package/dist/builders/commands.d.ts +122 -65
- package/dist/builders/components.d.ts +10 -31
- package/dist/builders/embed.d.ts +66 -33
- package/dist/builders/index.js +97 -131
- 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 +8 -0
- package/dist/core/index.js +607 -352
- package/dist/core/index.js.map +47 -47
- package/dist/core/permissions.d.ts +7 -3
- 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 +769 -587
- package/dist/index.js.map +65 -65
- package/dist/managers/base.d.ts +22 -14
- package/dist/managers/index.d.ts +2 -1
- package/dist/managers/index.js +445 -276
- package/dist/managers/index.js.map +26 -26
- package/dist/managers/message.d.ts +7 -3
- package/dist/rest/errors.d.ts +14 -7
- package/dist/rest/index.d.ts +24 -12
- package/dist/rest/index.js +54 -17
- package/dist/rest/index.js.map +14 -14
- package/dist/rest/redis.d.ts +1 -1
- package/dist/rest/route.d.ts +8 -4
- package/dist/rest/routes.d.ts +102 -48
- 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 +64 -32
- package/dist/sharding/index.js.map +17 -17
- package/dist/structures/base.d.ts +19 -10
- package/dist/structures/channels.d.ts +28 -14
- package/dist/structures/index.js +9 -59
- package/dist/structures/index.js.map +19 -18
- package/dist/structures/interactions.d.ts +96 -48
- package/dist/structures/resources.d.ts +88 -44
- package/dist/types/gateway.d.ts +1 -1
- 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 +14 -18
- 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 +15 -14
|
@@ -14,32 +14,50 @@ export type InteractionEnum = (typeof InteractionEnum)[keyof typeof InteractionE
|
|
|
14
14
|
export { InteractionResponseEnum, InteractionResponseType, } from "@lunibee/types";
|
|
15
15
|
/** Data shared by Discord interactions. */
|
|
16
16
|
export interface InteractionData {
|
|
17
|
-
/** Interaction identifier. */
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
|
|
17
|
+
/** Interaction identifier. */
|
|
18
|
+
id: string;
|
|
19
|
+
/** Application identifier. */
|
|
20
|
+
application_id: string;
|
|
21
|
+
/** Interaction type. */
|
|
22
|
+
type: number;
|
|
23
|
+
/** Interaction token. */
|
|
24
|
+
token: string;
|
|
25
|
+
/** Gateway/API version. */
|
|
26
|
+
version?: number;
|
|
27
|
+
/** Guild identifier. */
|
|
28
|
+
guild_id?: string;
|
|
29
|
+
/** Channel identifier. */
|
|
30
|
+
channel_id?: string;
|
|
31
|
+
/** Interaction-specific data. */
|
|
32
|
+
data?: Record<string, unknown>;
|
|
25
33
|
[key: string]: unknown;
|
|
26
34
|
}
|
|
27
35
|
/** Options for an interaction response message. */
|
|
28
36
|
export interface InteractionReplyOptions {
|
|
29
|
-
/** Message content. */
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
|
|
37
|
+
/** Message content. */
|
|
38
|
+
content?: string;
|
|
39
|
+
/** Whether the response is ephemeral. */
|
|
40
|
+
ephemeral?: boolean;
|
|
41
|
+
/** Message components. */
|
|
42
|
+
components?: unknown[];
|
|
43
|
+
/** Message embeds. */
|
|
44
|
+
embeds?: unknown[];
|
|
45
|
+
/** Discord message flags. */
|
|
46
|
+
flags?: number;
|
|
47
|
+
/** On `reply()` / `update()`: return the created message (one request, no `fetchReply()`). */
|
|
48
|
+
withResponse?: boolean;
|
|
35
49
|
[key: string]: unknown;
|
|
36
50
|
}
|
|
37
51
|
/** Transport required by an interaction structure. */
|
|
38
52
|
export interface InteractionClient {
|
|
39
|
-
/** Sends the initial interaction callback. @param id Interaction identifier. @param token Interaction token. @param response Callback payload. @returns Discord response. @throws {Error} When REST fails. */
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
|
|
53
|
+
/** Sends the initial interaction callback. @param id Interaction identifier. @param token Interaction token. @param response Callback payload. @returns Discord response. @throws {Error} When REST fails. */
|
|
54
|
+
postInteractionResponse(id: string, token: string, response: InteractionResponse): Promise<unknown>;
|
|
55
|
+
/** Edits the original interaction response. @param token Interaction token. @param data Message payload. @returns Discord response. @throws {Error} When REST fails. */
|
|
56
|
+
editInteractionReply(token: string, data: InteractionReplyOptions): Promise<unknown>;
|
|
57
|
+
/** Deletes the original interaction response. @param token Interaction token. @returns Promise fulfilled after deletion. @throws {Error} When REST fails. */
|
|
58
|
+
deleteInteractionReply(token: string): Promise<void>;
|
|
59
|
+
/** Sends a follow-up interaction webhook message. @param token Interaction token. @param data Message payload. @returns Discord response. @throws {Error} When REST fails. */
|
|
60
|
+
followUpInteraction(token: string, data: InteractionReplyOptions): Promise<unknown>;
|
|
43
61
|
/** Reads, edits or deletes an interaction webhook message (`@original` or a follow-up ID). Optional; required for {@link Interaction.fetchReply}, {@link Interaction.editFollowUp} and {@link Interaction.deleteFollowUp}. */
|
|
44
62
|
interactionWebhookMessage?(method: "GET" | "PATCH" | "DELETE", applicationId: string, token: string, messageId: string, data?: InteractionReplyOptions): Promise<unknown>;
|
|
45
63
|
/** Lets structures built from an interaction (such as {@link Interaction.member}) act through the client. Optional. */
|
|
@@ -55,27 +73,41 @@ export declare class InteractionResponse {
|
|
|
55
73
|
withResponse: boolean;
|
|
56
74
|
/** Creates a response payload. @param type Discord callback type. @param data Optional callback data. @throws {TypeError} If type is not finite. */
|
|
57
75
|
constructor(type: number, data?: InteractionReplyOptions);
|
|
58
|
-
/** Serializes the response for Discord. @returns Discord callback payload. */
|
|
76
|
+
/** Serializes the response for Discord. @returns Discord callback payload. */
|
|
77
|
+
toJSON(): {
|
|
59
78
|
type: number;
|
|
60
79
|
data?: InteractionReplyOptions;
|
|
61
80
|
};
|
|
62
|
-
/** Creates an immediate message response. @param options Response message options. @returns Callback payload. */
|
|
63
|
-
|
|
64
|
-
/** Creates a
|
|
81
|
+
/** Creates an immediate message response. @param options Response message options. @returns Callback payload. */
|
|
82
|
+
static message(options: InteractionReplyOptions): InteractionResponse;
|
|
83
|
+
/** Creates a deferred channel response. @param ephemeral Whether the eventual response is ephemeral. @returns Callback payload. */
|
|
84
|
+
static defer(ephemeral?: boolean): InteractionResponse;
|
|
85
|
+
/** Creates a Pong response. @returns Callback payload. */
|
|
86
|
+
static pong(): InteractionResponse;
|
|
65
87
|
}
|
|
66
88
|
/** Base interaction structure. */
|
|
67
89
|
export declare class Interaction<TData extends InteractionData = InteractionData> {
|
|
68
90
|
#private;
|
|
69
|
-
/** Interaction identifier. */
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
|
|
91
|
+
/** Interaction identifier. */
|
|
92
|
+
readonly id: string;
|
|
93
|
+
/** Application identifier. */
|
|
94
|
+
readonly applicationId: string;
|
|
95
|
+
/** Interaction token. */
|
|
96
|
+
readonly token: string;
|
|
97
|
+
/** Guild identifier. */
|
|
98
|
+
readonly guildId?: string;
|
|
99
|
+
/** Channel identifier. */
|
|
100
|
+
readonly channelId?: string;
|
|
101
|
+
/** Interaction type. */
|
|
102
|
+
readonly type: number;
|
|
103
|
+
/** Raw interaction data. */
|
|
104
|
+
readonly data: TData;
|
|
105
|
+
/** Whether the initial response was sent. */
|
|
106
|
+
replied: boolean;
|
|
107
|
+
/** Whether the initial response was deferred. */
|
|
108
|
+
deferred: boolean;
|
|
109
|
+
/** Creates an interaction from a Gateway payload. @param client Interaction transport. @param data Gateway interaction payload. @throws {TypeError} If required identifiers are missing. */
|
|
110
|
+
constructor(client: InteractionClient, data: TData);
|
|
79
111
|
/** Whether this interaction is any application command: slash or context menu. */
|
|
80
112
|
isCommand(): this is CommandInteraction;
|
|
81
113
|
/**
|
|
@@ -103,17 +135,28 @@ export declare class Interaction<TData extends InteractionData = InteractionData
|
|
|
103
135
|
customId?: string;
|
|
104
136
|
filter?: (interaction: ModalSubmitInteraction) => boolean | Promise<boolean>;
|
|
105
137
|
}): Promise<ModalSubmitInteraction>;
|
|
106
|
-
/** Whether this interaction is a message component. @returns True for component interactions. */
|
|
107
|
-
|
|
108
|
-
/** Whether this interaction is
|
|
109
|
-
|
|
110
|
-
/** Whether this is
|
|
111
|
-
|
|
112
|
-
/** Whether this is a
|
|
113
|
-
|
|
114
|
-
/** Whether this is a
|
|
115
|
-
|
|
116
|
-
/**
|
|
138
|
+
/** Whether this interaction is a message component. @returns True for component interactions. */
|
|
139
|
+
isMessageComponent(): this is ComponentInteraction;
|
|
140
|
+
/** Whether this interaction is a modal submission. @returns True for modal submissions. */
|
|
141
|
+
isModalSubmit(): this is ModalSubmitInteraction;
|
|
142
|
+
/** Whether this interaction is autocomplete. @returns True for autocomplete interactions. */
|
|
143
|
+
isAutocomplete(): this is AutocompleteInteraction;
|
|
144
|
+
/** Whether this is a button interaction. */
|
|
145
|
+
isButton(): this is ComponentInteraction;
|
|
146
|
+
/** Whether this is a string select menu interaction. */
|
|
147
|
+
isStringSelectMenu(): this is ComponentInteraction;
|
|
148
|
+
/** Whether this is a user select menu interaction. */
|
|
149
|
+
isUserSelectMenu(): this is ComponentInteraction;
|
|
150
|
+
/** Whether this is a role select menu interaction. */
|
|
151
|
+
isRoleSelectMenu(): this is ComponentInteraction;
|
|
152
|
+
/** Whether this is a mentionable select menu interaction. */
|
|
153
|
+
isMentionableSelectMenu(): this is ComponentInteraction;
|
|
154
|
+
/** Whether this is a channel select menu interaction. */
|
|
155
|
+
isChannelSelectMenu(): this is ComponentInteraction;
|
|
156
|
+
/** Whether this is any select menu interaction. */
|
|
157
|
+
isAnySelectMenu(): this is ComponentInteraction;
|
|
158
|
+
/** Ensures the interaction has not already been acknowledged. @returns Nothing. @throws {Error} When already acknowledged. */
|
|
159
|
+
protected assertUnacknowledged(): void;
|
|
117
160
|
/**
|
|
118
161
|
* Sends the initial response exactly once. The in-flight flag is set
|
|
119
162
|
* before the request, so two concurrent calls cannot both send; it is
|
|
@@ -136,7 +179,8 @@ export declare class Interaction<TData extends InteractionData = InteractionData
|
|
|
136
179
|
editFollowUp(messageId: string, options: InteractionReplyOptions | string): Promise<unknown>;
|
|
137
180
|
/** Deletes a follow-up message. @param messageId Follow-up message ID. */
|
|
138
181
|
deleteFollowUp(messageId: string): Promise<void>;
|
|
139
|
-
/** Ensures the interaction has been acknowledged. @returns Nothing. @throws {Error} When not acknowledged. */
|
|
182
|
+
/** Ensures the interaction has been acknowledged. @returns Nothing. @throws {Error} When not acknowledged. */
|
|
183
|
+
protected assertAcknowledged(): void;
|
|
140
184
|
/** Posts a raw interaction response callback. */
|
|
141
185
|
protected postResponse(response: InteractionResponse): Promise<unknown>;
|
|
142
186
|
/**
|
|
@@ -166,9 +210,12 @@ export declare class Interaction<TData extends InteractionData = InteractionData
|
|
|
166
210
|
ephemeral?: boolean;
|
|
167
211
|
withResponse?: boolean;
|
|
168
212
|
}): Promise<void>;
|
|
169
|
-
/** Edits the original response. @param options Replacement message options. @returns Discord response. @throws {Error} When not acknowledged or REST fails. */
|
|
170
|
-
|
|
171
|
-
/**
|
|
213
|
+
/** Edits the original response. @param options Replacement message options. @returns Discord response. @throws {Error} When not acknowledged or REST fails. */
|
|
214
|
+
editReply(options: InteractionReplyOptions): Promise<unknown>;
|
|
215
|
+
/** Deletes the original response. @returns Promise fulfilled after deletion. @throws {Error} When not acknowledged or REST fails. */
|
|
216
|
+
deleteReply(): Promise<void>;
|
|
217
|
+
/** Sends a follow-up message using the interaction webhook. @param options Follow-up message options. @returns Discord response. @throws {Error} When REST fails. */
|
|
218
|
+
followUp(options: InteractionReplyOptions | string): Promise<unknown>;
|
|
172
219
|
/**
|
|
173
220
|
* Updates the message a component is on. With `withResponse: true` it
|
|
174
221
|
* returns the updated {@link Message}.
|
|
@@ -194,7 +241,8 @@ export declare class Interaction<TData extends InteractionData = InteractionData
|
|
|
194
241
|
export declare class CommandInteraction extends Interaction {
|
|
195
242
|
/** Typed option resolver. Access slash command options with full type safety. */
|
|
196
243
|
readonly options: CommandOptions;
|
|
197
|
-
/** Invoked command name. @returns Command name or an empty string. */
|
|
244
|
+
/** Invoked command name. @returns Command name or an empty string. */
|
|
245
|
+
get commandName(): string;
|
|
198
246
|
constructor(client: InteractionClient, data: InteractionData);
|
|
199
247
|
}
|
|
200
248
|
/** A user or message context-menu command, with what was right-clicked. */
|
|
@@ -4,16 +4,26 @@ import type { ImageURLOptions, ResourceContext } from "./base.js";
|
|
|
4
4
|
/** A Discord guild member. */
|
|
5
5
|
export declare class GuildMember {
|
|
6
6
|
#private;
|
|
7
|
-
/** User represented by the member. */
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
|
|
7
|
+
/** User represented by the member. */
|
|
8
|
+
readonly user: User;
|
|
9
|
+
/** Guild containing the member. */
|
|
10
|
+
readonly guildId: string;
|
|
11
|
+
/** Nickname, if configured. */
|
|
12
|
+
nickname: string | null;
|
|
13
|
+
/** Role IDs assigned to the member. */
|
|
14
|
+
readonly roleIds: string[];
|
|
15
|
+
/** Whether the member is pending membership screening. */
|
|
16
|
+
pending: boolean;
|
|
17
|
+
/** Member join timestamp. */
|
|
18
|
+
joinedAt?: Date;
|
|
19
|
+
/** Member-specific avatar hash, if set. */
|
|
20
|
+
avatarHash: string | null;
|
|
21
|
+
/** When the member started boosting the guild. */
|
|
22
|
+
premiumSince: Date | null;
|
|
23
|
+
/** When the member's timeout expires (null if not timed out). */
|
|
24
|
+
timedOutUntil: Date | null;
|
|
25
|
+
/** Member flags bitfield. */
|
|
26
|
+
flags: number;
|
|
17
27
|
/** Creates a guild member from Discord data. @param data Discord guild-member payload. @throws {TypeError} If the guild ID is invalid. @throws {RangeError} If joined_at is invalid. */
|
|
18
28
|
constructor(data: {
|
|
19
29
|
user: {
|
|
@@ -76,16 +86,26 @@ export declare class GuildMember {
|
|
|
76
86
|
}
|
|
77
87
|
/** A Discord guild role. */
|
|
78
88
|
export declare class Role extends BaseStructure {
|
|
79
|
-
/** Role name. */
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
|
|
83
|
-
/** Whether the role is
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
|
|
89
|
+
/** Role name. */
|
|
90
|
+
name: string;
|
|
91
|
+
/** Role color as a 24-bit RGB integer. */
|
|
92
|
+
color: number;
|
|
93
|
+
/** Whether the role is hoisted. */
|
|
94
|
+
hoist: boolean;
|
|
95
|
+
/** Permission bitfield. */
|
|
96
|
+
permissions: PermissionsBitField;
|
|
97
|
+
/** Whether the role is managed by an integration. */
|
|
98
|
+
managed: boolean;
|
|
99
|
+
/** Whether the role is mentionable. */
|
|
100
|
+
mentionable: boolean;
|
|
101
|
+
/** Role position in the hierarchy. */
|
|
102
|
+
position: number;
|
|
103
|
+
/** Unicode emoji used as the role icon, if any. */
|
|
104
|
+
unicodeEmoji: string | null;
|
|
105
|
+
/** Hash of the role's custom icon image, if any. */
|
|
106
|
+
iconHash: string | null;
|
|
107
|
+
/** Role tags metadata (bot, premium subscriber, etc). */
|
|
108
|
+
tags: Record<string, unknown> | null;
|
|
89
109
|
/** Creates a role from Discord data. @param data Discord role payload. */
|
|
90
110
|
constructor(data: {
|
|
91
111
|
id: string;
|
|
@@ -124,16 +144,26 @@ export declare class TextChannel extends Channel {
|
|
|
124
144
|
}
|
|
125
145
|
/** A Discord invite link and its metadata. */
|
|
126
146
|
export declare class Invite {
|
|
127
|
-
/** Invite code (the unique part of the URL). */
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
|
|
131
|
-
/**
|
|
132
|
-
|
|
133
|
-
/**
|
|
134
|
-
|
|
135
|
-
/**
|
|
136
|
-
|
|
147
|
+
/** Invite code (the unique part of the URL). */
|
|
148
|
+
readonly code: string;
|
|
149
|
+
/** Guild this invite belongs to, if any. */
|
|
150
|
+
readonly guildId: string | null;
|
|
151
|
+
/** Channel this invite points to, if any. */
|
|
152
|
+
readonly channelId: string | null;
|
|
153
|
+
/** User who created the invite, if available. */
|
|
154
|
+
readonly inviter: User | null;
|
|
155
|
+
/** Number of times the invite has been used. */
|
|
156
|
+
uses: number;
|
|
157
|
+
/** Maximum number of uses (0 = unlimited). */
|
|
158
|
+
maxUses: number;
|
|
159
|
+
/** Duration in seconds until the invite expires (0 = never). */
|
|
160
|
+
maxAge: number;
|
|
161
|
+
/** Whether the invite is temporary (kicks uninducted members on disconnect). */
|
|
162
|
+
temporary: boolean;
|
|
163
|
+
/** When the invite was created. */
|
|
164
|
+
readonly createdAt: Date | null;
|
|
165
|
+
/** When the invite expires, or null if it never expires. */
|
|
166
|
+
readonly expiresAt: Date | null;
|
|
137
167
|
/** Creates an invite from Discord data. */
|
|
138
168
|
constructor(data: {
|
|
139
169
|
code: string;
|
|
@@ -175,13 +205,20 @@ export declare const WebhookEnum: {
|
|
|
175
205
|
export type WebhookEnum = (typeof WebhookEnum)[keyof typeof WebhookEnum];
|
|
176
206
|
/** A Discord webhook — an HTTP endpoint that can post messages to a channel. */
|
|
177
207
|
export declare class Webhook extends BaseStructure {
|
|
178
|
-
/** Webhook type. */
|
|
179
|
-
|
|
180
|
-
/** Webhook
|
|
181
|
-
|
|
182
|
-
/**
|
|
183
|
-
|
|
184
|
-
/**
|
|
208
|
+
/** Webhook type. */
|
|
209
|
+
readonly type: number;
|
|
210
|
+
/** Webhook display name. */
|
|
211
|
+
name: string | null;
|
|
212
|
+
/** Webhook avatar hash. */
|
|
213
|
+
avatarHash: string | null;
|
|
214
|
+
/** Channel this webhook posts to. */
|
|
215
|
+
readonly channelId: string | null;
|
|
216
|
+
/** Guild this webhook belongs to. */
|
|
217
|
+
readonly guildId: string | null;
|
|
218
|
+
/** Application that created this webhook, if any. */
|
|
219
|
+
readonly applicationId: string | null;
|
|
220
|
+
/** Webhook token (only present for incoming webhooks). */
|
|
221
|
+
readonly token: string | null;
|
|
185
222
|
/** Creates a webhook from Discord data. */
|
|
186
223
|
constructor(data: {
|
|
187
224
|
id: string;
|
|
@@ -202,13 +239,20 @@ export declare class Webhook extends BaseStructure {
|
|
|
202
239
|
}
|
|
203
240
|
/** A Discord emoji. */
|
|
204
241
|
export declare class Emoji extends BaseStructure {
|
|
205
|
-
/** Emoji name. */
|
|
206
|
-
|
|
207
|
-
/**
|
|
208
|
-
|
|
209
|
-
/**
|
|
210
|
-
|
|
211
|
-
/** Whether this emoji
|
|
242
|
+
/** Emoji name. */
|
|
243
|
+
name: string | null;
|
|
244
|
+
/** Roles allowed to use this emoji. */
|
|
245
|
+
roleIds: string[];
|
|
246
|
+
/** User that created this emoji. */
|
|
247
|
+
user: User | null;
|
|
248
|
+
/** Whether this emoji must be wrapped in colons. */
|
|
249
|
+
requireColons: boolean;
|
|
250
|
+
/** Whether this emoji is managed. */
|
|
251
|
+
managed: boolean;
|
|
252
|
+
/** Whether this emoji is animated. */
|
|
253
|
+
animated: boolean;
|
|
254
|
+
/** Whether this emoji can be used, may be false due to loss of Server Boosts. */
|
|
255
|
+
available: boolean;
|
|
212
256
|
/** Creates an emoji from Discord data. */
|
|
213
257
|
constructor(data: {
|
|
214
258
|
id: string | null;
|
package/dist/types/gateway.d.ts
CHANGED
|
@@ -138,7 +138,7 @@ export interface GatewayProperties {
|
|
|
138
138
|
os?: string;
|
|
139
139
|
browser?: string;
|
|
140
140
|
device?: string;
|
|
141
|
-
[key: string]:
|
|
141
|
+
[key: string]: string | undefined;
|
|
142
142
|
}
|
|
143
143
|
/** Gateway presence activity. */
|
|
144
144
|
export interface GatewayPresenceActivity {
|
package/dist/types/index.js
CHANGED
|
@@ -53,28 +53,26 @@ var IntentBits = {
|
|
|
53
53
|
};
|
|
54
54
|
var Intents = IntentBits;
|
|
55
55
|
function resolveGatewayIntents(intents) {
|
|
56
|
-
if (
|
|
57
|
-
return intents;
|
|
58
|
-
if (
|
|
56
|
+
if (Array.isArray(intents))
|
|
57
|
+
return intents.reduce((acc, intent) => acc | resolveIntent(intent), 0);
|
|
58
|
+
if (typeof intents === "object")
|
|
59
59
|
return intents.bitfield;
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}
|
|
77
|
-
return 0;
|
|
60
|
+
return resolveIntent(intents);
|
|
61
|
+
}
|
|
62
|
+
function resolveIntent(intent) {
|
|
63
|
+
if (typeof intent === "number")
|
|
64
|
+
return intent;
|
|
65
|
+
const bits = {
|
|
66
|
+
...IntentBits,
|
|
67
|
+
...GatewayIntentBits
|
|
68
|
+
};
|
|
69
|
+
const lower = intent.charAt(0).toLowerCase() + intent.slice(1);
|
|
70
|
+
if (Object.hasOwn(bits, intent))
|
|
71
|
+
return bits[intent];
|
|
72
|
+
if (Object.hasOwn(bits, lower))
|
|
73
|
+
return bits[lower];
|
|
74
|
+
const num = Number(intent);
|
|
75
|
+
return Number.isNaN(num) ? 0 : num;
|
|
78
76
|
}
|
|
79
77
|
|
|
80
78
|
class IntentsBitField {
|
|
@@ -268,4 +266,4 @@ export {
|
|
|
268
266
|
resolveGatewayIntents
|
|
269
267
|
};
|
|
270
268
|
|
|
271
|
-
//# debugId=
|
|
269
|
+
//# debugId=9EEF77311C3CC22364756E2164756E21
|