lunibee 0.2.0 → 0.2.2
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 +131 -45
- package/dist/builders/components.d.ts +183 -41
- package/dist/builders/embed.d.ts +12 -8
- package/dist/builders/index.d.ts +9 -4
- package/dist/builders/index.js +234 -110
- package/dist/builders/index.js.map +8 -8
- package/dist/core/events.d.ts +28 -12
- package/dist/core/index.d.ts +5 -3
- package/dist/core/index.js +414 -78
- package/dist/core/index.js.map +18 -18
- package/dist/core/permissions.d.ts +6 -2
- package/dist/index.d.ts +5 -4
- package/dist/index.js +869 -194
- package/dist/index.js.map +25 -24
- package/dist/managers/guild-resources.d.ts +22 -2
- package/dist/managers/guild.d.ts +3 -1
- package/dist/managers/index.d.ts +7 -3
- package/dist/managers/index.js +167 -33
- package/dist/managers/index.js.map +13 -13
- package/dist/managers/member.d.ts +13 -12
- package/dist/managers/message.d.ts +16 -4
- package/dist/rest/index.js +2 -2
- package/dist/rest/index.js.map +1 -1
- package/dist/sharding/index.js +3 -2
- package/dist/sharding/index.js.map +4 -4
- package/dist/structures/base.d.ts +36 -0
- package/dist/structures/index.d.ts +38 -3
- package/dist/structures/index.js +240 -34
- package/dist/structures/index.js.map +11 -11
- package/dist/structures/interactions.d.ts +110 -12
- package/dist/structures/options.d.ts +2 -0
- package/dist/structures/resources.d.ts +40 -4
- package/dist/types/gateway.d.ts +14 -0
- package/dist/types/index.d.ts +185 -10
- package/dist/types/index.js +37 -10
- package/dist/types/index.js.map +4 -4
- package/dist/utils/args.d.ts +79 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +190 -2
- package/dist/utils/index.js.map +5 -4
- package/dist/ws/index.js +2 -1
- package/dist/ws/index.js.map +4 -4
- package/package.json +14 -14
|
@@ -1,14 +1,17 @@
|
|
|
1
|
-
import { User } from "./base.js";
|
|
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. */
|
|
@@ -38,6 +42,8 @@ export interface InteractionClient {
|
|
|
38
42
|
/** Sends a follow-up interaction webhook message. @param token Interaction token. @param data Message payload. @returns Discord response. @throws {Error} When REST fails. */ followUpInteraction(token: string, data: InteractionReplyOptions): Promise<unknown>;
|
|
39
43
|
/** 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}. */
|
|
40
44
|
interactionWebhookMessage?(method: "GET" | "PATCH" | "DELETE", applicationId: string, token: string, messageId: string, data?: InteractionReplyOptions): Promise<unknown>;
|
|
45
|
+
/** Lets structures built from an interaction (such as {@link Interaction.member}) act through the client. Optional. */
|
|
46
|
+
readonly resourceContext?: ResourceContext;
|
|
41
47
|
}
|
|
42
48
|
export { CommandOptions, type APIInteractionDataOption } from "./options.js";
|
|
43
49
|
import { CommandOptions } from "./options.js";
|
|
@@ -45,6 +51,8 @@ import { CommandOptions } from "./options.js";
|
|
|
45
51
|
export declare class InteractionResponse {
|
|
46
52
|
readonly type: number;
|
|
47
53
|
readonly data?: InteractionReplyOptions;
|
|
54
|
+
/** Ask Discord to return the created message (`?with_response=true`); not part of the body. */
|
|
55
|
+
withResponse: boolean;
|
|
48
56
|
/** Creates a response payload. @param type Discord callback type. @param data Optional callback data. @throws {TypeError} If type is not finite. */
|
|
49
57
|
constructor(type: number, data?: InteractionReplyOptions);
|
|
50
58
|
/** Serializes the response for Discord. @returns Discord callback payload. */ toJSON(): {
|
|
@@ -68,7 +76,33 @@ export declare class Interaction<TData extends InteractionData = InteractionData
|
|
|
68
76
|
/** Whether the initial response was sent. */ replied: boolean;
|
|
69
77
|
/** Whether the initial response was deferred. */ deferred: boolean;
|
|
70
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);
|
|
71
|
-
/** 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;
|
|
94
|
+
/**
|
|
95
|
+
* Waits for this user to submit a modal, typically one this interaction
|
|
96
|
+
* just opened with {@link showModal}.
|
|
97
|
+
* @param options `time` (required, ms); optional `customId` and `filter`.
|
|
98
|
+
* @returns The submission. @throws {Error} When time runs out first or no client is attached.
|
|
99
|
+
* @example const submitted = await interaction.awaitModalSubmit({ time: 60_000, customId: "feedback" });
|
|
100
|
+
*/
|
|
101
|
+
awaitModalSubmit(options: {
|
|
102
|
+
time: number;
|
|
103
|
+
customId?: string;
|
|
104
|
+
filter?: (interaction: ModalSubmitInteraction) => boolean | Promise<boolean>;
|
|
105
|
+
}): Promise<ModalSubmitInteraction>;
|
|
72
106
|
/** Whether this interaction is a message component. @returns True for component interactions. */ isMessageComponent(): this is ComponentInteraction;
|
|
73
107
|
/** Whether this interaction is a modal submission. @returns True for modal submissions. */ isModalSubmit(): this is ModalSubmitInteraction;
|
|
74
108
|
/** Whether this interaction is autocomplete. @returns True for autocomplete interactions. */ isAutocomplete(): this is AutocompleteInteraction;
|
|
@@ -105,18 +139,55 @@ export declare class Interaction<TData extends InteractionData = InteractionData
|
|
|
105
139
|
/** Ensures the interaction has been acknowledged. @returns Nothing. @throws {Error} When not acknowledged. */ protected assertAcknowledged(): void;
|
|
106
140
|
/** Posts a raw interaction response callback. */
|
|
107
141
|
protected postResponse(response: InteractionResponse): Promise<unknown>;
|
|
108
|
-
/**
|
|
109
|
-
|
|
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: {
|
|
162
|
+
ephemeral?: boolean;
|
|
163
|
+
withResponse: true;
|
|
164
|
+
}): Promise<Message | null>;
|
|
165
|
+
deferReply(options?: boolean | {
|
|
166
|
+
ephemeral?: boolean;
|
|
167
|
+
withResponse?: boolean;
|
|
168
|
+
}): Promise<void>;
|
|
110
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>;
|
|
111
170
|
/** Deletes the original response. @returns Promise fulfilled after deletion. @throws {Error} When not acknowledged or REST fails. */ deleteReply(): Promise<void>;
|
|
112
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>;
|
|
113
|
-
/**
|
|
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>;
|
|
114
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. */
|
|
115
181
|
showModal(modal: {
|
|
182
|
+
toJSON(): {
|
|
183
|
+
custom_id: string;
|
|
184
|
+
title: string;
|
|
185
|
+
components: unknown[];
|
|
186
|
+
};
|
|
187
|
+
} | {
|
|
116
188
|
custom_id: string;
|
|
117
189
|
title: string;
|
|
118
|
-
components: unknown[];
|
|
119
|
-
[key: string]: unknown;
|
|
190
|
+
components: readonly unknown[];
|
|
120
191
|
}): Promise<unknown>;
|
|
121
192
|
}
|
|
122
193
|
/** Application command interaction with fully typed option resolver. */
|
|
@@ -126,18 +197,35 @@ export declare class CommandInteraction extends Interaction {
|
|
|
126
197
|
/** Invoked command name. @returns Command name or an empty string. */ get commandName(): string;
|
|
127
198
|
constructor(client: InteractionClient, data: InteractionData);
|
|
128
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
|
+
}
|
|
129
212
|
/** Message component interaction. */
|
|
130
213
|
export declare class ComponentInteraction extends Interaction {
|
|
131
214
|
/** Gets component custom ID. */
|
|
132
215
|
get customId(): string;
|
|
216
|
+
/** ID of the message the component is on. */
|
|
217
|
+
get messageId(): string | undefined;
|
|
133
218
|
/** Gets component type. */
|
|
134
219
|
get componentType(): number;
|
|
135
220
|
/** Gets selected values for select menu component interactions. */
|
|
136
221
|
get values(): string[];
|
|
137
222
|
/** Defers updating the message to which the component was attached. */
|
|
138
|
-
deferUpdate(
|
|
139
|
-
|
|
140
|
-
|
|
223
|
+
deferUpdate(options: {
|
|
224
|
+
withResponse: true;
|
|
225
|
+
}): Promise<Message | null>;
|
|
226
|
+
deferUpdate(options?: {
|
|
227
|
+
withResponse?: boolean;
|
|
228
|
+
}): Promise<void>;
|
|
141
229
|
}
|
|
142
230
|
/** Represents a Discord modal submission interaction. */
|
|
143
231
|
export declare class ModalSubmitInteraction extends Interaction {
|
|
@@ -175,3 +263,13 @@ export declare class AutocompleteInteraction extends Interaction {
|
|
|
175
263
|
* @throws {TypeError} If required identifiers are missing.
|
|
176
264
|
*/
|
|
177
265
|
export declare function createInteraction(client: InteractionClient, data: InteractionData): Interaction;
|
|
266
|
+
/** @deprecated Use {@link InteractionEnum}. Removed in 2.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 2.0. */
|
|
275
|
+
export type InteractionType = InteractionEnum;
|
|
@@ -47,6 +47,8 @@ export declare class CommandOptions {
|
|
|
47
47
|
/** Gets the raw resolved user or role data for a mentionable option. @param name Option name. @param required If true, throws when missing. */
|
|
48
48
|
getMentionable(name: string, required?: false): Record<string, unknown> | null;
|
|
49
49
|
getMentionable(name: string, required: true): Record<string, unknown>;
|
|
50
|
+
/** Whether a mentionable option picked a user or a role; null when the option is missing. @param name Option name. */
|
|
51
|
+
getMentionableType(name: string): "user" | "role" | null;
|
|
50
52
|
/** Gets the raw resolved attachment data for an attachment option. @param name Option name. @param required If true, throws when missing. */
|
|
51
53
|
getAttachment(name: string, required?: false): Record<string, unknown> | null;
|
|
52
54
|
getAttachment(name: string, required: true): Record<string, unknown>;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { BaseStructure, Channel, User } from "./base.js";
|
|
2
2
|
import { PermissionsBitField } from "@lunibee/core";
|
|
3
|
-
import type { ImageURLOptions } from "./base.js";
|
|
3
|
+
import type { ImageURLOptions, ResourceContext } from "./base.js";
|
|
4
4
|
/** A Discord guild member. */
|
|
5
5
|
export declare class GuildMember {
|
|
6
|
+
#private;
|
|
6
7
|
/** User represented by the member. */ readonly user: User;
|
|
7
8
|
/** Guild containing the member. */ readonly guildId: string;
|
|
8
9
|
/** Nickname, if configured. */ nickname: string | null;
|
|
9
10
|
/** Role IDs assigned to the member. */ readonly roleIds: string[];
|
|
10
11
|
/** Whether the member is pending membership screening. */ pending: boolean;
|
|
11
12
|
/** Member join timestamp. */ joinedAt?: Date;
|
|
12
|
-
/** Raw effective permission bitfield supplied by Discord. */ readonly permissions: PermissionsBitField;
|
|
13
13
|
/** Member-specific avatar hash, if set. */ avatarHash: string | null;
|
|
14
14
|
/** When the member started boosting the guild. */ premiumSince: Date | null;
|
|
15
15
|
/** When the member's timeout expires (null if not timed out). */ timedOutUntil: Date | null;
|
|
@@ -36,7 +36,33 @@ export declare class GuildMember {
|
|
|
36
36
|
premium_since?: string | null;
|
|
37
37
|
communication_disabled_until?: string | null;
|
|
38
38
|
flags?: number;
|
|
39
|
-
});
|
|
39
|
+
}, context?: ResourceContext);
|
|
40
|
+
/**
|
|
41
|
+
* The member's permissions. Discord sends them with interactions (already
|
|
42
|
+
* resolved for the channel); anywhere else they are computed at guild
|
|
43
|
+
* level from the cached roles each time they are read, so they follow role
|
|
44
|
+
* changes. Empty when the guild's roles are not cached.
|
|
45
|
+
*/
|
|
46
|
+
get permissions(): PermissionsBitField;
|
|
47
|
+
/** The member's permissions in a channel, with its overwrites. Null when the channel or guild is not cached. @param channelId Channel ID. */
|
|
48
|
+
permissionsIn(channelId: string): PermissionsBitField | null;
|
|
49
|
+
/** Kicks this member. @param reason Audit-log reason. */
|
|
50
|
+
kick(reason?: string): Promise<void>;
|
|
51
|
+
/** Bans this member. @param options Audit-log reason and seconds of messages to delete. */
|
|
52
|
+
ban(options?: {
|
|
53
|
+
reason?: string;
|
|
54
|
+
deleteMessageSeconds?: number;
|
|
55
|
+
}): Promise<void>;
|
|
56
|
+
/** Edits this member (nickname, roles, voice state, timeout). @param options Discord member fields. @param reason Audit-log reason. */
|
|
57
|
+
edit(options: Record<string, unknown>, reason?: string): Promise<GuildMember>;
|
|
58
|
+
/** Times this member out, or clears the timeout with null. @param milliseconds Timeout length (Discord allows up to 28 days). @param reason Audit-log reason. */
|
|
59
|
+
timeout(milliseconds: number | null, reason?: string): Promise<GuildMember>;
|
|
60
|
+
/** Sets or clears (null) this member's nickname. @param nickname New nickname. @param reason Audit-log reason. */
|
|
61
|
+
setNickname(nickname: string | null, reason?: string): Promise<GuildMember>;
|
|
62
|
+
/** Gives this member a role. @param roleId Role ID. @param reason Audit-log reason. */
|
|
63
|
+
addRole(roleId: string, reason?: string): Promise<void>;
|
|
64
|
+
/** Takes a role from this member. @param roleId Role ID. @param reason Audit-log reason. */
|
|
65
|
+
removeRole(roleId: string, reason?: string): Promise<void>;
|
|
40
66
|
/** Effective member display name — nickname, falling back to user display name. */
|
|
41
67
|
get displayName(): string;
|
|
42
68
|
/** Whether this member is currently timed out. */
|
|
@@ -140,11 +166,13 @@ export declare class Invite {
|
|
|
140
166
|
toString(): string;
|
|
141
167
|
}
|
|
142
168
|
/** Webhook type constants. */
|
|
143
|
-
export declare const
|
|
169
|
+
export declare const WebhookEnum: {
|
|
144
170
|
readonly Incoming: 1;
|
|
145
171
|
readonly ChannelFollower: 2;
|
|
146
172
|
readonly Application: 3;
|
|
147
173
|
};
|
|
174
|
+
/** One {@link WebhookEnum} value, usable as a type. */
|
|
175
|
+
export type WebhookEnum = (typeof WebhookEnum)[keyof typeof WebhookEnum];
|
|
148
176
|
/** A Discord webhook — an HTTP endpoint that can post messages to a channel. */
|
|
149
177
|
export declare class Webhook extends BaseStructure {
|
|
150
178
|
/** Webhook type. */ readonly type: number;
|
|
@@ -254,3 +282,11 @@ export declare class GuildOnboarding extends BaseStructure {
|
|
|
254
282
|
mode: number;
|
|
255
283
|
constructor(data: import("@lunibee/types").APIGuildOnboarding);
|
|
256
284
|
}
|
|
285
|
+
/** @deprecated Use {@link WebhookEnum}. Removed in 2.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 2.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
|
@@ -40,8 +40,10 @@ export declare const MessageFlags: {
|
|
|
40
40
|
readonly Loading: 128;
|
|
41
41
|
readonly IsComponentsV2: 32768;
|
|
42
42
|
};
|
|
43
|
+
/** One {@link MessageFlags} value, usable as a type. */
|
|
44
|
+
export type MessageFlags = (typeof MessageFlags)[keyof typeof MessageFlags];
|
|
43
45
|
/** Discord channel types. */
|
|
44
|
-
export declare const
|
|
46
|
+
export declare const ChannelEnum: {
|
|
45
47
|
readonly GuildText: 0;
|
|
46
48
|
readonly DM: 1;
|
|
47
49
|
readonly GuildVoice: 2;
|
|
@@ -56,8 +58,10 @@ export declare const ChannelType: {
|
|
|
56
58
|
readonly GuildForum: 15;
|
|
57
59
|
readonly GuildMedia: 16;
|
|
58
60
|
};
|
|
61
|
+
/** One {@link ChannelEnum} value, usable as a type. */
|
|
62
|
+
export type ChannelEnum = (typeof ChannelEnum)[keyof typeof ChannelEnum];
|
|
59
63
|
/** Discord component types. */
|
|
60
|
-
export declare const
|
|
64
|
+
export declare const ComponentEnum: {
|
|
61
65
|
readonly ActionRow: 1;
|
|
62
66
|
readonly Button: 2;
|
|
63
67
|
readonly StringSelect: 3;
|
|
@@ -75,8 +79,10 @@ export declare const ComponentType: {
|
|
|
75
79
|
readonly ContentInventoryEntry: 16;
|
|
76
80
|
readonly Container: 17;
|
|
77
81
|
};
|
|
82
|
+
/** One {@link ComponentEnum} value, usable as a type. */
|
|
83
|
+
export type ComponentEnum = (typeof ComponentEnum)[keyof typeof ComponentEnum];
|
|
78
84
|
/** Discord button style types. */
|
|
79
|
-
export declare const
|
|
85
|
+
export declare const ButtonType: {
|
|
80
86
|
readonly Primary: 1;
|
|
81
87
|
readonly Secondary: 2;
|
|
82
88
|
readonly Success: 3;
|
|
@@ -84,13 +90,17 @@ export declare const ButtonStyle: {
|
|
|
84
90
|
readonly Link: 5;
|
|
85
91
|
readonly Premium: 6;
|
|
86
92
|
};
|
|
93
|
+
/** One {@link ButtonType} value, usable as a type: `style: ButtonType`. */
|
|
94
|
+
export type ButtonType = (typeof ButtonType)[keyof typeof ButtonType];
|
|
87
95
|
/** Discord text input style types. */
|
|
88
|
-
export declare const
|
|
96
|
+
export declare const TextInputType: {
|
|
89
97
|
readonly Short: 1;
|
|
90
98
|
readonly Paragraph: 2;
|
|
91
99
|
};
|
|
100
|
+
/** One {@link TextInputType} value, usable as a type. */
|
|
101
|
+
export type TextInputType = (typeof TextInputType)[keyof typeof TextInputType];
|
|
92
102
|
/** Discord interaction response types. */
|
|
93
|
-
export declare const
|
|
103
|
+
export declare const InteractionResponseEnum: {
|
|
94
104
|
readonly Pong: 1;
|
|
95
105
|
readonly ChannelMessage: 4;
|
|
96
106
|
readonly DeferredChannelMessage: 5;
|
|
@@ -99,18 +109,24 @@ export declare const InteractionResponseType: {
|
|
|
99
109
|
readonly Autocomplete: 8;
|
|
100
110
|
readonly Modal: 9;
|
|
101
111
|
};
|
|
112
|
+
/** One {@link InteractionResponseEnum} value, usable as a type. */
|
|
113
|
+
export type InteractionResponseEnum = (typeof InteractionResponseEnum)[keyof typeof InteractionResponseEnum];
|
|
102
114
|
/** Discord sticker format types. */
|
|
103
|
-
export declare const
|
|
115
|
+
export declare const StickerFormatEnum: {
|
|
104
116
|
readonly PNG: 1;
|
|
105
117
|
readonly APNG: 2;
|
|
106
118
|
readonly Lottie: 3;
|
|
107
119
|
readonly GIF: 4;
|
|
108
120
|
};
|
|
121
|
+
/** One {@link StickerFormatEnum} value, usable as a type. */
|
|
122
|
+
export type StickerFormatEnum = (typeof StickerFormatEnum)[keyof typeof StickerFormatEnum];
|
|
109
123
|
/** Discord sticker types. */
|
|
110
|
-
export declare const
|
|
124
|
+
export declare const StickerEnum: {
|
|
111
125
|
readonly Standard: 1;
|
|
112
126
|
readonly Guild: 2;
|
|
113
127
|
};
|
|
128
|
+
/** One {@link StickerEnum} value, usable as a type. */
|
|
129
|
+
export type StickerEnum = (typeof StickerEnum)[keyof typeof StickerEnum];
|
|
114
130
|
/** Discord verification levels. */
|
|
115
131
|
export declare const VerificationLevel: {
|
|
116
132
|
readonly None: 0;
|
|
@@ -287,6 +303,35 @@ export interface APIMessageReaction {
|
|
|
287
303
|
emoji: APIPartialEmoji;
|
|
288
304
|
burst_colors?: string[];
|
|
289
305
|
}
|
|
306
|
+
/** Raw Discord poll object. */
|
|
307
|
+
export interface APIPoll {
|
|
308
|
+
question: {
|
|
309
|
+
text?: string;
|
|
310
|
+
emoji?: APIPartialEmoji;
|
|
311
|
+
};
|
|
312
|
+
answers: Array<{
|
|
313
|
+
answer_id: number;
|
|
314
|
+
poll_media: {
|
|
315
|
+
text?: string;
|
|
316
|
+
emoji?: APIPartialEmoji;
|
|
317
|
+
};
|
|
318
|
+
}>;
|
|
319
|
+
expiry: string | null;
|
|
320
|
+
allow_multiselect: boolean;
|
|
321
|
+
layout_type: number;
|
|
322
|
+
results?: {
|
|
323
|
+
is_finalized: boolean;
|
|
324
|
+
answer_counts: Array<{
|
|
325
|
+
id: number;
|
|
326
|
+
count: number;
|
|
327
|
+
me_voted: boolean;
|
|
328
|
+
}>;
|
|
329
|
+
};
|
|
330
|
+
}
|
|
331
|
+
/** A forwarded message's snapshot of the original. */
|
|
332
|
+
export interface APIMessageSnapshot {
|
|
333
|
+
message: Partial<Pick<APIMessage, "type" | "content" | "embeds" | "attachments" | "timestamp" | "edited_timestamp" | "flags" | "mentions" | "mention_roles" | "sticker_items" | "components">>;
|
|
334
|
+
}
|
|
290
335
|
/** Raw Discord message object. */
|
|
291
336
|
export interface APIMessage {
|
|
292
337
|
id: Snowflake;
|
|
@@ -321,8 +366,14 @@ export interface APIMessage {
|
|
|
321
366
|
position?: number;
|
|
322
367
|
role_subscription_data?: Record<string, unknown>;
|
|
323
368
|
purchase_notification?: Record<string, unknown>;
|
|
324
|
-
poll?:
|
|
369
|
+
poll?: APIPoll;
|
|
370
|
+
/** Forwarded messages: a partial copy of the original (content, embeds, attachments, …). */
|
|
371
|
+
message_snapshots?: APIMessageSnapshot[];
|
|
325
372
|
guild_id?: Snowflake;
|
|
373
|
+
/** The author's guild member, on guild messages from the Gateway (without `user`; the author is the user). */
|
|
374
|
+
member?: Omit<APIGuildMember, "user"> & {
|
|
375
|
+
user?: UserData;
|
|
376
|
+
};
|
|
326
377
|
}
|
|
327
378
|
/** Raw Discord channel object. */
|
|
328
379
|
export interface APIChannel {
|
|
@@ -525,6 +576,17 @@ export interface APIVoiceServerUpdate {
|
|
|
525
576
|
endpoint?: string | null;
|
|
526
577
|
}
|
|
527
578
|
/** Raw Discord activity object. */
|
|
579
|
+
/** Discord activity types, for presences (`setPresence({ activities: [{ name, type: ActivityEnum.Watching }] })`). */
|
|
580
|
+
export declare const ActivityEnum: {
|
|
581
|
+
readonly Playing: 0;
|
|
582
|
+
readonly Streaming: 1;
|
|
583
|
+
readonly Listening: 2;
|
|
584
|
+
readonly Watching: 3;
|
|
585
|
+
readonly Custom: 4;
|
|
586
|
+
readonly Competing: 5;
|
|
587
|
+
};
|
|
588
|
+
/** One {@link ActivityEnum} value, usable as a type. */
|
|
589
|
+
export type ActivityEnum = (typeof ActivityEnum)[keyof typeof ActivityEnum];
|
|
528
590
|
export interface APIActivity {
|
|
529
591
|
name: string;
|
|
530
592
|
type: number;
|
|
@@ -732,7 +794,7 @@ export interface APIStageInstance {
|
|
|
732
794
|
guild_scheduled_event_id?: Snowflake | null;
|
|
733
795
|
}
|
|
734
796
|
/** Discord application command option types. */
|
|
735
|
-
export declare const
|
|
797
|
+
export declare const ApplicationCommandOptionEnum: {
|
|
736
798
|
readonly SubCommand: 1;
|
|
737
799
|
readonly SubCommandGroup: 2;
|
|
738
800
|
readonly String: 3;
|
|
@@ -745,12 +807,16 @@ export declare const ApplicationCommandOptionType: {
|
|
|
745
807
|
readonly Number: 10;
|
|
746
808
|
readonly Attachment: 11;
|
|
747
809
|
};
|
|
810
|
+
/** One {@link ApplicationCommandOptionEnum} value, usable as a type. */
|
|
811
|
+
export type ApplicationCommandOptionEnum = (typeof ApplicationCommandOptionEnum)[keyof typeof ApplicationCommandOptionEnum];
|
|
748
812
|
/** Discord application command types. */
|
|
749
|
-
export declare const
|
|
813
|
+
export declare const ApplicationCommandEnum: {
|
|
750
814
|
readonly ChatInput: 1;
|
|
751
815
|
readonly User: 2;
|
|
752
816
|
readonly Message: 3;
|
|
753
817
|
};
|
|
818
|
+
/** One {@link ApplicationCommandEnum} value, usable as a type. */
|
|
819
|
+
export type ApplicationCommandEnum = (typeof ApplicationCommandEnum)[keyof typeof ApplicationCommandEnum];
|
|
754
820
|
/** Raw Discord application command option. */
|
|
755
821
|
export interface APIApplicationCommandOption {
|
|
756
822
|
type: number;
|
|
@@ -847,3 +913,112 @@ export interface APISubscription {
|
|
|
847
913
|
canceled_at: string | null;
|
|
848
914
|
country?: string;
|
|
849
915
|
}
|
|
916
|
+
/** @deprecated Use {@link ButtonType}. Removed in 2.0. */
|
|
917
|
+
export declare const ButtonStyle: {
|
|
918
|
+
readonly Primary: 1;
|
|
919
|
+
readonly Secondary: 2;
|
|
920
|
+
readonly Success: 3;
|
|
921
|
+
readonly Danger: 4;
|
|
922
|
+
readonly Link: 5;
|
|
923
|
+
readonly Premium: 6;
|
|
924
|
+
};
|
|
925
|
+
/** @deprecated Use {@link ButtonType}. Removed in 2.0. */
|
|
926
|
+
export type ButtonStyle = ButtonType;
|
|
927
|
+
/** @deprecated Use {@link TextInputType}. Removed in 2.0. */
|
|
928
|
+
export declare const TextInputStyle: {
|
|
929
|
+
readonly Short: 1;
|
|
930
|
+
readonly Paragraph: 2;
|
|
931
|
+
};
|
|
932
|
+
/** @deprecated Use {@link TextInputType}. Removed in 2.0. */
|
|
933
|
+
export type TextInputStyle = TextInputType;
|
|
934
|
+
/** @deprecated Use {@link ChannelEnum}. Removed in 2.0. */
|
|
935
|
+
export declare const ChannelType: {
|
|
936
|
+
readonly GuildText: 0;
|
|
937
|
+
readonly DM: 1;
|
|
938
|
+
readonly GuildVoice: 2;
|
|
939
|
+
readonly GroupDM: 3;
|
|
940
|
+
readonly GuildCategory: 4;
|
|
941
|
+
readonly GuildAnnouncement: 5;
|
|
942
|
+
readonly AnnouncementThread: 10;
|
|
943
|
+
readonly PublicThread: 11;
|
|
944
|
+
readonly PrivateThread: 12;
|
|
945
|
+
readonly GuildStageVoice: 13;
|
|
946
|
+
readonly GuildDirectory: 14;
|
|
947
|
+
readonly GuildForum: 15;
|
|
948
|
+
readonly GuildMedia: 16;
|
|
949
|
+
};
|
|
950
|
+
/** @deprecated Use {@link ChannelEnum}. Removed in 2.0. */
|
|
951
|
+
export type ChannelType = ChannelEnum;
|
|
952
|
+
/** @deprecated Use {@link ComponentEnum}. Removed in 2.0. */
|
|
953
|
+
export declare const ComponentType: {
|
|
954
|
+
readonly ActionRow: 1;
|
|
955
|
+
readonly Button: 2;
|
|
956
|
+
readonly StringSelect: 3;
|
|
957
|
+
readonly TextInput: 4;
|
|
958
|
+
readonly UserSelect: 5;
|
|
959
|
+
readonly RoleSelect: 6;
|
|
960
|
+
readonly MentionableSelect: 7;
|
|
961
|
+
readonly ChannelSelect: 8;
|
|
962
|
+
readonly Section: 9;
|
|
963
|
+
readonly TextDisplay: 10;
|
|
964
|
+
readonly Thumbnail: 11;
|
|
965
|
+
readonly MediaGallery: 12;
|
|
966
|
+
readonly File: 13;
|
|
967
|
+
readonly Separator: 14;
|
|
968
|
+
readonly ContentInventoryEntry: 16;
|
|
969
|
+
readonly Container: 17;
|
|
970
|
+
};
|
|
971
|
+
/** @deprecated Use {@link ComponentEnum}. Removed in 2.0. */
|
|
972
|
+
export type ComponentType = ComponentEnum;
|
|
973
|
+
/** @deprecated Use {@link InteractionResponseEnum}. Removed in 2.0. */
|
|
974
|
+
export declare const InteractionResponseType: {
|
|
975
|
+
readonly Pong: 1;
|
|
976
|
+
readonly ChannelMessage: 4;
|
|
977
|
+
readonly DeferredChannelMessage: 5;
|
|
978
|
+
readonly DeferredMessageUpdate: 6;
|
|
979
|
+
readonly MessageUpdate: 7;
|
|
980
|
+
readonly Autocomplete: 8;
|
|
981
|
+
readonly Modal: 9;
|
|
982
|
+
};
|
|
983
|
+
/** @deprecated Use {@link InteractionResponseEnum}. Removed in 2.0. */
|
|
984
|
+
export type InteractionResponseType = InteractionResponseEnum;
|
|
985
|
+
/** @deprecated Use {@link ApplicationCommandEnum}. Removed in 2.0. */
|
|
986
|
+
export declare const ApplicationCommandType: {
|
|
987
|
+
readonly ChatInput: 1;
|
|
988
|
+
readonly User: 2;
|
|
989
|
+
readonly Message: 3;
|
|
990
|
+
};
|
|
991
|
+
/** @deprecated Use {@link ApplicationCommandEnum}. Removed in 2.0. */
|
|
992
|
+
export type ApplicationCommandType = ApplicationCommandEnum;
|
|
993
|
+
/** @deprecated Use {@link ApplicationCommandOptionEnum}. Removed in 2.0. */
|
|
994
|
+
export declare const ApplicationCommandOptionType: {
|
|
995
|
+
readonly SubCommand: 1;
|
|
996
|
+
readonly SubCommandGroup: 2;
|
|
997
|
+
readonly String: 3;
|
|
998
|
+
readonly Integer: 4;
|
|
999
|
+
readonly Boolean: 5;
|
|
1000
|
+
readonly User: 6;
|
|
1001
|
+
readonly Channel: 7;
|
|
1002
|
+
readonly Role: 8;
|
|
1003
|
+
readonly Mentionable: 9;
|
|
1004
|
+
readonly Number: 10;
|
|
1005
|
+
readonly Attachment: 11;
|
|
1006
|
+
};
|
|
1007
|
+
/** @deprecated Use {@link ApplicationCommandOptionEnum}. Removed in 2.0. */
|
|
1008
|
+
export type ApplicationCommandOptionType = ApplicationCommandOptionEnum;
|
|
1009
|
+
/** @deprecated Use {@link StickerEnum}. Removed in 2.0. */
|
|
1010
|
+
export declare const StickerType: {
|
|
1011
|
+
readonly Standard: 1;
|
|
1012
|
+
readonly Guild: 2;
|
|
1013
|
+
};
|
|
1014
|
+
/** @deprecated Use {@link StickerEnum}. Removed in 2.0. */
|
|
1015
|
+
export type StickerType = StickerEnum;
|
|
1016
|
+
/** @deprecated Use {@link StickerFormatEnum}. Removed in 2.0. */
|
|
1017
|
+
export declare const StickerFormatType: {
|
|
1018
|
+
readonly PNG: 1;
|
|
1019
|
+
readonly APNG: 2;
|
|
1020
|
+
readonly Lottie: 3;
|
|
1021
|
+
readonly GIF: 4;
|
|
1022
|
+
};
|
|
1023
|
+
/** @deprecated Use {@link StickerFormatEnum}. Removed in 2.0. */
|
|
1024
|
+
export type StickerFormatType = StickerFormatEnum;
|