lunibee 0.2.1 → 0.2.3
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/README.md +6 -6
- package/dist/builders/attachment.d.ts +5 -1
- package/dist/builders/commands.d.ts +136 -47
- package/dist/builders/components.d.ts +164 -45
- package/dist/builders/embed.d.ts +5 -1
- package/dist/builders/index.d.ts +9 -4
- package/dist/builders/index.js +206 -105
- package/dist/builders/index.js.map +8 -8
- package/dist/core/events.d.ts +28 -12
- package/dist/core/index.d.ts +2 -1
- package/dist/core/index.js +377 -150
- package/dist/core/index.js.map +25 -25
- package/dist/core/permissions.d.ts +6 -2
- package/dist/index.d.ts +5 -4
- package/dist/index.js +662 -268
- package/dist/index.js.map +33 -32
- package/dist/managers/base.d.ts +4 -0
- 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 +31 -14
- package/dist/managers/index.js +167 -80
- package/dist/managers/index.js.map +18 -18
- 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 +1 -0
- package/dist/rest/index.d.ts +1 -0
- package/dist/rest/index.js +53 -3
- package/dist/rest/index.js.map +7 -6
- package/dist/rest/routes.d.ts +4 -2
- package/dist/sharding/index.js +7 -6
- package/dist/sharding/index.js.map +6 -6
- package/dist/structures/base.d.ts +18 -9
- package/dist/structures/index.d.ts +15 -9
- package/dist/structures/index.js +198 -68
- package/dist/structures/index.js.map +12 -12
- package/dist/structures/interactions.d.ts +85 -11
- package/dist/structures/resources.d.ts +11 -1
- package/dist/types/gateway.d.ts +14 -0
- package/dist/types/index.d.ts +204 -16
- package/dist/types/index.js +37 -10
- package/dist/types/index.js.map +4 -4
- package/dist/voice/index.js +4 -3
- package/dist/voice/index.js.map +3 -3
- package/dist/ws/index.js +2 -1
- package/dist/ws/index.js.map +5 -5
- package/package.json +15 -15
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
import { User, type ResourceContext } from "./base.js";
|
|
2
2
|
import { GuildMember } from "./resources.js";
|
|
3
|
+
import { Message } from "./index.js";
|
|
3
4
|
/** Discord interaction type constants. */
|
|
4
|
-
export declare const
|
|
5
|
+
export declare const InteractionEnum: {
|
|
5
6
|
readonly Ping: 1;
|
|
6
7
|
readonly ApplicationCommand: 2;
|
|
7
8
|
readonly MessageComponent: 3;
|
|
8
9
|
readonly ApplicationCommandAutocomplete: 4;
|
|
9
10
|
readonly ModalSubmit: 5;
|
|
10
11
|
};
|
|
11
|
-
|
|
12
|
+
/** One {@link InteractionEnum} value, usable as a type. */
|
|
13
|
+
export type InteractionEnum = (typeof InteractionEnum)[keyof typeof InteractionEnum];
|
|
14
|
+
export { InteractionResponseEnum, InteractionResponseType, } from "@lunibee/types";
|
|
12
15
|
/** Data shared by Discord interactions. */
|
|
13
16
|
export interface InteractionData {
|
|
14
17
|
/** Interaction identifier. */ id: string;
|
|
@@ -28,6 +31,7 @@ export interface InteractionReplyOptions {
|
|
|
28
31
|
/** Message components. */ components?: unknown[];
|
|
29
32
|
/** Message embeds. */ embeds?: unknown[];
|
|
30
33
|
/** Discord message flags. */ flags?: number;
|
|
34
|
+
/** On `reply()` / `update()`: return the created message (one request, no `fetchReply()`). */ withResponse?: boolean;
|
|
31
35
|
[key: string]: unknown;
|
|
32
36
|
}
|
|
33
37
|
/** Transport required by an interaction structure. */
|
|
@@ -47,6 +51,8 @@ import { CommandOptions } from "./options.js";
|
|
|
47
51
|
export declare class InteractionResponse {
|
|
48
52
|
readonly type: number;
|
|
49
53
|
readonly data?: InteractionReplyOptions;
|
|
54
|
+
/** Ask Discord to return the created message (`?with_response=true`); not part of the body. */
|
|
55
|
+
withResponse: boolean;
|
|
50
56
|
/** Creates a response payload. @param type Discord callback type. @param data Optional callback data. @throws {TypeError} If type is not finite. */
|
|
51
57
|
constructor(type: number, data?: InteractionReplyOptions);
|
|
52
58
|
/** Serializes the response for Discord. @returns Discord callback payload. */ toJSON(): {
|
|
@@ -70,7 +76,21 @@ export declare class Interaction<TData extends InteractionData = InteractionData
|
|
|
70
76
|
/** Whether the initial response was sent. */ replied: boolean;
|
|
71
77
|
/** Whether the initial response was deferred. */ deferred: boolean;
|
|
72
78
|
/** Creates an interaction from a Gateway payload. @param client Interaction transport. @param data Gateway interaction payload. @throws {TypeError} If required identifiers are missing. */ constructor(client: InteractionClient, data: TData);
|
|
73
|
-
/** Whether this interaction is
|
|
79
|
+
/** Whether this interaction is any application command: slash or context menu. */
|
|
80
|
+
isCommand(): this is CommandInteraction;
|
|
81
|
+
/**
|
|
82
|
+
* Whether this interaction is a slash (chat input) command. Since 0.2.2 this
|
|
83
|
+
* is false for context-menu commands; use {@link isCommand} for both.
|
|
84
|
+
*/
|
|
85
|
+
isChatInputCommand(): this is CommandInteraction;
|
|
86
|
+
/** Whether this interaction is a user or message context-menu command. */
|
|
87
|
+
isContextMenuCommand(): this is ContextMenuCommandInteraction;
|
|
88
|
+
/** Whether this interaction is a user context-menu command (right-click a user). */
|
|
89
|
+
isUserContextMenuCommand(): this is ContextMenuCommandInteraction;
|
|
90
|
+
/** Whether this interaction is a message context-menu command (right-click a message). */
|
|
91
|
+
isMessageContextMenuCommand(): this is ContextMenuCommandInteraction;
|
|
92
|
+
/** The client context structures built from this interaction act through. */
|
|
93
|
+
protected get resourceContext(): ResourceContext | undefined;
|
|
74
94
|
/**
|
|
75
95
|
* Waits for this user to submit a modal, typically one this interaction
|
|
76
96
|
* just opened with {@link showModal}.
|
|
@@ -119,14 +139,44 @@ export declare class Interaction<TData extends InteractionData = InteractionData
|
|
|
119
139
|
/** Ensures the interaction has been acknowledged. @returns Nothing. @throws {Error} When not acknowledged. */ protected assertAcknowledged(): void;
|
|
120
140
|
/** Posts a raw interaction response callback. */
|
|
121
141
|
protected postResponse(response: InteractionResponse): Promise<unknown>;
|
|
122
|
-
/**
|
|
123
|
-
|
|
142
|
+
/**
|
|
143
|
+
* Sends a response and, when `withResponse` is set, turns the callback
|
|
144
|
+
* resource Discord returns into the created message.
|
|
145
|
+
*/
|
|
146
|
+
protected acknowledgeWith(response: InteractionResponse, state: "replied" | "deferred", withResponse: boolean): Promise<unknown>;
|
|
147
|
+
/**
|
|
148
|
+
* Sends the initial interaction response. With `withResponse: true` it
|
|
149
|
+
* returns the created {@link Message} in the same request (no `fetchReply()`).
|
|
150
|
+
* @throws {Error} When already acknowledged or REST fails.
|
|
151
|
+
*/
|
|
152
|
+
reply(options: InteractionReplyOptions & {
|
|
153
|
+
withResponse: true;
|
|
154
|
+
}): Promise<Message | null>;
|
|
155
|
+
reply(options: InteractionReplyOptions | string): Promise<unknown>;
|
|
156
|
+
/**
|
|
157
|
+
* Defers the initial interaction response. `true` or `{ ephemeral: true }`
|
|
158
|
+
* makes the eventual response private; `withResponse: true` returns the
|
|
159
|
+
* placeholder message. @throws {Error} When already acknowledged or REST fails.
|
|
160
|
+
*/
|
|
161
|
+
deferReply(options: {
|
|
124
162
|
ephemeral?: boolean;
|
|
163
|
+
withResponse: true;
|
|
164
|
+
}): Promise<Message | null>;
|
|
165
|
+
deferReply(options?: boolean | {
|
|
166
|
+
ephemeral?: boolean;
|
|
167
|
+
withResponse?: boolean;
|
|
125
168
|
}): Promise<void>;
|
|
126
169
|
/** Edits the original response. @param options Replacement message options. @returns Discord response. @throws {Error} When not acknowledged or REST fails. */ editReply(options: InteractionReplyOptions): Promise<unknown>;
|
|
127
170
|
/** Deletes the original response. @returns Promise fulfilled after deletion. @throws {Error} When not acknowledged or REST fails. */ deleteReply(): Promise<void>;
|
|
128
171
|
/** Sends a follow-up message using the interaction webhook. @param options Follow-up message options. @returns Discord response. @throws {Error} When REST fails. */ followUp(options: InteractionReplyOptions | string): Promise<unknown>;
|
|
129
|
-
/**
|
|
172
|
+
/**
|
|
173
|
+
* Updates the message a component is on. With `withResponse: true` it
|
|
174
|
+
* returns the updated {@link Message}.
|
|
175
|
+
*/
|
|
176
|
+
update(options: InteractionReplyOptions & {
|
|
177
|
+
withResponse: true;
|
|
178
|
+
}): Promise<Message | null>;
|
|
179
|
+
update(options: InteractionReplyOptions | string): Promise<unknown>;
|
|
130
180
|
/** Opens a modal dialog in the user's client. @param modal Modal builder output or raw modal callback data. @returns Discord response. @throws {Error} When already acknowledged or REST fails. */
|
|
131
181
|
showModal(modal: {
|
|
132
182
|
toJSON(): {
|
|
@@ -137,8 +187,7 @@ export declare class Interaction<TData extends InteractionData = InteractionData
|
|
|
137
187
|
} | {
|
|
138
188
|
custom_id: string;
|
|
139
189
|
title: string;
|
|
140
|
-
components: unknown[];
|
|
141
|
-
[key: string]: unknown;
|
|
190
|
+
components: readonly unknown[];
|
|
142
191
|
}): Promise<unknown>;
|
|
143
192
|
}
|
|
144
193
|
/** Application command interaction with fully typed option resolver. */
|
|
@@ -148,6 +197,18 @@ export declare class CommandInteraction extends Interaction {
|
|
|
148
197
|
/** Invoked command name. @returns Command name or an empty string. */ get commandName(): string;
|
|
149
198
|
constructor(client: InteractionClient, data: InteractionData);
|
|
150
199
|
}
|
|
200
|
+
/** A user or message context-menu command, with what was right-clicked. */
|
|
201
|
+
export declare class ContextMenuCommandInteraction extends CommandInteraction {
|
|
202
|
+
#private;
|
|
203
|
+
/** ID of the user or message the command was used on. */
|
|
204
|
+
get targetId(): string | null;
|
|
205
|
+
/** The user a user command was used on. */
|
|
206
|
+
get targetUser(): User | null;
|
|
207
|
+
/** The member a user command was used on (in a guild), with member actions when attached to a client. */
|
|
208
|
+
get targetMember(): GuildMember | null;
|
|
209
|
+
/** The message a message command was used on. */
|
|
210
|
+
get targetMessage(): Message | null;
|
|
211
|
+
}
|
|
151
212
|
/** Message component interaction. */
|
|
152
213
|
export declare class ComponentInteraction extends Interaction {
|
|
153
214
|
/** Gets component custom ID. */
|
|
@@ -159,9 +220,12 @@ export declare class ComponentInteraction extends Interaction {
|
|
|
159
220
|
/** Gets selected values for select menu component interactions. */
|
|
160
221
|
get values(): string[];
|
|
161
222
|
/** Defers updating the message to which the component was attached. */
|
|
162
|
-
deferUpdate(
|
|
163
|
-
|
|
164
|
-
|
|
223
|
+
deferUpdate(options: {
|
|
224
|
+
withResponse: true;
|
|
225
|
+
}): Promise<Message | null>;
|
|
226
|
+
deferUpdate(options?: {
|
|
227
|
+
withResponse?: boolean;
|
|
228
|
+
}): Promise<void>;
|
|
165
229
|
}
|
|
166
230
|
/** Represents a Discord modal submission interaction. */
|
|
167
231
|
export declare class ModalSubmitInteraction extends Interaction {
|
|
@@ -199,3 +263,13 @@ export declare class AutocompleteInteraction extends Interaction {
|
|
|
199
263
|
* @throws {TypeError} If required identifiers are missing.
|
|
200
264
|
*/
|
|
201
265
|
export declare function createInteraction(client: InteractionClient, data: InteractionData): Interaction;
|
|
266
|
+
/** @deprecated Use {@link InteractionEnum}. Removed in 0.3.0. */
|
|
267
|
+
export declare const InteractionType: {
|
|
268
|
+
readonly Ping: 1;
|
|
269
|
+
readonly ApplicationCommand: 2;
|
|
270
|
+
readonly MessageComponent: 3;
|
|
271
|
+
readonly ApplicationCommandAutocomplete: 4;
|
|
272
|
+
readonly ModalSubmit: 5;
|
|
273
|
+
};
|
|
274
|
+
/** @deprecated Use {@link InteractionEnum}. Removed in 0.3.0. */
|
|
275
|
+
export type InteractionType = InteractionEnum;
|
|
@@ -166,11 +166,13 @@ export declare class Invite {
|
|
|
166
166
|
toString(): string;
|
|
167
167
|
}
|
|
168
168
|
/** Webhook type constants. */
|
|
169
|
-
export declare const
|
|
169
|
+
export declare const WebhookEnum: {
|
|
170
170
|
readonly Incoming: 1;
|
|
171
171
|
readonly ChannelFollower: 2;
|
|
172
172
|
readonly Application: 3;
|
|
173
173
|
};
|
|
174
|
+
/** One {@link WebhookEnum} value, usable as a type. */
|
|
175
|
+
export type WebhookEnum = (typeof WebhookEnum)[keyof typeof WebhookEnum];
|
|
174
176
|
/** A Discord webhook — an HTTP endpoint that can post messages to a channel. */
|
|
175
177
|
export declare class Webhook extends BaseStructure {
|
|
176
178
|
/** Webhook type. */ readonly type: number;
|
|
@@ -280,3 +282,11 @@ export declare class GuildOnboarding extends BaseStructure {
|
|
|
280
282
|
mode: number;
|
|
281
283
|
constructor(data: import("@lunibee/types").APIGuildOnboarding);
|
|
282
284
|
}
|
|
285
|
+
/** @deprecated Use {@link WebhookEnum}. Removed in 0.3.0. */
|
|
286
|
+
export declare const WebhookType: {
|
|
287
|
+
readonly Incoming: 1;
|
|
288
|
+
readonly ChannelFollower: 2;
|
|
289
|
+
readonly Application: 3;
|
|
290
|
+
};
|
|
291
|
+
/** @deprecated Use {@link WebhookEnum}. Removed in 0.3.0. */
|
|
292
|
+
export type WebhookType = WebhookEnum;
|
package/dist/types/gateway.d.ts
CHANGED
|
@@ -176,6 +176,20 @@ export interface ClientOptions {
|
|
|
176
176
|
roles?: boolean;
|
|
177
177
|
emojis?: boolean;
|
|
178
178
|
};
|
|
179
|
+
/**
|
|
180
|
+
* Default `allowed_mentions` for every message the client sends (channel
|
|
181
|
+
* send/edit, replies, interaction replies, edits and follow-ups), e.g.
|
|
182
|
+
* `{ parse: [] }` so nothing pings unless a message says so. A message's
|
|
183
|
+
* own `allowed_mentions` always wins.
|
|
184
|
+
*/
|
|
185
|
+
allowedMentions?: AllowedMentions;
|
|
186
|
+
}
|
|
187
|
+
/** Discord's `allowed_mentions` object. */
|
|
188
|
+
export interface AllowedMentions {
|
|
189
|
+
parse?: ("users" | "roles" | "everyone")[];
|
|
190
|
+
users?: string[];
|
|
191
|
+
roles?: string[];
|
|
192
|
+
replied_user?: boolean;
|
|
179
193
|
}
|
|
180
194
|
/** Gateway connection configuration. */
|
|
181
195
|
export interface GatewayOptions {
|
package/dist/types/index.d.ts
CHANGED
|
@@ -43,7 +43,7 @@ export declare const MessageFlags: {
|
|
|
43
43
|
/** One {@link MessageFlags} value, usable as a type. */
|
|
44
44
|
export type MessageFlags = (typeof MessageFlags)[keyof typeof MessageFlags];
|
|
45
45
|
/** Discord channel types. */
|
|
46
|
-
export declare const
|
|
46
|
+
export declare const ChannelEnum: {
|
|
47
47
|
readonly GuildText: 0;
|
|
48
48
|
readonly DM: 1;
|
|
49
49
|
readonly GuildVoice: 2;
|
|
@@ -58,8 +58,10 @@ export declare const ChannelType: {
|
|
|
58
58
|
readonly GuildForum: 15;
|
|
59
59
|
readonly GuildMedia: 16;
|
|
60
60
|
};
|
|
61
|
+
/** One {@link ChannelEnum} value, usable as a type. */
|
|
62
|
+
export type ChannelEnum = (typeof ChannelEnum)[keyof typeof ChannelEnum];
|
|
61
63
|
/** Discord component types. */
|
|
62
|
-
export declare const
|
|
64
|
+
export declare const ComponentEnum: {
|
|
63
65
|
readonly ActionRow: 1;
|
|
64
66
|
readonly Button: 2;
|
|
65
67
|
readonly StringSelect: 3;
|
|
@@ -77,10 +79,10 @@ export declare const ComponentType: {
|
|
|
77
79
|
readonly ContentInventoryEntry: 16;
|
|
78
80
|
readonly Container: 17;
|
|
79
81
|
};
|
|
80
|
-
/** One {@link
|
|
81
|
-
export type
|
|
82
|
+
/** One {@link ComponentEnum} value, usable as a type. */
|
|
83
|
+
export type ComponentEnum = (typeof ComponentEnum)[keyof typeof ComponentEnum];
|
|
82
84
|
/** Discord button style types. */
|
|
83
|
-
export declare const
|
|
85
|
+
export declare const ButtonType: {
|
|
84
86
|
readonly Primary: 1;
|
|
85
87
|
readonly Secondary: 2;
|
|
86
88
|
readonly Success: 3;
|
|
@@ -88,17 +90,17 @@ export declare const ButtonStyle: {
|
|
|
88
90
|
readonly Link: 5;
|
|
89
91
|
readonly Premium: 6;
|
|
90
92
|
};
|
|
91
|
-
/** One {@link
|
|
92
|
-
export type
|
|
93
|
+
/** One {@link ButtonType} value, usable as a type: `style: ButtonType`. */
|
|
94
|
+
export type ButtonType = (typeof ButtonType)[keyof typeof ButtonType];
|
|
93
95
|
/** Discord text input style types. */
|
|
94
|
-
export declare const
|
|
96
|
+
export declare const TextInputType: {
|
|
95
97
|
readonly Short: 1;
|
|
96
98
|
readonly Paragraph: 2;
|
|
97
99
|
};
|
|
98
|
-
/** One {@link
|
|
99
|
-
export type
|
|
100
|
+
/** One {@link TextInputType} value, usable as a type. */
|
|
101
|
+
export type TextInputType = (typeof TextInputType)[keyof typeof TextInputType];
|
|
100
102
|
/** Discord interaction response types. */
|
|
101
|
-
export declare const
|
|
103
|
+
export declare const InteractionResponseEnum: {
|
|
102
104
|
readonly Pong: 1;
|
|
103
105
|
readonly ChannelMessage: 4;
|
|
104
106
|
readonly DeferredChannelMessage: 5;
|
|
@@ -107,18 +109,24 @@ export declare const InteractionResponseType: {
|
|
|
107
109
|
readonly Autocomplete: 8;
|
|
108
110
|
readonly Modal: 9;
|
|
109
111
|
};
|
|
112
|
+
/** One {@link InteractionResponseEnum} value, usable as a type. */
|
|
113
|
+
export type InteractionResponseEnum = (typeof InteractionResponseEnum)[keyof typeof InteractionResponseEnum];
|
|
110
114
|
/** Discord sticker format types. */
|
|
111
|
-
export declare const
|
|
115
|
+
export declare const StickerFormatEnum: {
|
|
112
116
|
readonly PNG: 1;
|
|
113
117
|
readonly APNG: 2;
|
|
114
118
|
readonly Lottie: 3;
|
|
115
119
|
readonly GIF: 4;
|
|
116
120
|
};
|
|
121
|
+
/** One {@link StickerFormatEnum} value, usable as a type. */
|
|
122
|
+
export type StickerFormatEnum = (typeof StickerFormatEnum)[keyof typeof StickerFormatEnum];
|
|
117
123
|
/** Discord sticker types. */
|
|
118
|
-
export declare const
|
|
124
|
+
export declare const StickerEnum: {
|
|
119
125
|
readonly Standard: 1;
|
|
120
126
|
readonly Guild: 2;
|
|
121
127
|
};
|
|
128
|
+
/** One {@link StickerEnum} value, usable as a type. */
|
|
129
|
+
export type StickerEnum = (typeof StickerEnum)[keyof typeof StickerEnum];
|
|
122
130
|
/** Discord verification levels. */
|
|
123
131
|
export declare const VerificationLevel: {
|
|
124
132
|
readonly None: 0;
|
|
@@ -242,6 +250,25 @@ export type APIMessageComponent = APIActionRowComponent | {
|
|
|
242
250
|
type: Exclude<number, 1>;
|
|
243
251
|
[key: string]: any;
|
|
244
252
|
};
|
|
253
|
+
/** A Discord payload, or a builder that serialises to one (its `toJSON()` runs when the request is sent). */
|
|
254
|
+
export type Buildable<T> = T | {
|
|
255
|
+
toJSON(): T;
|
|
256
|
+
};
|
|
257
|
+
/**
|
|
258
|
+
* A message Lunibee sends: channel send and edit, message reply and edit,
|
|
259
|
+
* interaction replies, follow-ups and updates. Embeds and components may be
|
|
260
|
+
* builders or raw objects. Other Discord fields pass through unchanged.
|
|
261
|
+
*/
|
|
262
|
+
export interface MessagePayload {
|
|
263
|
+
content?: string;
|
|
264
|
+
embeds?: Buildable<APIEmbed>[];
|
|
265
|
+
components?: Buildable<APIMessageComponent>[];
|
|
266
|
+
allowed_mentions?: import("./gateway.js").AllowedMentions;
|
|
267
|
+
/** Discord message flags, e.g. `MessageFlags.SuppressEmbeds`. */
|
|
268
|
+
flags?: number;
|
|
269
|
+
tts?: boolean;
|
|
270
|
+
[key: string]: unknown;
|
|
271
|
+
}
|
|
245
272
|
/** Raw Discord attachment object. */
|
|
246
273
|
export interface APIAttachment {
|
|
247
274
|
id: Snowflake;
|
|
@@ -295,6 +322,35 @@ export interface APIMessageReaction {
|
|
|
295
322
|
emoji: APIPartialEmoji;
|
|
296
323
|
burst_colors?: string[];
|
|
297
324
|
}
|
|
325
|
+
/** Raw Discord poll object. */
|
|
326
|
+
export interface APIPoll {
|
|
327
|
+
question: {
|
|
328
|
+
text?: string;
|
|
329
|
+
emoji?: APIPartialEmoji;
|
|
330
|
+
};
|
|
331
|
+
answers: Array<{
|
|
332
|
+
answer_id: number;
|
|
333
|
+
poll_media: {
|
|
334
|
+
text?: string;
|
|
335
|
+
emoji?: APIPartialEmoji;
|
|
336
|
+
};
|
|
337
|
+
}>;
|
|
338
|
+
expiry: string | null;
|
|
339
|
+
allow_multiselect: boolean;
|
|
340
|
+
layout_type: number;
|
|
341
|
+
results?: {
|
|
342
|
+
is_finalized: boolean;
|
|
343
|
+
answer_counts: Array<{
|
|
344
|
+
id: number;
|
|
345
|
+
count: number;
|
|
346
|
+
me_voted: boolean;
|
|
347
|
+
}>;
|
|
348
|
+
};
|
|
349
|
+
}
|
|
350
|
+
/** A forwarded message's snapshot of the original. */
|
|
351
|
+
export interface APIMessageSnapshot {
|
|
352
|
+
message: Partial<Pick<APIMessage, "type" | "content" | "embeds" | "attachments" | "timestamp" | "edited_timestamp" | "flags" | "mentions" | "mention_roles" | "sticker_items" | "components">>;
|
|
353
|
+
}
|
|
298
354
|
/** Raw Discord message object. */
|
|
299
355
|
export interface APIMessage {
|
|
300
356
|
id: Snowflake;
|
|
@@ -329,7 +385,9 @@ export interface APIMessage {
|
|
|
329
385
|
position?: number;
|
|
330
386
|
role_subscription_data?: Record<string, unknown>;
|
|
331
387
|
purchase_notification?: Record<string, unknown>;
|
|
332
|
-
poll?:
|
|
388
|
+
poll?: APIPoll;
|
|
389
|
+
/** Forwarded messages: a partial copy of the original (content, embeds, attachments, …). */
|
|
390
|
+
message_snapshots?: APIMessageSnapshot[];
|
|
333
391
|
guild_id?: Snowflake;
|
|
334
392
|
/** The author's guild member, on guild messages from the Gateway (without `user`; the author is the user). */
|
|
335
393
|
member?: Omit<APIGuildMember, "user"> & {
|
|
@@ -537,6 +595,17 @@ export interface APIVoiceServerUpdate {
|
|
|
537
595
|
endpoint?: string | null;
|
|
538
596
|
}
|
|
539
597
|
/** Raw Discord activity object. */
|
|
598
|
+
/** Discord activity types, for presences (`setPresence({ activities: [{ name, type: ActivityEnum.Watching }] })`). */
|
|
599
|
+
export declare const ActivityEnum: {
|
|
600
|
+
readonly Playing: 0;
|
|
601
|
+
readonly Streaming: 1;
|
|
602
|
+
readonly Listening: 2;
|
|
603
|
+
readonly Watching: 3;
|
|
604
|
+
readonly Custom: 4;
|
|
605
|
+
readonly Competing: 5;
|
|
606
|
+
};
|
|
607
|
+
/** One {@link ActivityEnum} value, usable as a type. */
|
|
608
|
+
export type ActivityEnum = (typeof ActivityEnum)[keyof typeof ActivityEnum];
|
|
540
609
|
export interface APIActivity {
|
|
541
610
|
name: string;
|
|
542
611
|
type: number;
|
|
@@ -744,7 +813,7 @@ export interface APIStageInstance {
|
|
|
744
813
|
guild_scheduled_event_id?: Snowflake | null;
|
|
745
814
|
}
|
|
746
815
|
/** Discord application command option types. */
|
|
747
|
-
export declare const
|
|
816
|
+
export declare const ApplicationCommandOptionEnum: {
|
|
748
817
|
readonly SubCommand: 1;
|
|
749
818
|
readonly SubCommandGroup: 2;
|
|
750
819
|
readonly String: 3;
|
|
@@ -757,12 +826,16 @@ export declare const ApplicationCommandOptionType: {
|
|
|
757
826
|
readonly Number: 10;
|
|
758
827
|
readonly Attachment: 11;
|
|
759
828
|
};
|
|
829
|
+
/** One {@link ApplicationCommandOptionEnum} value, usable as a type. */
|
|
830
|
+
export type ApplicationCommandOptionEnum = (typeof ApplicationCommandOptionEnum)[keyof typeof ApplicationCommandOptionEnum];
|
|
760
831
|
/** Discord application command types. */
|
|
761
|
-
export declare const
|
|
832
|
+
export declare const ApplicationCommandEnum: {
|
|
762
833
|
readonly ChatInput: 1;
|
|
763
834
|
readonly User: 2;
|
|
764
835
|
readonly Message: 3;
|
|
765
836
|
};
|
|
837
|
+
/** One {@link ApplicationCommandEnum} value, usable as a type. */
|
|
838
|
+
export type ApplicationCommandEnum = (typeof ApplicationCommandEnum)[keyof typeof ApplicationCommandEnum];
|
|
766
839
|
/** Raw Discord application command option. */
|
|
767
840
|
export interface APIApplicationCommandOption {
|
|
768
841
|
type: number;
|
|
@@ -791,7 +864,10 @@ export interface APIApplicationCommand {
|
|
|
791
864
|
description: string;
|
|
792
865
|
options?: APIApplicationCommandOption[];
|
|
793
866
|
default_member_permissions?: string | null;
|
|
867
|
+
/** @deprecated Discord deprecated this field. Use `contexts`. Removed in 0.3.0. */
|
|
794
868
|
dm_permission?: boolean;
|
|
869
|
+
/** Where the command can be used: 0 guilds, 1 the bot's DMs, 2 other DMs. */
|
|
870
|
+
contexts?: number[];
|
|
795
871
|
nsfw?: boolean;
|
|
796
872
|
version: Snowflake;
|
|
797
873
|
}
|
|
@@ -802,7 +878,10 @@ export interface ApplicationCommandData {
|
|
|
802
878
|
type?: number;
|
|
803
879
|
options?: APIApplicationCommandOption[];
|
|
804
880
|
default_member_permissions?: string | null;
|
|
881
|
+
/** @deprecated Discord deprecated this field. Use `contexts`. Removed in 0.3.0. */
|
|
805
882
|
dm_permission?: boolean;
|
|
883
|
+
/** Where the command can be used: 0 guilds, 1 the bot's DMs, 2 other DMs. */
|
|
884
|
+
contexts?: number[];
|
|
806
885
|
nsfw?: boolean;
|
|
807
886
|
}
|
|
808
887
|
/** A channel permission overwrite for a role (type 0) or member (type 1). */
|
|
@@ -859,3 +938,112 @@ export interface APISubscription {
|
|
|
859
938
|
canceled_at: string | null;
|
|
860
939
|
country?: string;
|
|
861
940
|
}
|
|
941
|
+
/** @deprecated Use {@link ButtonType}. Removed in 0.3.0. */
|
|
942
|
+
export declare const ButtonStyle: {
|
|
943
|
+
readonly Primary: 1;
|
|
944
|
+
readonly Secondary: 2;
|
|
945
|
+
readonly Success: 3;
|
|
946
|
+
readonly Danger: 4;
|
|
947
|
+
readonly Link: 5;
|
|
948
|
+
readonly Premium: 6;
|
|
949
|
+
};
|
|
950
|
+
/** @deprecated Use {@link ButtonType}. Removed in 0.3.0. */
|
|
951
|
+
export type ButtonStyle = ButtonType;
|
|
952
|
+
/** @deprecated Use {@link TextInputType}. Removed in 0.3.0. */
|
|
953
|
+
export declare const TextInputStyle: {
|
|
954
|
+
readonly Short: 1;
|
|
955
|
+
readonly Paragraph: 2;
|
|
956
|
+
};
|
|
957
|
+
/** @deprecated Use {@link TextInputType}. Removed in 0.3.0. */
|
|
958
|
+
export type TextInputStyle = TextInputType;
|
|
959
|
+
/** @deprecated Use {@link ChannelEnum}. Removed in 0.3.0. */
|
|
960
|
+
export declare const ChannelType: {
|
|
961
|
+
readonly GuildText: 0;
|
|
962
|
+
readonly DM: 1;
|
|
963
|
+
readonly GuildVoice: 2;
|
|
964
|
+
readonly GroupDM: 3;
|
|
965
|
+
readonly GuildCategory: 4;
|
|
966
|
+
readonly GuildAnnouncement: 5;
|
|
967
|
+
readonly AnnouncementThread: 10;
|
|
968
|
+
readonly PublicThread: 11;
|
|
969
|
+
readonly PrivateThread: 12;
|
|
970
|
+
readonly GuildStageVoice: 13;
|
|
971
|
+
readonly GuildDirectory: 14;
|
|
972
|
+
readonly GuildForum: 15;
|
|
973
|
+
readonly GuildMedia: 16;
|
|
974
|
+
};
|
|
975
|
+
/** @deprecated Use {@link ChannelEnum}. Removed in 0.3.0. */
|
|
976
|
+
export type ChannelType = ChannelEnum;
|
|
977
|
+
/** @deprecated Use {@link ComponentEnum}. Removed in 0.3.0. */
|
|
978
|
+
export declare const ComponentType: {
|
|
979
|
+
readonly ActionRow: 1;
|
|
980
|
+
readonly Button: 2;
|
|
981
|
+
readonly StringSelect: 3;
|
|
982
|
+
readonly TextInput: 4;
|
|
983
|
+
readonly UserSelect: 5;
|
|
984
|
+
readonly RoleSelect: 6;
|
|
985
|
+
readonly MentionableSelect: 7;
|
|
986
|
+
readonly ChannelSelect: 8;
|
|
987
|
+
readonly Section: 9;
|
|
988
|
+
readonly TextDisplay: 10;
|
|
989
|
+
readonly Thumbnail: 11;
|
|
990
|
+
readonly MediaGallery: 12;
|
|
991
|
+
readonly File: 13;
|
|
992
|
+
readonly Separator: 14;
|
|
993
|
+
readonly ContentInventoryEntry: 16;
|
|
994
|
+
readonly Container: 17;
|
|
995
|
+
};
|
|
996
|
+
/** @deprecated Use {@link ComponentEnum}. Removed in 0.3.0. */
|
|
997
|
+
export type ComponentType = ComponentEnum;
|
|
998
|
+
/** @deprecated Use {@link InteractionResponseEnum}. Removed in 0.3.0. */
|
|
999
|
+
export declare const InteractionResponseType: {
|
|
1000
|
+
readonly Pong: 1;
|
|
1001
|
+
readonly ChannelMessage: 4;
|
|
1002
|
+
readonly DeferredChannelMessage: 5;
|
|
1003
|
+
readonly DeferredMessageUpdate: 6;
|
|
1004
|
+
readonly MessageUpdate: 7;
|
|
1005
|
+
readonly Autocomplete: 8;
|
|
1006
|
+
readonly Modal: 9;
|
|
1007
|
+
};
|
|
1008
|
+
/** @deprecated Use {@link InteractionResponseEnum}. Removed in 0.3.0. */
|
|
1009
|
+
export type InteractionResponseType = InteractionResponseEnum;
|
|
1010
|
+
/** @deprecated Use {@link ApplicationCommandEnum}. Removed in 0.3.0. */
|
|
1011
|
+
export declare const ApplicationCommandType: {
|
|
1012
|
+
readonly ChatInput: 1;
|
|
1013
|
+
readonly User: 2;
|
|
1014
|
+
readonly Message: 3;
|
|
1015
|
+
};
|
|
1016
|
+
/** @deprecated Use {@link ApplicationCommandEnum}. Removed in 0.3.0. */
|
|
1017
|
+
export type ApplicationCommandType = ApplicationCommandEnum;
|
|
1018
|
+
/** @deprecated Use {@link ApplicationCommandOptionEnum}. Removed in 0.3.0. */
|
|
1019
|
+
export declare const ApplicationCommandOptionType: {
|
|
1020
|
+
readonly SubCommand: 1;
|
|
1021
|
+
readonly SubCommandGroup: 2;
|
|
1022
|
+
readonly String: 3;
|
|
1023
|
+
readonly Integer: 4;
|
|
1024
|
+
readonly Boolean: 5;
|
|
1025
|
+
readonly User: 6;
|
|
1026
|
+
readonly Channel: 7;
|
|
1027
|
+
readonly Role: 8;
|
|
1028
|
+
readonly Mentionable: 9;
|
|
1029
|
+
readonly Number: 10;
|
|
1030
|
+
readonly Attachment: 11;
|
|
1031
|
+
};
|
|
1032
|
+
/** @deprecated Use {@link ApplicationCommandOptionEnum}. Removed in 0.3.0. */
|
|
1033
|
+
export type ApplicationCommandOptionType = ApplicationCommandOptionEnum;
|
|
1034
|
+
/** @deprecated Use {@link StickerEnum}. Removed in 0.3.0. */
|
|
1035
|
+
export declare const StickerType: {
|
|
1036
|
+
readonly Standard: 1;
|
|
1037
|
+
readonly Guild: 2;
|
|
1038
|
+
};
|
|
1039
|
+
/** @deprecated Use {@link StickerEnum}. Removed in 0.3.0. */
|
|
1040
|
+
export type StickerType = StickerEnum;
|
|
1041
|
+
/** @deprecated Use {@link StickerFormatEnum}. Removed in 0.3.0. */
|
|
1042
|
+
export declare const StickerFormatType: {
|
|
1043
|
+
readonly PNG: 1;
|
|
1044
|
+
readonly APNG: 2;
|
|
1045
|
+
readonly Lottie: 3;
|
|
1046
|
+
readonly GIF: 4;
|
|
1047
|
+
};
|
|
1048
|
+
/** @deprecated Use {@link StickerFormatEnum}. Removed in 0.3.0. */
|
|
1049
|
+
export type StickerFormatType = StickerFormatEnum;
|
package/dist/types/index.js
CHANGED
|
@@ -126,7 +126,7 @@ var MessageFlags = {
|
|
|
126
126
|
Loading: 128,
|
|
127
127
|
IsComponentsV2: 32768
|
|
128
128
|
};
|
|
129
|
-
var
|
|
129
|
+
var ChannelEnum = {
|
|
130
130
|
GuildText: 0,
|
|
131
131
|
DM: 1,
|
|
132
132
|
GuildVoice: 2,
|
|
@@ -141,7 +141,7 @@ var ChannelType = {
|
|
|
141
141
|
GuildForum: 15,
|
|
142
142
|
GuildMedia: 16
|
|
143
143
|
};
|
|
144
|
-
var
|
|
144
|
+
var ComponentEnum = {
|
|
145
145
|
ActionRow: 1,
|
|
146
146
|
Button: 2,
|
|
147
147
|
StringSelect: 3,
|
|
@@ -159,7 +159,7 @@ var ComponentType = {
|
|
|
159
159
|
ContentInventoryEntry: 16,
|
|
160
160
|
Container: 17
|
|
161
161
|
};
|
|
162
|
-
var
|
|
162
|
+
var ButtonType = {
|
|
163
163
|
Primary: 1,
|
|
164
164
|
Secondary: 2,
|
|
165
165
|
Success: 3,
|
|
@@ -167,11 +167,11 @@ var ButtonStyle = {
|
|
|
167
167
|
Link: 5,
|
|
168
168
|
Premium: 6
|
|
169
169
|
};
|
|
170
|
-
var
|
|
170
|
+
var TextInputType = {
|
|
171
171
|
Short: 1,
|
|
172
172
|
Paragraph: 2
|
|
173
173
|
};
|
|
174
|
-
var
|
|
174
|
+
var InteractionResponseEnum = {
|
|
175
175
|
Pong: 1,
|
|
176
176
|
ChannelMessage: 4,
|
|
177
177
|
DeferredChannelMessage: 5,
|
|
@@ -180,13 +180,13 @@ var InteractionResponseType = {
|
|
|
180
180
|
Autocomplete: 8,
|
|
181
181
|
Modal: 9
|
|
182
182
|
};
|
|
183
|
-
var
|
|
183
|
+
var StickerFormatEnum = {
|
|
184
184
|
PNG: 1,
|
|
185
185
|
APNG: 2,
|
|
186
186
|
Lottie: 3,
|
|
187
187
|
GIF: 4
|
|
188
188
|
};
|
|
189
|
-
var
|
|
189
|
+
var StickerEnum = {
|
|
190
190
|
Standard: 1,
|
|
191
191
|
Guild: 2
|
|
192
192
|
};
|
|
@@ -203,7 +203,15 @@ var PremiumTier = {
|
|
|
203
203
|
Tier2: 2,
|
|
204
204
|
Tier3: 3
|
|
205
205
|
};
|
|
206
|
-
var
|
|
206
|
+
var ActivityEnum = {
|
|
207
|
+
Playing: 0,
|
|
208
|
+
Streaming: 1,
|
|
209
|
+
Listening: 2,
|
|
210
|
+
Watching: 3,
|
|
211
|
+
Custom: 4,
|
|
212
|
+
Competing: 5
|
|
213
|
+
};
|
|
214
|
+
var ApplicationCommandOptionEnum = {
|
|
207
215
|
SubCommand: 1,
|
|
208
216
|
SubCommandGroup: 2,
|
|
209
217
|
String: 3,
|
|
@@ -216,29 +224,48 @@ var ApplicationCommandOptionType = {
|
|
|
216
224
|
Number: 10,
|
|
217
225
|
Attachment: 11
|
|
218
226
|
};
|
|
219
|
-
var
|
|
227
|
+
var ApplicationCommandEnum = {
|
|
220
228
|
ChatInput: 1,
|
|
221
229
|
User: 2,
|
|
222
230
|
Message: 3
|
|
223
231
|
};
|
|
232
|
+
var ButtonStyle = ButtonType;
|
|
233
|
+
var TextInputStyle = TextInputType;
|
|
234
|
+
var ChannelType = ChannelEnum;
|
|
235
|
+
var ComponentType = ComponentEnum;
|
|
236
|
+
var InteractionResponseType = InteractionResponseEnum;
|
|
237
|
+
var ApplicationCommandType = ApplicationCommandEnum;
|
|
238
|
+
var ApplicationCommandOptionType = ApplicationCommandOptionEnum;
|
|
239
|
+
var StickerType = StickerEnum;
|
|
240
|
+
var StickerFormatType = StickerFormatEnum;
|
|
224
241
|
export {
|
|
242
|
+
ActivityEnum,
|
|
243
|
+
ApplicationCommandEnum,
|
|
244
|
+
ApplicationCommandOptionEnum,
|
|
225
245
|
ApplicationCommandOptionType,
|
|
226
246
|
ApplicationCommandType,
|
|
227
247
|
ButtonStyle,
|
|
248
|
+
ButtonType,
|
|
249
|
+
ChannelEnum,
|
|
228
250
|
ChannelType,
|
|
251
|
+
ComponentEnum,
|
|
229
252
|
ComponentType,
|
|
230
253
|
GatewayIntentBits,
|
|
231
254
|
IntentBits,
|
|
232
255
|
Intents,
|
|
233
256
|
IntentsBitField,
|
|
257
|
+
InteractionResponseEnum,
|
|
234
258
|
InteractionResponseType,
|
|
235
259
|
MessageFlags,
|
|
236
260
|
PremiumTier,
|
|
261
|
+
StickerEnum,
|
|
262
|
+
StickerFormatEnum,
|
|
237
263
|
StickerFormatType,
|
|
238
264
|
StickerType,
|
|
239
265
|
TextInputStyle,
|
|
266
|
+
TextInputType,
|
|
240
267
|
VerificationLevel,
|
|
241
268
|
resolveGatewayIntents
|
|
242
269
|
};
|
|
243
270
|
|
|
244
|
-
//# debugId=
|
|
271
|
+
//# debugId=40CBDDAEDFA8DAF664756E2164756E21
|