seyfert 2.1.1-dev-11535421049.0 → 2.1.1-dev-11566750568.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/builders/SelectMenu.d.ts +3 -8
- package/lib/builders/SelectMenu.js +2 -5
- package/lib/client/base.js +6 -3
- package/lib/commands/handle.d.ts +1 -0
- package/lib/commands/handle.js +13 -14
- package/lib/events/hooks/interactions.d.ts +1 -1
- package/lib/structures/Interaction.d.ts +2 -2
- package/lib/structures/Interaction.js +1 -3
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { EmojiResolvable, RestOrArray
|
|
2
|
-
import type { ChannelSelectMenuInteraction, ComponentInteraction, MentionableSelectMenuInteraction, RoleSelectMenuInteraction,
|
|
1
|
+
import type { EmojiResolvable, RestOrArray } from '../common';
|
|
2
|
+
import type { ChannelSelectMenuInteraction, ComponentInteraction, MentionableSelectMenuInteraction, RoleSelectMenuInteraction, UserSelectMenuInteraction } from '../structures';
|
|
3
3
|
import { type APIChannelSelectComponent, type APIMentionableSelectComponent, type APIRoleSelectComponent, type APISelectMenuComponent, type APISelectMenuOption, type APIStringSelectComponent, type APIUserSelectComponent, type ChannelType, SelectMenuDefaultValueType } from '../types';
|
|
4
4
|
import { BaseComponentBuilder, type OptionValuesLength } from './Base';
|
|
5
5
|
export type BuilderSelectMenus = RoleSelectMenu | UserSelectMenu | MentionableSelectMenu | ChannelSelectMenu | StringSelectMenu;
|
|
@@ -11,9 +11,6 @@ export type BuilderSelectMenus = RoleSelectMenu | UserSelectMenu | MentionableSe
|
|
|
11
11
|
* const selectMenu = new SelectMenu<APIUserSelectComponent, UserSelectMenuInteraction>();
|
|
12
12
|
* selectMenu.setCustomId("user-select-menu");
|
|
13
13
|
* selectMenu.setPlaceholder("Select a user");
|
|
14
|
-
* selectMenu.run((interaction) => {
|
|
15
|
-
* // Handle select menu interaction
|
|
16
|
-
* });
|
|
17
14
|
*/
|
|
18
15
|
export declare class SelectMenu<Select extends APISelectMenuComponent = APISelectMenuComponent, Interaction = ComponentInteraction> extends BaseComponentBuilder<Select> {
|
|
19
16
|
/**
|
|
@@ -139,7 +136,6 @@ export declare class ChannelSelectMenu extends SelectMenu<APIChannelSelectCompon
|
|
|
139
136
|
*/
|
|
140
137
|
setChannelTypes(types: ChannelType[]): this;
|
|
141
138
|
}
|
|
142
|
-
declare const StringSelectMenu_base: ToClass<Omit<SelectMenu<APIStringSelectComponent, StringSelectMenuInteraction<string[]>>, "data" | "toJSON">, StringSelectMenu>;
|
|
143
139
|
/**
|
|
144
140
|
* Represents a Select Menu for selecting string options.
|
|
145
141
|
* @example
|
|
@@ -151,7 +147,7 @@ declare const StringSelectMenu_base: ToClass<Omit<SelectMenu<APIStringSelectComp
|
|
|
151
147
|
* { label: "Option 3", value: "option_3" },
|
|
152
148
|
* ]);
|
|
153
149
|
*/
|
|
154
|
-
export declare class StringSelectMenu extends
|
|
150
|
+
export declare class StringSelectMenu extends SelectMenu {
|
|
155
151
|
data: Omit<APIStringSelectComponent, 'options'> & {
|
|
156
152
|
options: StringSelectOption[];
|
|
157
153
|
};
|
|
@@ -214,4 +210,3 @@ export declare class StringSelectOption {
|
|
|
214
210
|
*/
|
|
215
211
|
toJSON(): APISelectMenuOption;
|
|
216
212
|
}
|
|
217
|
-
export {};
|
|
@@ -22,9 +22,6 @@ function mappedDefault(ids, type) {
|
|
|
22
22
|
* const selectMenu = new SelectMenu<APIUserSelectComponent, UserSelectMenuInteraction>();
|
|
23
23
|
* selectMenu.setCustomId("user-select-menu");
|
|
24
24
|
* selectMenu.setPlaceholder("Select a user");
|
|
25
|
-
* selectMenu.run((interaction) => {
|
|
26
|
-
* // Handle select menu interaction
|
|
27
|
-
* });
|
|
28
25
|
*/
|
|
29
26
|
class SelectMenu extends Base_1.BaseComponentBuilder {
|
|
30
27
|
/**
|
|
@@ -219,7 +216,7 @@ exports.ChannelSelectMenu = ChannelSelectMenu;
|
|
|
219
216
|
class StringSelectMenu extends SelectMenu {
|
|
220
217
|
constructor(data = {}) {
|
|
221
218
|
super({ ...data, type: types_1.ComponentType.StringSelect });
|
|
222
|
-
this.data.options =
|
|
219
|
+
this.data.options = data.options?.map(x => new StringSelectOption(x)) ?? [];
|
|
223
220
|
}
|
|
224
221
|
/**
|
|
225
222
|
* Adds options to the string select menu.
|
|
@@ -243,7 +240,7 @@ class StringSelectMenu extends SelectMenu {
|
|
|
243
240
|
const { options, ...raw } = this.data;
|
|
244
241
|
return {
|
|
245
242
|
...raw,
|
|
246
|
-
options:
|
|
243
|
+
options: options.map(x => x.toJSON()),
|
|
247
244
|
};
|
|
248
245
|
}
|
|
249
246
|
}
|
package/lib/client/base.js
CHANGED
|
@@ -299,10 +299,13 @@ class BaseClient {
|
|
|
299
299
|
};
|
|
300
300
|
for (const i in locations) {
|
|
301
301
|
const key = i;
|
|
302
|
-
const location = locations[
|
|
303
|
-
if (
|
|
302
|
+
const location = locations[key];
|
|
303
|
+
if (key in locationsFullPaths)
|
|
304
304
|
continue;
|
|
305
|
-
|
|
305
|
+
if (typeof location === 'string')
|
|
306
|
+
locationsFullPaths[key] = (0, node_path_1.join)(process.cwd(), locations.output, location);
|
|
307
|
+
else
|
|
308
|
+
locationsFullPaths[key] = location;
|
|
306
309
|
}
|
|
307
310
|
const obj = {
|
|
308
311
|
debug: !!debug,
|
package/lib/commands/handle.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ export declare class HandleCommand {
|
|
|
16
16
|
client: UsingClient;
|
|
17
17
|
constructor(client: UsingClient);
|
|
18
18
|
autocomplete(interaction: AutocompleteInteraction, optionsResolver: OptionResolverStructure, command?: CommandAutocompleteOption): Promise<void>;
|
|
19
|
+
contextMenu(command: ContextMenuCommand, interaction: MessageCommandInteraction | UserCommandInteraction, context: MenuCommandContext<MessageCommandInteraction | UserCommandInteraction>): Promise<any>;
|
|
19
20
|
contextMenuMessage(command: ContextMenuCommand, interaction: MessageCommandInteraction, context: MenuCommandContext<MessageCommandInteraction>): Promise<any>;
|
|
20
21
|
contextMenuUser(command: ContextMenuCommand, interaction: UserCommandInteraction, context: MenuCommandContext<UserCommandInteraction>): Promise<any>;
|
|
21
22
|
entryPoint(command: EntryPointCommand, interaction: EntryPointInteraction, context: EntryPointContext): Promise<any>;
|
package/lib/commands/handle.js
CHANGED
|
@@ -36,12 +36,8 @@ class HandleCommand {
|
|
|
36
36
|
// pass
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
|
-
async
|
|
40
|
-
|
|
41
|
-
return this.contextMenuUser(command, interaction, context);
|
|
42
|
-
}
|
|
43
|
-
async contextMenuUser(command, interaction, context) {
|
|
44
|
-
if (context.guildId && command.botPermissions && interaction.appPermissions) {
|
|
39
|
+
async contextMenu(command, interaction, context) {
|
|
40
|
+
if (context.guildId && command.botPermissions) {
|
|
45
41
|
const permissions = this.checkPermissions(interaction.appPermissions, command.botPermissions);
|
|
46
42
|
if (permissions)
|
|
47
43
|
return command.onBotPermissionsFail(context, permissions);
|
|
@@ -71,8 +67,14 @@ class HandleCommand {
|
|
|
71
67
|
}
|
|
72
68
|
}
|
|
73
69
|
}
|
|
70
|
+
contextMenuMessage(command, interaction, context) {
|
|
71
|
+
return this.contextMenu(command, interaction, context);
|
|
72
|
+
}
|
|
73
|
+
contextMenuUser(command, interaction, context) {
|
|
74
|
+
return this.contextMenu(command, interaction, context);
|
|
75
|
+
}
|
|
74
76
|
async entryPoint(command, interaction, context) {
|
|
75
|
-
if (context.guildId && command.botPermissions
|
|
77
|
+
if (context.guildId && command.botPermissions) {
|
|
76
78
|
const permissions = this.checkPermissions(interaction.appPermissions, command.botPermissions);
|
|
77
79
|
if (permissions)
|
|
78
80
|
return command.onBotPermissionsFail(context, permissions);
|
|
@@ -103,7 +105,7 @@ class HandleCommand {
|
|
|
103
105
|
}
|
|
104
106
|
}
|
|
105
107
|
async chatInput(command, interaction, resolver, context) {
|
|
106
|
-
if (context.guildId
|
|
108
|
+
if (context.guildId) {
|
|
107
109
|
if (command.botPermissions) {
|
|
108
110
|
const permissions = this.checkPermissions(interaction.appPermissions, command.botPermissions);
|
|
109
111
|
if (permissions)
|
|
@@ -172,17 +174,14 @@ class HandleCommand {
|
|
|
172
174
|
const data = this.makeMenuCommand(body, shardId, __reply);
|
|
173
175
|
if (!data)
|
|
174
176
|
return;
|
|
175
|
-
this.contextMenuMessage(data.command,
|
|
176
|
-
// @ts-expect-error
|
|
177
|
-
data.interaction, data.context);
|
|
177
|
+
await this.contextMenuMessage(data.command, data.interaction, data.context);
|
|
178
178
|
break;
|
|
179
179
|
}
|
|
180
180
|
case types_1.ApplicationCommandType.User: {
|
|
181
181
|
const data = this.makeMenuCommand(body, shardId, __reply);
|
|
182
182
|
if (!data)
|
|
183
183
|
return;
|
|
184
|
-
|
|
185
|
-
this.contextMenuUser(data.command, data.interaction, data.context);
|
|
184
|
+
await this.contextMenuUser(data.command, data.interaction, data.context);
|
|
186
185
|
break;
|
|
187
186
|
}
|
|
188
187
|
case types_1.ApplicationCommandType.PrimaryEntryPoint: {
|
|
@@ -199,10 +198,10 @@ class HandleCommand {
|
|
|
199
198
|
case types_1.ApplicationCommandType.ChatInput: {
|
|
200
199
|
const parentCommand = this.getCommand(body.data);
|
|
201
200
|
const optionsResolver = this.makeResolver(this.client, body.data.options ?? [], parentCommand, body.guild_id, body.data.resolved);
|
|
202
|
-
const interaction = structures_1.BaseInteraction.from(this.client, body, __reply);
|
|
203
201
|
const command = optionsResolver.getCommand();
|
|
204
202
|
if (!command?.run)
|
|
205
203
|
return this.client.logger.warn(`${optionsResolver.fullCommandName} command does not have 'run' callback`);
|
|
204
|
+
const interaction = structures_1.BaseInteraction.from(this.client, body, __reply);
|
|
206
205
|
const context = new _1.CommandContext(this.client, interaction, optionsResolver, shardId, command);
|
|
207
206
|
const extendContext = this.client.options?.context?.(interaction) ?? {};
|
|
208
207
|
Object.assign(context, extendContext);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { UsingClient } from '../../commands';
|
|
2
2
|
import { BaseInteraction } from '../../structures';
|
|
3
3
|
import type { GatewayInteractionCreateDispatchData } from '../../types';
|
|
4
|
-
export declare const INTERACTION_CREATE: (self: UsingClient, data: GatewayInteractionCreateDispatchData) => import("../../structures").RoleSelectMenuInteraction | import("../../structures").UserSelectMenuInteraction | import("../../structures").MentionableSelectMenuInteraction | import("../../structures").ChannelSelectMenuInteraction | import("../../structures").
|
|
4
|
+
export declare const INTERACTION_CREATE: (self: UsingClient, data: GatewayInteractionCreateDispatchData) => import("../../structures").RoleSelectMenuInteraction | import("../../structures").UserSelectMenuInteraction | import("../../structures").MentionableSelectMenuInteraction | import("../../structures").ChannelSelectMenuInteraction | import("../../structures").ChatInputCommandInteraction<boolean> | import("../../structures").UserCommandInteraction<boolean> | import("../../structures").MessageCommandInteraction<boolean> | import("../../structures").ButtonInteraction | import("../../structures").StringSelectMenuInteraction<string[]> | import("../../structures").ModalSubmitInteraction<boolean> | import("../../structures").AutocompleteInteraction<boolean> | BaseInteraction<boolean, import("../../types").APIPingInteraction>;
|
|
@@ -29,7 +29,7 @@ export declare class BaseInteraction<FromGuild extends boolean = boolean, Type e
|
|
|
29
29
|
channel?: AllChannels;
|
|
30
30
|
message?: MessageStructure;
|
|
31
31
|
replied?: Promise<boolean | RESTPostAPIInteractionCallbackResult | undefined> | boolean;
|
|
32
|
-
appPermissions
|
|
32
|
+
appPermissions: PermissionsBitField;
|
|
33
33
|
entitlements: EntitlementStructure[];
|
|
34
34
|
constructor(client: UsingClient, interaction: Type, __reply?: __InternalReplyFunction | undefined);
|
|
35
35
|
static transformBodyRequest(body: ReplyInteractionBody, files: RawFile[] | undefined, self: UsingClient): APIInteractionResponse;
|
|
@@ -49,7 +49,7 @@ export declare class BaseInteraction<FromGuild extends boolean = boolean, Type e
|
|
|
49
49
|
isAutocomplete(): this is AutocompleteInteraction;
|
|
50
50
|
isModal(): this is ModalSubmitInteraction;
|
|
51
51
|
isEntryPoint(): this is EntryPointInteraction;
|
|
52
|
-
static from(client: UsingClient, gateway: GatewayInteractionCreateDispatchData, __reply?: __InternalReplyFunction): RoleSelectMenuInteraction | UserSelectMenuInteraction | MentionableSelectMenuInteraction | ChannelSelectMenuInteraction |
|
|
52
|
+
static from(client: UsingClient, gateway: GatewayInteractionCreateDispatchData, __reply?: __InternalReplyFunction): RoleSelectMenuInteraction | UserSelectMenuInteraction | MentionableSelectMenuInteraction | ChannelSelectMenuInteraction | ChatInputCommandInteraction<boolean> | UserCommandInteraction<boolean> | MessageCommandInteraction<boolean> | ButtonInteraction | StringSelectMenuInteraction<string[]> | ModalSubmitInteraction<boolean> | AutocompleteInteraction<boolean> | BaseInteraction<boolean, import("../types").APIPingInteraction>;
|
|
53
53
|
fetchGuild(force?: boolean): Promise<import("./Guild").Guild<"api">> | undefined;
|
|
54
54
|
}
|
|
55
55
|
export type AllInteractions = AutocompleteInteraction | ChatInputCommandInteraction | UserCommandInteraction | MessageCommandInteraction | ComponentInteraction | SelectMenuInteraction | ModalSubmitInteraction | EntryPointInteraction | BaseInteraction;
|
|
@@ -35,9 +35,7 @@ class BaseInteraction extends DiscordBase_1.DiscordBase {
|
|
|
35
35
|
if (interaction.message) {
|
|
36
36
|
this.message = transformers_1.Transformers.Message(client, interaction.message);
|
|
37
37
|
}
|
|
38
|
-
|
|
39
|
-
this.appPermissions = new Permissions_1.PermissionsBitField(Number(interaction.app_permissions));
|
|
40
|
-
}
|
|
38
|
+
this.appPermissions = new Permissions_1.PermissionsBitField(Number(interaction.app_permissions));
|
|
41
39
|
if (interaction.channel) {
|
|
42
40
|
this.channel = (0, _1.channelFrom)(interaction.channel, client);
|
|
43
41
|
}
|