seyfert 3.2.2 → 3.2.3-dev-15770378141.0
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/lib/commands/applications/entrycontext.d.ts +4 -3
- package/lib/commands/applications/entrycontext.js +4 -2
- package/lib/commands/applications/menucontext.d.ts +4 -3
- package/lib/commands/applications/menucontext.js +4 -2
- package/lib/common/types/write.d.ts +3 -0
- package/lib/components/componentcontext.d.ts +4 -2
- package/lib/components/componentcontext.js +4 -2
- package/lib/components/modalcontext.d.ts +4 -3
- package/lib/components/modalcontext.js +3 -3
- package/lib/structures/Interaction.d.ts +3 -2
- package/lib/structures/Interaction.js +24 -2
- package/package.json +2 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ReturnCache } from '../../cache';
|
|
2
2
|
import type { GuildMemberStructure, GuildStructure, InteractionGuildMemberStructure, UserStructure, WebhookMessageStructure } from '../../client/transformers';
|
|
3
|
-
import type { InteractionCreateBodyRequest, InteractionMessageUpdateBodyRequest, MakeRequired, MessageWebhookCreateBodyRequest, ModalCreateBodyRequest, UnionToTuple, When } from '../../common';
|
|
4
|
-
import type { AllChannels, EntryPointInteraction } from '../../structures';
|
|
3
|
+
import type { InteractionCreateBodyRequest, InteractionMessageUpdateBodyRequest, MakeRequired, MessageWebhookCreateBodyRequest, ModalCreateBodyRequest, ModalCreateOptions, UnionToTuple, When } from '../../common';
|
|
4
|
+
import type { AllChannels, EntryPointInteraction, ModalSubmitInteraction } from '../../structures';
|
|
5
5
|
import { type RESTGetAPIGuildQuery } from '../../types';
|
|
6
6
|
import { BaseContext } from '../basecontext';
|
|
7
7
|
import type { RegisteredMiddlewares } from '../decorators';
|
|
@@ -22,7 +22,8 @@ export declare class EntryPointContext<M extends keyof RegisteredMiddlewares = n
|
|
|
22
22
|
};
|
|
23
23
|
get fullCommandName(): string;
|
|
24
24
|
write<WR extends boolean = false>(body: InteractionCreateBodyRequest, withResponse?: WR): Promise<When<WR, WebhookMessageStructure, void>>;
|
|
25
|
-
modal(body: ModalCreateBodyRequest): Promise<undefined>;
|
|
25
|
+
modal(body: ModalCreateBodyRequest, options?: undefined): Promise<undefined>;
|
|
26
|
+
modal(body: ModalCreateBodyRequest, options: ModalCreateOptions): Promise<ModalSubmitInteraction | null>;
|
|
26
27
|
deferReply<WR extends boolean = false>(ephemeral?: boolean, withResponse?: WR): Promise<When<WR, WebhookMessageStructure, undefined>>;
|
|
27
28
|
editResponse(body: InteractionMessageUpdateBodyRequest): Promise<WebhookMessageStructure>;
|
|
28
29
|
deleteResponse(): Promise<void>;
|
|
@@ -26,8 +26,10 @@ class EntryPointContext extends basecontext_1.BaseContext {
|
|
|
26
26
|
write(body, withResponse) {
|
|
27
27
|
return this.interaction.write(body, withResponse);
|
|
28
28
|
}
|
|
29
|
-
modal(body) {
|
|
30
|
-
|
|
29
|
+
modal(body, options) {
|
|
30
|
+
if (options === undefined)
|
|
31
|
+
return this.interaction.modal(body);
|
|
32
|
+
return this.interaction.modal(body, options);
|
|
31
33
|
}
|
|
32
34
|
deferReply(ephemeral = false, withResponse) {
|
|
33
35
|
return this.interaction.deferReply(ephemeral ? types_1.MessageFlags.Ephemeral : undefined, withResponse);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ContextMenuCommand, InteractionGuildMemberStructure, ReturnCache } from '../..';
|
|
2
2
|
import { type GuildMemberStructure, type GuildStructure, type MessageStructure, type UserStructure, type WebhookMessageStructure } from '../../client/transformers';
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
3
|
+
import { InteractionCreateBodyRequest, InteractionMessageUpdateBodyRequest, MakeRequired, MessageWebhookCreateBodyRequest, ModalCreateBodyRequest, ModalCreateOptions, UnionToTuple, When } from '../../common';
|
|
4
|
+
import { AllChannels, MessageCommandInteraction, ModalSubmitInteraction, UserCommandInteraction } from '../../structures';
|
|
5
5
|
import { type RESTGetAPIGuildQuery } from '../../types';
|
|
6
6
|
import { BaseContext } from '../basecontext';
|
|
7
7
|
import type { RegisteredMiddlewares } from '../decorators';
|
|
@@ -23,7 +23,8 @@ export declare class MenuCommandContext<T extends MessageCommandInteraction | Us
|
|
|
23
23
|
};
|
|
24
24
|
get fullCommandName(): string;
|
|
25
25
|
write<WR extends boolean = false>(body: InteractionCreateBodyRequest, withResponse?: WR): Promise<When<WR, WebhookMessageStructure, void>>;
|
|
26
|
-
modal(body: ModalCreateBodyRequest): Promise<undefined>;
|
|
26
|
+
modal(body: ModalCreateBodyRequest, options?: undefined): Promise<undefined>;
|
|
27
|
+
modal(body: ModalCreateBodyRequest, options: ModalCreateOptions): Promise<ModalSubmitInteraction | null>;
|
|
27
28
|
deferReply<WR extends boolean = false>(ephemeral?: boolean, withResponse?: WR): Promise<When<WR, WebhookMessageStructure, undefined>>;
|
|
28
29
|
editResponse(body: InteractionMessageUpdateBodyRequest): Promise<WebhookMessageStructure>;
|
|
29
30
|
deleteResponse(): Promise<void>;
|
|
@@ -40,8 +40,10 @@ class MenuCommandContext extends basecontext_1.BaseContext {
|
|
|
40
40
|
write(body, withResponse) {
|
|
41
41
|
return this.interaction.write(body, withResponse);
|
|
42
42
|
}
|
|
43
|
-
modal(body) {
|
|
44
|
-
|
|
43
|
+
modal(body, options) {
|
|
44
|
+
if (options === undefined)
|
|
45
|
+
return this.interaction.modal(body);
|
|
46
|
+
return this.interaction.modal(body, options);
|
|
45
47
|
}
|
|
46
48
|
deferReply(ephemeral = false, withResponse) {
|
|
47
49
|
return this.interaction.deferReply(ephemeral ? types_1.MessageFlags.Ephemeral : undefined, withResponse);
|
|
@@ -20,3 +20,6 @@ export type InteractionMessageUpdateBodyRequest = OmitInsert<RESTPatchAPIWebhook
|
|
|
20
20
|
export type ComponentInteractionMessageUpdate = OmitInsert<APIInteractionResponseCallbackData, 'components' | 'embeds', ResolverProps>;
|
|
21
21
|
export type InteractionCreateBodyRequest = OmitInsert<APIInteractionResponseChannelMessageWithSource['data'], 'components' | 'embeds' | 'poll', SendResolverProps>;
|
|
22
22
|
export type ModalCreateBodyRequest = APIModalInteractionResponse['data'] | Modal;
|
|
23
|
+
export interface ModalCreateOptions {
|
|
24
|
+
waitFor?: number;
|
|
25
|
+
}
|
|
@@ -2,7 +2,8 @@ import type { AllChannels, ButtonInteraction, ChannelSelectMenuInteraction, Comp
|
|
|
2
2
|
import type { GuildMemberStructure, GuildStructure, InteractionGuildMemberStructure, UserStructure, WebhookMessageStructure } from '../client/transformers';
|
|
3
3
|
import type { CommandMetadata, ExtendContext, GlobalMetadata, RegisteredMiddlewares, UsingClient } from '../commands';
|
|
4
4
|
import { BaseContext } from '../commands/basecontext';
|
|
5
|
-
import
|
|
5
|
+
import { ComponentInteractionMessageUpdate, InteractionCreateBodyRequest, InteractionMessageUpdateBodyRequest, MakeRequired, MessageWebhookCreateBodyRequest, ModalCreateBodyRequest, ModalCreateOptions, UnionToTuple, When } from '../common';
|
|
6
|
+
import { ModalSubmitInteraction } from '../structures';
|
|
6
7
|
import { type RESTGetAPIGuildQuery } from '../types';
|
|
7
8
|
export interface ComponentContext<Type extends keyof ContextComponentCommandInteractionMap = keyof ContextComponentCommandInteractionMap> extends BaseContext, ExtendContext {
|
|
8
9
|
}
|
|
@@ -73,7 +74,8 @@ export declare class ComponentContext<Type extends keyof ContextComponentCommand
|
|
|
73
74
|
* @returns A promise that resolves when the response is deleted.
|
|
74
75
|
*/
|
|
75
76
|
deleteResponse(): Promise<void>;
|
|
76
|
-
modal(body: ModalCreateBodyRequest): Promise<undefined>;
|
|
77
|
+
modal(body: ModalCreateBodyRequest, options?: undefined): Promise<undefined>;
|
|
78
|
+
modal(body: ModalCreateBodyRequest, options: ModalCreateOptions): Promise<ModalSubmitInteraction | null>;
|
|
77
79
|
/**
|
|
78
80
|
* Gets the channel of the interaction.
|
|
79
81
|
* @param mode - The mode to fetch the channel.
|
|
@@ -94,8 +94,10 @@ class ComponentContext extends basecontext_1.BaseContext {
|
|
|
94
94
|
deleteResponse() {
|
|
95
95
|
return this.interaction.deleteResponse();
|
|
96
96
|
}
|
|
97
|
-
modal(body) {
|
|
98
|
-
|
|
97
|
+
modal(body, options) {
|
|
98
|
+
if (options === undefined)
|
|
99
|
+
return this.interaction.modal(body);
|
|
100
|
+
return this.interaction.modal(body, options);
|
|
99
101
|
}
|
|
100
102
|
channel(mode = 'flow') {
|
|
101
103
|
if (mode === 'cache')
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { AllChannels,
|
|
1
|
+
import type { AllChannels, ModalCommand, ModalSubmitInteraction, ReturnCache } from '..';
|
|
2
2
|
import type { GuildMemberStructure, GuildStructure, InteractionGuildMemberStructure, UserStructure, WebhookMessageStructure } from '../client/transformers';
|
|
3
3
|
import type { CommandMetadata, ExtendContext, GlobalMetadata, RegisteredMiddlewares, UsingClient } from '../commands';
|
|
4
4
|
import { BaseContext } from '../commands/basecontext';
|
|
5
|
-
import
|
|
5
|
+
import { InteractionCreateBodyRequest, InteractionMessageUpdateBodyRequest, MakeRequired, MessageWebhookCreateBodyRequest, ModalCreateBodyRequest, ModalCreateOptions, UnionToTuple, When } from '../common';
|
|
6
6
|
export interface ModalContext extends BaseContext, ExtendContext {
|
|
7
7
|
}
|
|
8
8
|
/**
|
|
@@ -68,7 +68,8 @@ export declare class ModalContext<M extends keyof RegisteredMiddlewares = never>
|
|
|
68
68
|
* @returns A promise that resolves when the response is deleted.
|
|
69
69
|
*/
|
|
70
70
|
deleteResponse(): Promise<void>;
|
|
71
|
-
modal(body: ModalCreateBodyRequest):
|
|
71
|
+
modal(body: ModalCreateBodyRequest, options?: undefined): Promise<undefined>;
|
|
72
|
+
modal(body: ModalCreateBodyRequest, options: ModalCreateOptions): Promise<ModalSubmitInteraction | null>;
|
|
72
73
|
/**
|
|
73
74
|
* Gets the channel of the interaction.
|
|
74
75
|
* @param mode - The mode to fetch the channel.
|
|
@@ -81,9 +81,9 @@ class ModalContext extends basecontext_1.BaseContext {
|
|
|
81
81
|
deleteResponse() {
|
|
82
82
|
return this.interaction.deleteResponse();
|
|
83
83
|
}
|
|
84
|
-
modal(body) {
|
|
85
|
-
|
|
86
|
-
return this.interaction.modal(body);
|
|
84
|
+
modal(body, options) {
|
|
85
|
+
// @ts-expect-error
|
|
86
|
+
return this.interaction.modal(body, options);
|
|
87
87
|
}
|
|
88
88
|
channel(mode = 'flow') {
|
|
89
89
|
if (mode === 'cache')
|
|
@@ -2,7 +2,7 @@ import type { RawFile } from '../api';
|
|
|
2
2
|
import type { ReturnCache } from '../cache';
|
|
3
3
|
import { type EntitlementStructure, type GuildRoleStructure, type GuildStructure, type InteractionGuildMemberStructure, type MessageStructure, type OptionResolverStructure, type UserStructure, type WebhookMessageStructure } from '../client/transformers';
|
|
4
4
|
import type { UsingClient } from '../commands';
|
|
5
|
-
import { type ComponentInteractionMessageUpdate, type InteractionCreateBodyRequest, type InteractionMessageUpdateBodyRequest, type MessageCreateBodyRequest, type MessageUpdateBodyRequest, type MessageWebhookCreateBodyRequest, type ModalCreateBodyRequest, type ObjectToLower, type OmitInsert, type ToClass, type When } from '../common';
|
|
5
|
+
import { type ComponentInteractionMessageUpdate, type InteractionCreateBodyRequest, type InteractionMessageUpdateBodyRequest, type MessageCreateBodyRequest, type MessageUpdateBodyRequest, type MessageWebhookCreateBodyRequest, type ModalCreateBodyRequest, ModalCreateOptions, type ObjectToLower, type OmitInsert, type ToClass, type When } from '../common';
|
|
6
6
|
import { type APIApplicationCommandAutocompleteInteraction, type APIApplicationCommandInteraction, type APIBaseInteraction, type APIChatInputApplicationCommandInteraction, type APIChatInputApplicationCommandInteractionData, type APICommandAutocompleteInteractionResponseCallbackData, type APIEntryPointCommandInteraction, type APIInteraction, type APIInteractionResponse, type APIInteractionResponseChannelMessageWithSource, type APIInteractionResponseDeferredChannelMessageWithSource, type APIInteractionResponseDeferredMessageUpdate, type APIInteractionResponsePong, type APIInteractionResponseUpdateMessage, type APIMessageApplicationCommandInteraction, type APIMessageApplicationCommandInteractionData, type APIMessageButtonInteractionData, type APIMessageComponentInteraction, type APIMessageComponentSelectMenuInteraction, type APIMessageStringSelectInteractionData, type APIModalSubmission, type APIModalSubmitInteraction, type APIUserApplicationCommandInteraction, type APIUserApplicationCommandInteractionData, ApplicationCommandType, ComponentType, type GatewayInteractionCreateDispatchData, type InteractionCallbackData, type InteractionCallbackResourceActivity, InteractionResponseType, InteractionType, type MessageFlags, type RESTPostAPIInteractionCallbackJSONBody, type RESTPostAPIInteractionCallbackResult } from '../types';
|
|
7
7
|
import { type AllChannels } from './';
|
|
8
8
|
import { DiscordBase } from './extra/DiscordBase';
|
|
@@ -76,7 +76,8 @@ export declare class Interaction<FromGuild extends boolean = boolean, Type exten
|
|
|
76
76
|
fetchMessage(messageId: string): Promise<WebhookMessageStructure>;
|
|
77
77
|
fetchResponse(): Promise<WebhookMessageStructure>;
|
|
78
78
|
write<FR extends boolean = false>(body: InteractionCreateBodyRequest, withResponse?: FR): Promise<When<FR, WebhookMessageStructure, void>>;
|
|
79
|
-
modal(body: ModalCreateBodyRequest): Promise<undefined>;
|
|
79
|
+
modal(body: ModalCreateBodyRequest, options?: undefined): Promise<undefined>;
|
|
80
|
+
modal(body: ModalCreateBodyRequest, options: ModalCreateOptions): Promise<ModalSubmitInteraction | null>;
|
|
80
81
|
editOrReply<FR extends boolean = false>(body: InteractionCreateBodyRequest, fetchReply?: FR): Promise<When<FR, WebhookMessageStructure, void>>;
|
|
81
82
|
editMessage(messageId: string, body: InteractionMessageUpdateBodyRequest): Promise<WebhookMessageStructure>;
|
|
82
83
|
editResponse(body: InteractionMessageUpdateBodyRequest): Promise<WebhookMessageStructure>;
|
|
@@ -268,11 +268,33 @@ class Interaction extends BaseInteraction {
|
|
|
268
268
|
data: body,
|
|
269
269
|
}, withResponse);
|
|
270
270
|
}
|
|
271
|
-
modal(body) {
|
|
272
|
-
|
|
271
|
+
async modal(body, options) {
|
|
272
|
+
if (options !== undefined && !(body instanceof builders_1.Modal)) {
|
|
273
|
+
body = new builders_1.Modal(body);
|
|
274
|
+
}
|
|
275
|
+
if (options === undefined)
|
|
276
|
+
return this.reply({
|
|
277
|
+
type: types_1.InteractionResponseType.Modal,
|
|
278
|
+
data: body,
|
|
279
|
+
});
|
|
280
|
+
const promise = new Promise(res => {
|
|
281
|
+
let nodeTimeout;
|
|
282
|
+
// body is always a modal here, so we can safely cast it
|
|
283
|
+
body.__exec = (interaction) => {
|
|
284
|
+
res(interaction);
|
|
285
|
+
clearTimeout(nodeTimeout);
|
|
286
|
+
};
|
|
287
|
+
if (options?.waitFor && options?.waitFor > 0) {
|
|
288
|
+
nodeTimeout = setTimeout(() => {
|
|
289
|
+
res(null);
|
|
290
|
+
}, options.waitFor);
|
|
291
|
+
}
|
|
292
|
+
});
|
|
293
|
+
await this.reply({
|
|
273
294
|
type: types_1.InteractionResponseType.Modal,
|
|
274
295
|
data: body,
|
|
275
296
|
});
|
|
297
|
+
return promise;
|
|
276
298
|
}
|
|
277
299
|
async editOrReply(body, fetchReply) {
|
|
278
300
|
if (await this.replied) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "seyfert",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.3-dev-15770378141.0",
|
|
4
4
|
"description": "The most advanced framework for discord bots",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"module": "./lib/index.js",
|
|
@@ -70,4 +70,4 @@
|
|
|
70
70
|
"esbuild"
|
|
71
71
|
]
|
|
72
72
|
}
|
|
73
|
-
}
|
|
73
|
+
}
|