seyfert 2.1.1-dev-11533244769.0 → 2.1.1-dev-11537652481.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/cache/adapters/limited.js +2 -4
- package/lib/cache/resources/bans.js +2 -2
- package/lib/cache/resources/guilds.js +1 -1
- package/lib/cache/resources/members.js +2 -2
- package/lib/cache/resources/messages.js +3 -3
- package/lib/cache/resources/voice-states.js +1 -1
- package/lib/commands/applications/shared.d.ts +2 -2
- package/lib/commands/handle.d.ts +1 -1
- package/lib/commands/handle.js +95 -100
- package/lib/common/it/constants.d.ts +1 -0
- package/lib/common/it/constants.js +2 -1
- package/lib/events/hooks/interactions.d.ts +1 -1
- package/lib/structures/Interaction.d.ts +1 -1
- 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
|
}
|
|
@@ -35,12 +35,10 @@ class LimitedMemoryAdapter {
|
|
|
35
35
|
bulkGet(keys) {
|
|
36
36
|
const storageArray = Array.from(this.storage.values());
|
|
37
37
|
const keySet = new Set(keys);
|
|
38
|
-
return storageArray
|
|
39
|
-
.flatMap(storageEntry => {
|
|
38
|
+
return storageArray.flatMap(storageEntry => {
|
|
40
39
|
const entries = Array.from(storageEntry.entries());
|
|
41
40
|
return entries.filter(([key]) => keySet.has(key)).map(([, value]) => this.options.decode(value.value));
|
|
42
|
-
})
|
|
43
|
-
.filter(Boolean);
|
|
41
|
+
});
|
|
44
42
|
}
|
|
45
43
|
get(key) {
|
|
46
44
|
for (const storageEntry of this.storage.values()) {
|
|
@@ -25,7 +25,7 @@ class Bans extends guild_based_1.GuildBasedResource {
|
|
|
25
25
|
.map(rawBan => {
|
|
26
26
|
return rawBan ? transformers_1.Transformers.GuildBan(this.client, rawBan, guild) : undefined;
|
|
27
27
|
})
|
|
28
|
-
.filter(
|
|
28
|
+
.filter(x => x !== undefined));
|
|
29
29
|
}
|
|
30
30
|
bulkRaw(ids, guild) {
|
|
31
31
|
return super.bulk(ids, guild);
|
|
@@ -35,7 +35,7 @@ class Bans extends guild_based_1.GuildBasedResource {
|
|
|
35
35
|
.map(rawBan => {
|
|
36
36
|
return rawBan ? transformers_1.Transformers.GuildBan(this.client, rawBan, guild) : undefined;
|
|
37
37
|
})
|
|
38
|
-
.filter(
|
|
38
|
+
.filter(x => x !== undefined));
|
|
39
39
|
}
|
|
40
40
|
valuesRaw(guild) {
|
|
41
41
|
return super.values(guild);
|
|
@@ -60,7 +60,7 @@ class Guilds extends base_1.BaseResource {
|
|
|
60
60
|
this.cache.voiceStates?.hashId(id),
|
|
61
61
|
this.cache.presences?.hashId(id),
|
|
62
62
|
this.cache.stageInstances?.hashId(id),
|
|
63
|
-
].filter(
|
|
63
|
+
].filter(x => x !== undefined));
|
|
64
64
|
await super.remove(id);
|
|
65
65
|
}
|
|
66
66
|
async set(id, data) {
|
|
@@ -33,7 +33,7 @@ class Members extends guild_based_1.GuildBasedResource {
|
|
|
33
33
|
const user = users?.find(x => x.id === rawMember.id);
|
|
34
34
|
return user ? transformers_1.Transformers.GuildMember(this.client, rawMember, user, guild) : undefined;
|
|
35
35
|
})
|
|
36
|
-
.filter(
|
|
36
|
+
.filter(x => x !== undefined)));
|
|
37
37
|
}
|
|
38
38
|
bulkRaw(ids, guild) {
|
|
39
39
|
return super.bulk(ids, guild);
|
|
@@ -44,7 +44,7 @@ class Members extends guild_based_1.GuildBasedResource {
|
|
|
44
44
|
const user = users?.find(x => x.id === rawMember.id);
|
|
45
45
|
return user ? transformers_1.Transformers.GuildMember(this.client, rawMember, user, rawMember.guild_id) : undefined;
|
|
46
46
|
})
|
|
47
|
-
.filter(
|
|
47
|
+
.filter(x => x !== undefined)));
|
|
48
48
|
}
|
|
49
49
|
valuesRaw(guild) {
|
|
50
50
|
return super.values(guild);
|
|
@@ -37,7 +37,7 @@ class Messages extends guild_related_1.GuildRelatedResource {
|
|
|
37
37
|
})
|
|
38
38
|
: undefined;
|
|
39
39
|
})
|
|
40
|
-
.filter(
|
|
40
|
+
.filter(x => x !== undefined));
|
|
41
41
|
}
|
|
42
42
|
bulkRaw(ids) {
|
|
43
43
|
return super.bulk(ids);
|
|
@@ -47,13 +47,13 @@ class Messages extends guild_related_1.GuildRelatedResource {
|
|
|
47
47
|
const hashes = this.cache.users
|
|
48
48
|
? messages.map(x => (x.user_id ? this.cache.users?.hashId(x.user_id) : undefined))
|
|
49
49
|
: [];
|
|
50
|
-
return (0, common_1.fakePromise)(this.cache.adapter.bulkGet(hashes.filter(
|
|
50
|
+
return (0, common_1.fakePromise)(this.cache.adapter.bulkGet(hashes.filter(x => x !== undefined))).then(users => {
|
|
51
51
|
return messages
|
|
52
52
|
.map(message => {
|
|
53
53
|
const user = users.find(user => user.id === message.user_id);
|
|
54
54
|
return user ? transformers_1.Transformers.Message(this.client, { ...message, author: user }) : undefined;
|
|
55
55
|
})
|
|
56
|
-
.filter(
|
|
56
|
+
.filter(x => x !== undefined);
|
|
57
57
|
});
|
|
58
58
|
});
|
|
59
59
|
}
|
|
@@ -23,7 +23,7 @@ class VoiceStates extends guild_based_1.GuildBasedResource {
|
|
|
23
23
|
bulk(ids, guild) {
|
|
24
24
|
return (0, common_1.fakePromise)(super.bulk(ids, guild)).then(states => states
|
|
25
25
|
.map(state => (state ? transformers_1.Transformers.VoiceState(this.client, state) : undefined))
|
|
26
|
-
.filter(
|
|
26
|
+
.filter(x => x !== undefined));
|
|
27
27
|
}
|
|
28
28
|
bulkRaw(ids, guild) {
|
|
29
29
|
return super.bulk(ids, guild);
|
|
@@ -47,10 +47,10 @@ export type CommandMetadata<T extends readonly (keyof RegisteredMiddlewares)[]>
|
|
|
47
47
|
export type MessageCommandOptionErrors = ['CHANNEL_TYPES', type: ChannelType[]] | ['STRING_MIN_LENGTH', min: number] | ['STRING_MAX_LENGTH', max: number] | ['STRING_INVALID_CHOICE', choices: readonly {
|
|
48
48
|
name: string;
|
|
49
49
|
value: string;
|
|
50
|
-
}[]] | ['NUMBER_NAN', value: string
|
|
50
|
+
}[]] | ['NUMBER_NAN', value: string] | ['NUMBER_MIN_VALUE', min: number] | ['NUMBER_MAX_VALUE', max: number] | ['NUMBER_INVALID_CHOICE', choices: readonly {
|
|
51
51
|
name: string;
|
|
52
52
|
value: number;
|
|
53
|
-
}[]] | ['OPTION_REQUIRED'] | ['UNKNOWN', error: unknown];
|
|
53
|
+
}[]] | ['NUMBER_OUT_OF_BOUNDS', value: number] | ['OPTION_REQUIRED'] | ['UNKNOWN', error: unknown];
|
|
54
54
|
export type OnOptionsReturnObject = Record<string, {
|
|
55
55
|
failed: false;
|
|
56
56
|
value: unknown;
|
package/lib/commands/handle.d.ts
CHANGED
|
@@ -54,7 +54,7 @@ export declare class HandleCommand {
|
|
|
54
54
|
context: MenuCommandContext<UserCommandInteraction<boolean> | MessageCommandInteraction<boolean>, never>;
|
|
55
55
|
};
|
|
56
56
|
runOptions(command: Command | SubCommand, context: CommandContext, resolver: OptionResolverStructure): Promise<boolean>;
|
|
57
|
-
argsOptionsParser(command: Command | SubCommand, message: GatewayMessageCreateDispatchData, args:
|
|
57
|
+
argsOptionsParser(command: Command | SubCommand, message: GatewayMessageCreateDispatchData, args: Record<string, string>, resolved: MakeRequired<ContextOptionsResolved>): Promise<{
|
|
58
58
|
errors: {
|
|
59
59
|
name: string;
|
|
60
60
|
error: string;
|
package/lib/commands/handle.js
CHANGED
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.HandleCommand = void 0;
|
|
4
4
|
const _1 = require(".");
|
|
5
5
|
const transformers_1 = require("../client/transformers");
|
|
6
|
+
const constants_1 = require("../common/it/constants");
|
|
6
7
|
const components_1 = require("../components");
|
|
7
8
|
const structures_1 = require("../structures");
|
|
8
9
|
const types_1 = require("../types");
|
|
@@ -508,6 +509,8 @@ class HandleCommand {
|
|
|
508
509
|
let indexAttachment = -1;
|
|
509
510
|
for (const i of (command.options ?? [])) {
|
|
510
511
|
try {
|
|
512
|
+
if (!args[i.name] && i.type !== types_1.ApplicationCommandOptionType.Attachment)
|
|
513
|
+
continue;
|
|
511
514
|
let value;
|
|
512
515
|
switch (i.type) {
|
|
513
516
|
case types_1.ApplicationCommandOptionType.Attachment:
|
|
@@ -517,9 +520,7 @@ class HandleCommand {
|
|
|
517
520
|
}
|
|
518
521
|
break;
|
|
519
522
|
case types_1.ApplicationCommandOptionType.Boolean:
|
|
520
|
-
|
|
521
|
-
value = ['yes', 'y', 'true', 'treu'].includes(args[i.name].toLowerCase());
|
|
522
|
-
}
|
|
523
|
+
value = ['yes', 'y', 'true', 'treu'].includes(args[i.name].toLowerCase());
|
|
523
524
|
break;
|
|
524
525
|
case types_1.ApplicationCommandOptionType.Channel:
|
|
525
526
|
{
|
|
@@ -528,24 +529,23 @@ class HandleCommand {
|
|
|
528
529
|
if (!rawQuery)
|
|
529
530
|
continue;
|
|
530
531
|
const channel = (await this.client.cache.channels?.raw(rawQuery)) ?? (await this.fetchChannel(i, rawQuery));
|
|
531
|
-
if (channel)
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
}
|
|
532
|
+
if (!channel)
|
|
533
|
+
break;
|
|
534
|
+
if ('channel_types' in i) {
|
|
535
|
+
if (!i.channel_types.includes(channel.type)) {
|
|
536
|
+
errors.push({
|
|
537
|
+
name: i.name,
|
|
538
|
+
error: `The entered channel type is not one of ${i
|
|
539
|
+
.channel_types.map(t => types_1.ChannelType[t])
|
|
540
|
+
.join(', ')}`,
|
|
541
|
+
fullError: ['CHANNEL_TYPES', i.channel_types],
|
|
542
|
+
});
|
|
543
|
+
break;
|
|
544
544
|
}
|
|
545
|
-
value = channel.id;
|
|
546
|
-
//discord funny memoentnt!!!!!!!!
|
|
547
|
-
resolved.channels[channel.id] = channel;
|
|
548
545
|
}
|
|
546
|
+
value = channel.id;
|
|
547
|
+
//discord funny memoentnt!!!!!!!!
|
|
548
|
+
resolved.channels[channel.id] = channel;
|
|
549
549
|
}
|
|
550
550
|
break;
|
|
551
551
|
case types_1.ApplicationCommandOptionType.Mentionable:
|
|
@@ -613,116 +613,111 @@ class HandleCommand {
|
|
|
613
613
|
break;
|
|
614
614
|
case types_1.ApplicationCommandOptionType.String:
|
|
615
615
|
{
|
|
616
|
-
value = args[i.name];
|
|
617
616
|
const option = i;
|
|
618
|
-
if (
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
});
|
|
617
|
+
if (option.choices?.length) {
|
|
618
|
+
const choice = option.choices.find(x => x.name === args[i.name]);
|
|
619
|
+
if (!choice) {
|
|
620
|
+
errors.push({
|
|
621
|
+
name: i.name,
|
|
622
|
+
error: `The entered choice is invalid. Please choose one of the following options: ${option.choices
|
|
623
|
+
.map(x => x.name)
|
|
624
|
+
.join(', ')}`,
|
|
625
|
+
fullError: ['STRING_INVALID_CHOICE', option.choices],
|
|
626
|
+
});
|
|
629
627
|
break;
|
|
630
628
|
}
|
|
629
|
+
value = choice.value;
|
|
630
|
+
break;
|
|
631
631
|
}
|
|
632
|
-
if (option.
|
|
633
|
-
if (
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
fullError: ['STRING_MAX_LENGTH', option.max_length],
|
|
640
|
-
});
|
|
632
|
+
if (option.min_length !== undefined) {
|
|
633
|
+
if (args[i.name].length < option.min_length) {
|
|
634
|
+
errors.push({
|
|
635
|
+
name: i.name,
|
|
636
|
+
error: `The entered string has less than ${option.min_length} characters. The minimum required is ${option.min_length} characters`,
|
|
637
|
+
fullError: ['STRING_MIN_LENGTH', option.min_length],
|
|
638
|
+
});
|
|
641
639
|
break;
|
|
642
640
|
}
|
|
643
641
|
}
|
|
644
|
-
if (option.
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
error: `The entered choice is invalid. Please choose one of the following options: ${option.choices
|
|
652
|
-
.map(x => x.name)
|
|
653
|
-
.join(', ')}.`,
|
|
654
|
-
fullError: ['STRING_INVALID_CHOICE', option.choices],
|
|
655
|
-
});
|
|
642
|
+
if (option.max_length !== undefined) {
|
|
643
|
+
if (args[i.name].length > option.max_length) {
|
|
644
|
+
errors.push({
|
|
645
|
+
name: i.name,
|
|
646
|
+
error: `The entered string has more than ${option.max_length} characters. The maximum required is ${option.max_length} characters`,
|
|
647
|
+
fullError: ['STRING_MAX_LENGTH', option.max_length],
|
|
648
|
+
});
|
|
656
649
|
break;
|
|
657
650
|
}
|
|
658
|
-
value = choice.value;
|
|
659
651
|
}
|
|
652
|
+
value = args[i.name];
|
|
660
653
|
}
|
|
661
654
|
break;
|
|
662
655
|
case types_1.ApplicationCommandOptionType.Number:
|
|
663
656
|
case types_1.ApplicationCommandOptionType.Integer:
|
|
664
657
|
{
|
|
665
658
|
const option = i;
|
|
666
|
-
if (
|
|
667
|
-
|
|
668
|
-
if (
|
|
669
|
-
|
|
659
|
+
if (option.choices?.length) {
|
|
660
|
+
const choice = option.choices.find(x => x.name === args[i.name]);
|
|
661
|
+
if (!choice) {
|
|
662
|
+
errors.push({
|
|
663
|
+
name: i.name,
|
|
664
|
+
error: `The entered choice is invalid. Please choose one of the following options: ${option.choices
|
|
665
|
+
.map(x => x.name)
|
|
666
|
+
.join(', ')}`,
|
|
667
|
+
fullError: ['NUMBER_INVALID_CHOICE', option.choices],
|
|
668
|
+
});
|
|
670
669
|
break;
|
|
671
670
|
}
|
|
672
|
-
|
|
671
|
+
value = choice.value;
|
|
672
|
+
break;
|
|
673
|
+
}
|
|
674
|
+
value =
|
|
675
|
+
i.type === types_1.ApplicationCommandOptionType.Integer
|
|
676
|
+
? Math.trunc(Number(args[i.name]))
|
|
677
|
+
: Number(args[i.name]);
|
|
678
|
+
if (Number.isNaN(value)) {
|
|
679
|
+
value = undefined;
|
|
680
|
+
errors.push({
|
|
681
|
+
name: i.name,
|
|
682
|
+
error: 'The entered choice is an invalid number',
|
|
683
|
+
fullError: ['NUMBER_NAN', args[i.name]],
|
|
684
|
+
});
|
|
685
|
+
break;
|
|
686
|
+
}
|
|
687
|
+
if (value <= -constants_1.INTEGER_OPTION_VALUE_LIMIT || value >= constants_1.INTEGER_OPTION_VALUE_LIMIT) {
|
|
688
|
+
value = undefined;
|
|
689
|
+
errors.push({
|
|
690
|
+
name: i.name,
|
|
691
|
+
error: 'The entered number must be between -2^53 and 2^53',
|
|
692
|
+
fullError: ['NUMBER_OUT_OF_BOUNDS', constants_1.INTEGER_OPTION_VALUE_LIMIT],
|
|
693
|
+
});
|
|
694
|
+
break;
|
|
695
|
+
}
|
|
696
|
+
if (option.min_value !== undefined) {
|
|
697
|
+
if (value < option.min_value) {
|
|
673
698
|
value = undefined;
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
});
|
|
699
|
+
errors.push({
|
|
700
|
+
name: i.name,
|
|
701
|
+
error: `The entered number is less than ${option.min_value}. The minimum allowed is ${option.min_value}`,
|
|
702
|
+
fullError: ['NUMBER_MIN_VALUE', option.min_value],
|
|
703
|
+
});
|
|
680
704
|
break;
|
|
681
705
|
}
|
|
682
|
-
if (option.min_value) {
|
|
683
|
-
if (value < option.min_value) {
|
|
684
|
-
value = undefined;
|
|
685
|
-
if (i.required)
|
|
686
|
-
errors.push({
|
|
687
|
-
name: i.name,
|
|
688
|
-
error: `The entered number is less than ${option.min_value}. The minimum allowed is ${option.min_value}`,
|
|
689
|
-
fullError: ['NUMBER_MIN_VALUE', option.min_value],
|
|
690
|
-
});
|
|
691
|
-
break;
|
|
692
|
-
}
|
|
693
|
-
}
|
|
694
|
-
if (option.max_value) {
|
|
695
|
-
if (value > option.max_value) {
|
|
696
|
-
value = undefined;
|
|
697
|
-
if (i.required)
|
|
698
|
-
errors.push({
|
|
699
|
-
name: i.name,
|
|
700
|
-
error: `The entered number is greater than ${option.max_value}. The maximum allowed is ${option.max_value}`,
|
|
701
|
-
fullError: ['NUMBER_MAX_VALUE', option.max_value],
|
|
702
|
-
});
|
|
703
|
-
break;
|
|
704
|
-
}
|
|
705
|
-
}
|
|
706
|
-
break;
|
|
707
706
|
}
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
if (i.required)
|
|
707
|
+
if (option.max_value !== undefined) {
|
|
708
|
+
if (value > option.max_value) {
|
|
709
|
+
value = undefined;
|
|
712
710
|
errors.push({
|
|
713
711
|
name: i.name,
|
|
714
|
-
error: `The entered
|
|
715
|
-
|
|
716
|
-
.join(', ')}.`,
|
|
717
|
-
fullError: ['NUMBER_INVALID_CHOICE', option.choices],
|
|
712
|
+
error: `The entered number is greater than ${option.max_value}. The maximum allowed is ${option.max_value}`,
|
|
713
|
+
fullError: ['NUMBER_MAX_VALUE', option.max_value],
|
|
718
714
|
});
|
|
715
|
+
break;
|
|
716
|
+
}
|
|
719
717
|
break;
|
|
720
718
|
}
|
|
721
|
-
value = choice.value;
|
|
722
719
|
}
|
|
723
720
|
break;
|
|
724
|
-
default:
|
|
725
|
-
break;
|
|
726
721
|
}
|
|
727
722
|
if (value !== undefined) {
|
|
728
723
|
options.push({
|
|
@@ -36,3 +36,4 @@ export declare const DiscordEpoch = 1420070400000n;
|
|
|
36
36
|
export declare const BASE_HOST = "https://discord.com";
|
|
37
37
|
export declare const BASE_URL = "https://discord.com/api";
|
|
38
38
|
export declare const CDN_URL = "https://cdn.discordapp.com";
|
|
39
|
+
export declare const INTEGER_OPTION_VALUE_LIMIT: number;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CDN_URL = exports.BASE_URL = exports.BASE_HOST = exports.DiscordEpoch = exports.EmbedColors = void 0;
|
|
3
|
+
exports.INTEGER_OPTION_VALUE_LIMIT = exports.CDN_URL = exports.BASE_URL = exports.BASE_HOST = exports.DiscordEpoch = exports.EmbedColors = void 0;
|
|
4
4
|
var EmbedColors;
|
|
5
5
|
(function (EmbedColors) {
|
|
6
6
|
EmbedColors[EmbedColors["Default"] = 0] = "Default";
|
|
@@ -40,3 +40,4 @@ exports.DiscordEpoch = 1420070400000n;
|
|
|
40
40
|
exports.BASE_HOST = 'https://discord.com';
|
|
41
41
|
exports.BASE_URL = `${exports.BASE_HOST}/api`;
|
|
42
42
|
exports.CDN_URL = 'https://cdn.discordapp.com';
|
|
43
|
+
exports.INTEGER_OPTION_VALUE_LIMIT = 2 ** 53;
|
|
@@ -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>;
|
|
@@ -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;
|