seyfert 1.1.0 → 1.2.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/api/Routes/applications.d.ts +2 -2
- package/lib/api/Routes/channels.d.ts +2 -2
- package/lib/api/Routes/gateway.d.ts +2 -2
- package/lib/api/Routes/guilds.d.ts +2 -1
- package/lib/api/Routes/interactions.d.ts +2 -2
- package/lib/api/Routes/invites.d.ts +2 -2
- package/lib/api/Routes/stage-instances.d.ts +2 -2
- package/lib/api/Routes/stickers.d.ts +2 -2
- package/lib/api/Routes/users.d.ts +2 -2
- package/lib/api/Routes/voice.d.ts +2 -2
- package/lib/api/Routes/webhooks.d.ts +2 -2
- package/lib/builders/ActionRow.d.ts +2 -1
- package/lib/builders/ActionRow.js +3 -3
- package/lib/builders/Base.d.ts +1 -1
- package/lib/builders/Button.d.ts +2 -1
- package/lib/builders/Button.js +2 -2
- package/lib/builders/Embed.d.ts +2 -1
- package/lib/builders/Modal.d.ts +9 -2
- package/lib/builders/Modal.js +12 -3
- package/lib/builders/SelectMenu.d.ts +18 -1
- package/lib/builders/SelectMenu.js +36 -12
- package/lib/builders/index.d.ts +1 -1
- package/lib/builders/index.js +9 -9
- package/lib/builders/types.d.ts +1 -1
- package/lib/cache/adapters/types.d.ts +23 -23
- package/lib/cache/index.d.ts +5 -5
- package/lib/cache/index.js +3 -3
- package/lib/cache/resources/default/base.d.ts +10 -10
- package/lib/cache/resources/default/guild-based.d.ts +7 -7
- package/lib/cache/resources/default/guild-based.js +2 -1
- package/lib/cache/resources/default/guild-related.d.ts +9 -9
- package/lib/cache/resources/default/guild-related.js +2 -1
- package/lib/cache/resources/presence.d.ts +1 -1
- package/lib/cache/resources/stage-instances.d.ts +1 -1
- package/lib/cache/resources/voice-states.d.ts +1 -1
- package/lib/client/base.d.ts +19 -12
- package/lib/client/base.js +45 -7
- package/lib/client/client.d.ts +7 -4
- package/lib/client/client.js +21 -9
- package/lib/client/httpclient.d.ts +2 -1
- package/lib/client/httpclient.js +3 -3
- package/lib/client/oninteractioncreate.js +18 -19
- package/lib/client/onmessagecreate.js +6 -4
- package/lib/client/workerclient.d.ts +11 -5
- package/lib/client/workerclient.js +18 -11
- package/lib/commands/applications/chat.d.ts +4 -4
- package/lib/commands/applications/chat.js +17 -9
- package/lib/commands/applications/chatcontext.d.ts +7 -10
- package/lib/commands/applications/chatcontext.js +6 -17
- package/lib/commands/applications/menu.d.ts +2 -1
- package/lib/commands/applications/menu.js +7 -5
- package/lib/commands/applications/menucontext.d.ts +5 -9
- package/lib/commands/applications/menucontext.js +8 -21
- package/lib/commands/applications/shared.d.ts +5 -4
- package/lib/commands/basecontex.d.ts +15 -0
- package/lib/commands/basecontex.js +34 -0
- package/lib/commands/decorators.d.ts +3 -2
- package/lib/commands/decorators.js +5 -5
- package/lib/commands/handler.d.ts +6 -0
- package/lib/commands/handler.js +10 -4
- package/lib/commands/optionresolver.d.ts +3 -3
- package/lib/commands/optionresolver.js +14 -14
- package/lib/common/index.d.ts +0 -1
- package/lib/common/index.js +0 -1
- package/lib/common/it/constants.d.ts +3 -1
- package/lib/common/it/constants.js +2 -0
- package/lib/common/it/utils.d.ts +1 -0
- package/lib/common/it/utils.js +2 -1
- package/lib/common/shorters/channels.d.ts +1 -1
- package/lib/common/shorters/channels.js +4 -4
- package/lib/common/shorters/guilds.d.ts +1 -1
- package/lib/common/shorters/guilds.js +6 -1
- package/lib/common/shorters/members.d.ts +6 -1
- package/lib/common/shorters/members.js +25 -2
- package/lib/common/shorters/messages.d.ts +1 -1
- package/lib/common/shorters/messages.js +1 -1
- package/lib/common/shorters/users.d.ts +0 -6
- package/lib/common/shorters/users.js +0 -34
- package/lib/common/shorters/webhook.d.ts +2 -2
- package/lib/common/types/resolvables.d.ts +2 -1
- package/lib/common/types/util.d.ts +4 -1
- package/lib/common/types/write.d.ts +1 -1
- package/lib/components/ActionRow.d.ts +4 -3
- package/lib/components/ActionRow.js +6 -3
- package/lib/components/BaseComponent.d.ts +18 -0
- package/lib/components/BaseComponent.js +21 -0
- package/lib/components/BaseSelectMenuComponent.d.ts +10 -0
- package/lib/components/BaseSelectMenuComponent.js +22 -0
- package/lib/components/ButtonComponent.d.ts +14 -14
- package/lib/components/ButtonComponent.js +36 -25
- package/lib/components/ChannelSelectMenuComponent.d.ts +4 -4
- package/lib/components/ChannelSelectMenuComponent.js +6 -5
- package/lib/components/MentionableSelectMenuComponent.d.ts +3 -2
- package/lib/components/MentionableSelectMenuComponent.js +4 -1
- package/lib/components/RoleSelectMenuComponent.d.ts +3 -2
- package/lib/components/RoleSelectMenuComponent.js +4 -1
- package/lib/components/StringSelectMenuComponent.d.ts +3 -4
- package/lib/components/StringSelectMenuComponent.js +3 -5
- package/lib/components/TextInputComponent.d.ts +10 -5
- package/lib/components/TextInputComponent.js +24 -7
- package/lib/components/UserSelectMenuComponent.d.ts +3 -2
- package/lib/components/UserSelectMenuComponent.js +4 -1
- package/lib/components/command.d.ts +6 -5
- package/lib/components/command.js +4 -0
- package/lib/components/componentcontext.d.ts +42 -0
- package/lib/components/componentcontext.js +79 -0
- package/lib/components/handler.d.ts +22 -6
- package/lib/components/handler.js +19 -12
- package/lib/components/index.d.ts +2 -2
- package/lib/components/index.js +9 -9
- package/lib/events/handler.d.ts +12 -3
- package/lib/events/handler.js +6 -8
- package/lib/events/hooks/application_command.d.ts +2 -2
- package/lib/events/hooks/auto_moderation.d.ts +4 -4
- package/lib/events/hooks/channel.d.ts +1 -1
- package/lib/events/hooks/dispatch.d.ts +1 -1
- package/lib/events/hooks/entitlement.d.ts +4 -4
- package/lib/events/hooks/guild.d.ts +42 -42
- package/lib/events/hooks/integration.d.ts +19 -19
- package/lib/events/hooks/interactions.d.ts +2 -2
- package/lib/events/hooks/invite.d.ts +5 -5
- package/lib/events/hooks/message.d.ts +6 -5
- package/lib/events/hooks/presence.d.ts +7 -7
- package/lib/events/hooks/stage.d.ts +4 -4
- package/lib/events/hooks/thread.d.ts +49 -49
- package/lib/events/hooks/typing.d.ts +2 -2
- package/lib/events/hooks/user.d.ts +1 -1
- package/lib/events/hooks/voice.d.ts +2 -2
- package/lib/events/hooks/webhook.d.ts +1 -1
- package/lib/index.d.ts +3 -6
- package/lib/index.js +6 -7
- package/lib/langs/handler.d.ts +10 -1
- package/lib/langs/handler.js +1 -0
- package/lib/structures/AutoModerationRule.d.ts +3 -2
- package/lib/structures/ClientUser.d.ts +1 -1
- package/lib/structures/Guild.d.ts +27 -27
- package/lib/structures/GuildEmoji.d.ts +2 -1
- package/lib/structures/GuildMember.d.ts +16 -6
- package/lib/structures/GuildMember.js +35 -6
- package/lib/structures/GuildPreview.d.ts +1 -1
- package/lib/structures/GuildRole.d.ts +2 -1
- package/lib/structures/GuildTemplate.d.ts +3 -2
- package/lib/structures/Interaction.d.ts +5 -5
- package/lib/structures/Interaction.js +34 -34
- package/lib/structures/Message.d.ts +6 -5
- package/lib/structures/Sticker.d.ts +2 -1
- package/lib/structures/User.d.ts +7 -3
- package/lib/structures/User.js +5 -0
- package/lib/structures/Webhook.d.ts +63 -4
- package/lib/structures/Webhook.js +53 -0
- package/lib/structures/channels.d.ts +4 -4
- package/lib/structures/extra/BaseGuild.d.ts +2 -1
- package/lib/structures/extra/BaseGuild.js +3 -3
- package/lib/structures/extra/BitField.d.ts +2 -2
- package/lib/structures/extra/BitField.js +2 -2
- package/lib/structures/extra/Permissions.d.ts +1 -1
- package/lib/structures/extra/functions.d.ts +2 -1
- package/lib/structures/extra/functions.js +2 -1
- package/lib/types/index.d.ts +1 -0
- package/lib/types/index.js +17 -0
- package/lib/websocket/SharedTypes.d.ts +2 -1
- package/lib/websocket/SharedTypes.js +1 -0
- package/lib/websocket/discord/shard.d.ts +2 -1
- package/lib/websocket/discord/shard.js +30 -41
- package/lib/websocket/discord/sharder.d.ts +3 -2
- package/lib/websocket/discord/sharder.js +7 -6
- package/lib/websocket/discord/shared.d.ts +2 -1
- package/lib/websocket/discord/worker.d.ts +1 -1
- package/lib/websocket/discord/workermanager.d.ts +3 -2
- package/lib/websocket/discord/workermanager.js +1 -1
- package/package.json +2 -2
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import {
|
|
3
|
-
import { BaseComponent } from '
|
|
1
|
+
import type { ButtonStyle, ComponentType } from 'discord-api-types/v10';
|
|
2
|
+
import { Button, type ButtonStylesForID } from '../builders';
|
|
3
|
+
import { BaseComponent } from './BaseComponent';
|
|
4
4
|
export declare class LinkButtonComponent extends BaseComponent<ComponentType.Button> {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
label
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
get style(): ButtonStyle.Link;
|
|
6
|
+
get url(): string;
|
|
7
|
+
get label(): string | undefined;
|
|
8
|
+
get disabled(): boolean | undefined;
|
|
9
|
+
get emoji(): import("discord-api-types/v10").APIMessageComponentEmoji | undefined;
|
|
10
|
+
toBuilder(): Button<false>;
|
|
11
11
|
}
|
|
12
12
|
export type ButtonStyleExludeLink = Exclude<ButtonStyle, ButtonStyle.Link>;
|
|
13
13
|
export declare class ButtonComponent extends BaseComponent<ComponentType.Button> {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
emoji
|
|
18
|
-
|
|
14
|
+
get style(): ButtonStylesForID;
|
|
15
|
+
get label(): string | undefined;
|
|
16
|
+
get disabled(): boolean | undefined;
|
|
17
|
+
get emoji(): import("discord-api-types/v10").APIMessageComponentEmoji | undefined;
|
|
18
|
+
toBuilder(): Button<true>;
|
|
19
19
|
}
|
|
@@ -1,34 +1,45 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ButtonComponent = exports.LinkButtonComponent = void 0;
|
|
4
|
-
const
|
|
5
|
-
const BaseComponent_1 = require("
|
|
4
|
+
const builders_1 = require("../builders");
|
|
5
|
+
const BaseComponent_1 = require("./BaseComponent");
|
|
6
6
|
class LinkButtonComponent extends BaseComponent_1.BaseComponent {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
this.
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
disabled
|
|
18
|
-
|
|
7
|
+
get style() {
|
|
8
|
+
return this.data.style;
|
|
9
|
+
}
|
|
10
|
+
get url() {
|
|
11
|
+
// @ts-ignore
|
|
12
|
+
return this.data.url;
|
|
13
|
+
}
|
|
14
|
+
get label() {
|
|
15
|
+
return this.data.label;
|
|
16
|
+
}
|
|
17
|
+
get disabled() {
|
|
18
|
+
return this.data.disabled;
|
|
19
|
+
}
|
|
20
|
+
get emoji() {
|
|
21
|
+
return this.data.emoji;
|
|
22
|
+
}
|
|
23
|
+
toBuilder() {
|
|
24
|
+
return new builders_1.Button(this.data);
|
|
25
|
+
}
|
|
19
26
|
}
|
|
20
27
|
exports.LinkButtonComponent = LinkButtonComponent;
|
|
21
28
|
class ButtonComponent extends BaseComponent_1.BaseComponent {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
this.
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
emoji
|
|
32
|
-
|
|
29
|
+
get style() {
|
|
30
|
+
return this.data.style;
|
|
31
|
+
}
|
|
32
|
+
get label() {
|
|
33
|
+
return this.data.label;
|
|
34
|
+
}
|
|
35
|
+
get disabled() {
|
|
36
|
+
return this.data.disabled;
|
|
37
|
+
}
|
|
38
|
+
get emoji() {
|
|
39
|
+
return this.data.emoji;
|
|
40
|
+
}
|
|
41
|
+
toBuilder() {
|
|
42
|
+
return new builders_1.Button(this.data);
|
|
43
|
+
}
|
|
33
44
|
}
|
|
34
45
|
exports.ButtonComponent = ButtonComponent;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import { BaseSelectMenuComponent } from '
|
|
1
|
+
import type { ComponentType } from 'discord-api-types/v10';
|
|
2
|
+
import { BaseSelectMenuComponent } from './BaseSelectMenuComponent';
|
|
3
3
|
export declare class ChannelSelectMenuComponent extends BaseSelectMenuComponent<ComponentType.ChannelSelect> {
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
get channelsTypes(): import("discord-api-types/v10").ChannelType[] | undefined;
|
|
5
|
+
get defaultValues(): import("discord-api-types/v10").APISelectMenuDefaultValue<import("discord-api-types/v10").SelectMenuDefaultValueType.Channel>[] | undefined;
|
|
6
6
|
}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ChannelSelectMenuComponent = void 0;
|
|
4
|
-
const BaseSelectMenuComponent_1 = require("
|
|
4
|
+
const BaseSelectMenuComponent_1 = require("./BaseSelectMenuComponent");
|
|
5
5
|
class ChannelSelectMenuComponent extends BaseSelectMenuComponent_1.BaseSelectMenuComponent {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
get channelsTypes() {
|
|
7
|
+
return this.data.channel_types;
|
|
8
|
+
}
|
|
9
|
+
get defaultValues() {
|
|
10
|
+
return this.data.default_values;
|
|
9
11
|
}
|
|
10
|
-
channelTypes;
|
|
11
12
|
}
|
|
12
13
|
exports.ChannelSelectMenuComponent = ChannelSelectMenuComponent;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { ComponentType } from '
|
|
2
|
-
import { BaseSelectMenuComponent } from '
|
|
1
|
+
import type { ComponentType } from 'discord-api-types/v10';
|
|
2
|
+
import { BaseSelectMenuComponent } from './BaseSelectMenuComponent';
|
|
3
3
|
export declare class MentionableSelectMenuComponent extends BaseSelectMenuComponent<ComponentType.MentionableSelect> {
|
|
4
|
+
get defaultValues(): import("discord-api-types/v10").APISelectMenuDefaultValue<import("discord-api-types/v10").SelectMenuDefaultValueType.Role | import("discord-api-types/v10").SelectMenuDefaultValueType.User>[] | undefined;
|
|
4
5
|
}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.MentionableSelectMenuComponent = void 0;
|
|
4
|
-
const BaseSelectMenuComponent_1 = require("
|
|
4
|
+
const BaseSelectMenuComponent_1 = require("./BaseSelectMenuComponent");
|
|
5
5
|
class MentionableSelectMenuComponent extends BaseSelectMenuComponent_1.BaseSelectMenuComponent {
|
|
6
|
+
get defaultValues() {
|
|
7
|
+
return this.data.default_values;
|
|
8
|
+
}
|
|
6
9
|
}
|
|
7
10
|
exports.MentionableSelectMenuComponent = MentionableSelectMenuComponent;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { ComponentType } from '
|
|
2
|
-
import { BaseSelectMenuComponent } from '
|
|
1
|
+
import type { ComponentType } from 'discord-api-types/v10';
|
|
2
|
+
import { BaseSelectMenuComponent } from './BaseSelectMenuComponent';
|
|
3
3
|
export declare class RoleSelectMenuComponent extends BaseSelectMenuComponent<ComponentType.RoleSelect> {
|
|
4
|
+
get defaultValues(): import("discord-api-types/v10").APISelectMenuDefaultValue<import("discord-api-types/v10").SelectMenuDefaultValueType.Role>[] | undefined;
|
|
4
5
|
}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.RoleSelectMenuComponent = void 0;
|
|
4
|
-
const BaseSelectMenuComponent_1 = require("
|
|
4
|
+
const BaseSelectMenuComponent_1 = require("./BaseSelectMenuComponent");
|
|
5
5
|
class RoleSelectMenuComponent extends BaseSelectMenuComponent_1.BaseSelectMenuComponent {
|
|
6
|
+
get defaultValues() {
|
|
7
|
+
return this.data.default_values;
|
|
8
|
+
}
|
|
6
9
|
}
|
|
7
10
|
exports.RoleSelectMenuComponent = RoleSelectMenuComponent;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import { BaseSelectMenuComponent } from '
|
|
1
|
+
import type { ComponentType } from 'discord-api-types/v10';
|
|
2
|
+
import { BaseSelectMenuComponent } from './BaseSelectMenuComponent';
|
|
3
3
|
export declare class StringSelectMenuComponent extends BaseSelectMenuComponent<ComponentType.StringSelect> {
|
|
4
|
-
|
|
5
|
-
options: APISelectMenuOption[];
|
|
4
|
+
get options(): import("discord-api-types/v10").APISelectMenuOption[];
|
|
6
5
|
}
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.StringSelectMenuComponent = void 0;
|
|
4
|
-
const BaseSelectMenuComponent_1 = require("
|
|
4
|
+
const BaseSelectMenuComponent_1 = require("./BaseSelectMenuComponent");
|
|
5
5
|
class StringSelectMenuComponent extends BaseSelectMenuComponent_1.BaseSelectMenuComponent {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
this.options = data.options;
|
|
6
|
+
get options() {
|
|
7
|
+
return this.data.options;
|
|
9
8
|
}
|
|
10
|
-
options;
|
|
11
9
|
}
|
|
12
10
|
exports.StringSelectMenuComponent = StringSelectMenuComponent;
|
|
@@ -1,7 +1,12 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import { BaseComponent } from '
|
|
1
|
+
import type { ComponentType } from 'discord-api-types/v10';
|
|
2
|
+
import { BaseComponent } from './BaseComponent';
|
|
3
3
|
export declare class TextInputComponent extends BaseComponent<ComponentType.TextInput> {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
get customId(): string;
|
|
5
|
+
get value(): string | undefined;
|
|
6
|
+
get style(): import("discord-api-types/v10").TextInputStyle;
|
|
7
|
+
get label(): string;
|
|
8
|
+
get max(): number | undefined;
|
|
9
|
+
get min(): number | undefined;
|
|
10
|
+
get required(): boolean | undefined;
|
|
11
|
+
get placeholder(): string | undefined;
|
|
7
12
|
}
|
|
@@ -1,14 +1,31 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TextInputComponent = void 0;
|
|
4
|
-
const BaseComponent_1 = require("
|
|
4
|
+
const BaseComponent_1 = require("./BaseComponent");
|
|
5
5
|
class TextInputComponent extends BaseComponent_1.BaseComponent {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
get customId() {
|
|
7
|
+
return this.data.custom_id;
|
|
8
|
+
}
|
|
9
|
+
get value() {
|
|
10
|
+
return this.data.value;
|
|
11
|
+
}
|
|
12
|
+
get style() {
|
|
13
|
+
return this.data.style;
|
|
14
|
+
}
|
|
15
|
+
get label() {
|
|
16
|
+
return this.data.label;
|
|
17
|
+
}
|
|
18
|
+
get max() {
|
|
19
|
+
return this.data.max_length;
|
|
20
|
+
}
|
|
21
|
+
get min() {
|
|
22
|
+
return this.data.min_length;
|
|
23
|
+
}
|
|
24
|
+
get required() {
|
|
25
|
+
return this.data.required;
|
|
26
|
+
}
|
|
27
|
+
get placeholder() {
|
|
28
|
+
return this.data.placeholder;
|
|
10
29
|
}
|
|
11
|
-
customId;
|
|
12
|
-
value;
|
|
13
30
|
}
|
|
14
31
|
exports.TextInputComponent = TextInputComponent;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { ComponentType } from '
|
|
2
|
-
import { BaseSelectMenuComponent } from '
|
|
1
|
+
import type { ComponentType } from 'discord-api-types/v10';
|
|
2
|
+
import { BaseSelectMenuComponent } from './BaseSelectMenuComponent';
|
|
3
3
|
export declare class UserSelectMenuComponent extends BaseSelectMenuComponent<ComponentType.UserSelect> {
|
|
4
|
+
get defaultValues(): import("discord-api-types/v10").APISelectMenuDefaultValue<import("discord-api-types/v10").SelectMenuDefaultValueType.User>[] | undefined;
|
|
4
5
|
}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.UserSelectMenuComponent = void 0;
|
|
4
|
-
const BaseSelectMenuComponent_1 = require("
|
|
4
|
+
const BaseSelectMenuComponent_1 = require("./BaseSelectMenuComponent");
|
|
5
5
|
class UserSelectMenuComponent extends BaseSelectMenuComponent_1.BaseSelectMenuComponent {
|
|
6
|
+
get defaultValues() {
|
|
7
|
+
return this.data.default_values;
|
|
8
|
+
}
|
|
6
9
|
}
|
|
7
10
|
exports.UserSelectMenuComponent = UserSelectMenuComponent;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
1
|
+
import type { ModalSubmitInteraction } from '../structures';
|
|
2
|
+
import type { ComponentCommandInteractionMap, ComponentContext } from './componentcontext';
|
|
3
3
|
export declare const InteractionCommandType: {
|
|
4
4
|
readonly COMPONENT: 0;
|
|
5
5
|
readonly MODAL: 1;
|
|
@@ -9,9 +9,10 @@ export interface ComponentCommand {
|
|
|
9
9
|
}
|
|
10
10
|
export declare abstract class ComponentCommand {
|
|
11
11
|
type: 0;
|
|
12
|
-
abstract componentType:
|
|
13
|
-
abstract filter(interaction:
|
|
14
|
-
abstract run(interaction:
|
|
12
|
+
abstract componentType: keyof ComponentCommandInteractionMap;
|
|
13
|
+
abstract filter(interaction: ComponentContext<typeof this.componentType>): Promise<boolean> | boolean;
|
|
14
|
+
abstract run(interaction: ComponentContext<typeof this.componentType>): any;
|
|
15
|
+
get cType(): number;
|
|
15
16
|
}
|
|
16
17
|
export interface ModalCommand {
|
|
17
18
|
__filePath?: string;
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ModalCommand = exports.ComponentCommand = exports.InteractionCommandType = void 0;
|
|
4
|
+
const v10_1 = require("discord-api-types/v10");
|
|
4
5
|
exports.InteractionCommandType = {
|
|
5
6
|
COMPONENT: 0,
|
|
6
7
|
MODAL: 1,
|
|
7
8
|
};
|
|
8
9
|
class ComponentCommand {
|
|
9
10
|
type = exports.InteractionCommandType.COMPONENT;
|
|
11
|
+
get cType() {
|
|
12
|
+
return v10_1.ComponentType[this.componentType];
|
|
13
|
+
}
|
|
10
14
|
}
|
|
11
15
|
exports.ComponentCommand = ComponentCommand;
|
|
12
16
|
class ModalCommand {
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { AllChannels, ButtonInteraction, ChannelSelectMenuInteraction, ComponentInteraction, Guild, GuildMember, MentionableSelectMenuInteraction, Message, ReturnCache, RoleSelectMenuInteraction, StringSelectMenuInteraction, UserSelectMenuInteraction, WebhookMessage } from '..';
|
|
2
|
+
import type { ExtendContext, UsingClient } from '../commands';
|
|
3
|
+
import { BaseContext } from '../commands/basecontex';
|
|
4
|
+
import type { InteractionCreateBodyRequest, InteractionMessageUpdateBodyRequest, When } from '../common';
|
|
5
|
+
export interface ComponentContext<Type extends keyof ComponentCommandInteractionMap> extends BaseContext, ExtendContext {
|
|
6
|
+
}
|
|
7
|
+
export declare class ComponentContext<Type extends keyof ComponentCommandInteractionMap> extends BaseContext {
|
|
8
|
+
readonly client: UsingClient;
|
|
9
|
+
interaction: ComponentCommandInteractionMap[Type] | ComponentInteraction;
|
|
10
|
+
constructor(client: UsingClient, interaction: ComponentCommandInteractionMap[Type] | ComponentInteraction);
|
|
11
|
+
get proxy(): import("..").APIRoutes;
|
|
12
|
+
get t(): import("..").__InternalParseLocale<import("..").DefaultLocale> & {
|
|
13
|
+
get(locale?: string | undefined): import("..").DefaultLocale;
|
|
14
|
+
};
|
|
15
|
+
get customId(): string;
|
|
16
|
+
get write(): <FR extends boolean = false>(body: Omit<import("discord-api-types/v10").APIInteractionResponseCallbackData, "components" | "embeds"> & import("../common").ResolverProps, fetchReply?: FR | undefined) => Promise<When<FR, WebhookMessage, void>>;
|
|
17
|
+
deferReply(ephemeral?: boolean): Promise<void>;
|
|
18
|
+
get editResponse(): ((body: Omit<import("discord-api-types/v10").RESTPatchAPIWebhookWithTokenMessageJSONBody, "components" | "embeds"> & import("../common").ResolverProps) => Promise<Message>) | ((body: Omit<import("discord-api-types/v10").RESTPatchAPIWebhookWithTokenMessageJSONBody, "components" | "embeds"> & import("../common").ResolverProps) => Promise<Message>) | ((body: Omit<import("discord-api-types/v10").RESTPatchAPIWebhookWithTokenMessageJSONBody, "components" | "embeds"> & import("../common").ResolverProps) => Promise<Message>) | ((body: Omit<import("discord-api-types/v10").RESTPatchAPIWebhookWithTokenMessageJSONBody, "components" | "embeds"> & import("../common").ResolverProps) => Promise<Message>) | ((body: Omit<import("discord-api-types/v10").RESTPatchAPIWebhookWithTokenMessageJSONBody, "components" | "embeds"> & import("../common").ResolverProps) => Promise<Message>) | ((body: Omit<import("discord-api-types/v10").RESTPatchAPIWebhookWithTokenMessageJSONBody, "components" | "embeds"> & import("../common").ResolverProps) => Promise<Message>) | ((body: Omit<import("discord-api-types/v10").RESTPatchAPIWebhookWithTokenMessageJSONBody, "components" | "embeds"> & import("../common").ResolverProps) => Promise<Message>);
|
|
19
|
+
get update(): ((data: Omit<import("discord-api-types/v10").APIInteractionResponseCallbackData, "components" | "embeds"> & import("../common").ResolverProps) => Promise<void>) | ((data: Omit<import("discord-api-types/v10").APIInteractionResponseCallbackData, "components" | "embeds"> & import("../common").ResolverProps) => Promise<void>) | ((data: Omit<import("discord-api-types/v10").APIInteractionResponseCallbackData, "components" | "embeds"> & import("../common").ResolverProps) => Promise<void>) | ((data: Omit<import("discord-api-types/v10").APIInteractionResponseCallbackData, "components" | "embeds"> & import("../common").ResolverProps) => Promise<void>) | ((data: Omit<import("discord-api-types/v10").APIInteractionResponseCallbackData, "components" | "embeds"> & import("../common").ResolverProps) => Promise<void>) | ((data: Omit<import("discord-api-types/v10").APIInteractionResponseCallbackData, "components" | "embeds"> & import("../common").ResolverProps) => Promise<void>) | ((data: Omit<import("discord-api-types/v10").APIInteractionResponseCallbackData, "components" | "embeds"> & import("../common").ResolverProps) => Promise<void>);
|
|
20
|
+
editOrReply<FR extends boolean = false>(body: InteractionCreateBodyRequest | InteractionMessageUpdateBodyRequest, fetchReply?: FR): Promise<When<FR, WebhookMessage | Message, void | WebhookMessage | Message>>;
|
|
21
|
+
deleteResponse(): Promise<void | undefined>;
|
|
22
|
+
channel(mode?: 'rest' | 'flow'): Promise<AllChannels>;
|
|
23
|
+
channel(mode?: 'cache'): ReturnCache<AllChannels>;
|
|
24
|
+
me(mode?: 'rest' | 'flow'): Promise<GuildMember>;
|
|
25
|
+
me(mode?: 'cache'): ReturnCache<GuildMember | undefined>;
|
|
26
|
+
guild(mode?: 'rest' | 'flow'): Promise<Guild<'cached' | 'api'> | undefined>;
|
|
27
|
+
guild(mode?: 'cache'): ReturnCache<Guild<'cached'> | undefined>;
|
|
28
|
+
get guildId(): string | undefined;
|
|
29
|
+
get channelId(): string;
|
|
30
|
+
get author(): import("..").User;
|
|
31
|
+
get member(): import("..").InteractionGuildMember | undefined;
|
|
32
|
+
}
|
|
33
|
+
export interface ComponentCommandInteractionMap {
|
|
34
|
+
ActionRow: never;
|
|
35
|
+
Button: ButtonInteraction;
|
|
36
|
+
StringSelect: StringSelectMenuInteraction;
|
|
37
|
+
TextInput: never;
|
|
38
|
+
UserSelect: UserSelectMenuInteraction;
|
|
39
|
+
RoleSelect: RoleSelectMenuInteraction;
|
|
40
|
+
MentionableSelect: MentionableSelectMenuInteraction;
|
|
41
|
+
ChannelSelect: ChannelSelectMenuInteraction;
|
|
42
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ComponentContext = void 0;
|
|
4
|
+
const v10_1 = require("discord-api-types/v10");
|
|
5
|
+
const basecontex_1 = require("../commands/basecontex");
|
|
6
|
+
class ComponentContext extends basecontex_1.BaseContext {
|
|
7
|
+
client;
|
|
8
|
+
interaction;
|
|
9
|
+
constructor(client, interaction) {
|
|
10
|
+
super(client);
|
|
11
|
+
this.client = client;
|
|
12
|
+
this.interaction = interaction;
|
|
13
|
+
}
|
|
14
|
+
get proxy() {
|
|
15
|
+
return this.client.proxy;
|
|
16
|
+
}
|
|
17
|
+
get t() {
|
|
18
|
+
return this.client.langs.get(this.interaction?.locale ?? this.client.langs?.defaultLang ?? 'en-US');
|
|
19
|
+
}
|
|
20
|
+
get customId() {
|
|
21
|
+
return this.interaction.customId;
|
|
22
|
+
}
|
|
23
|
+
get write() {
|
|
24
|
+
return this.interaction.write;
|
|
25
|
+
}
|
|
26
|
+
deferReply(ephemeral = false) {
|
|
27
|
+
return this.interaction.deferReply(ephemeral ? v10_1.MessageFlags.Ephemeral : undefined);
|
|
28
|
+
}
|
|
29
|
+
get editResponse() {
|
|
30
|
+
return this.interaction.editResponse;
|
|
31
|
+
}
|
|
32
|
+
get update() {
|
|
33
|
+
return this.interaction.update;
|
|
34
|
+
}
|
|
35
|
+
editOrReply(body, fetchReply) {
|
|
36
|
+
return this.interaction.editOrReply(body, fetchReply);
|
|
37
|
+
}
|
|
38
|
+
deleteResponse() {
|
|
39
|
+
return this.interaction.deleteResponse();
|
|
40
|
+
}
|
|
41
|
+
channel(mode = 'cache') {
|
|
42
|
+
if (this.interaction?.channel && mode === 'cache')
|
|
43
|
+
return this.client.cache.adapter.isAsync ? Promise.resolve(this.interaction.channel) : this.interaction.channel;
|
|
44
|
+
return this.client.channels.fetch(this.channelId, mode === 'rest');
|
|
45
|
+
}
|
|
46
|
+
me(mode = 'cache') {
|
|
47
|
+
if (!this.guildId)
|
|
48
|
+
return mode === 'cache' ? (this.client.cache.adapter.isAsync ? Promise.resolve() : undefined) : Promise.resolve();
|
|
49
|
+
switch (mode) {
|
|
50
|
+
case 'cache':
|
|
51
|
+
return this.client.cache.members?.get(this.client.botId, this.guildId);
|
|
52
|
+
default:
|
|
53
|
+
return this.client.members.fetch(this.guildId, this.client.botId, mode === 'rest');
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
guild(mode = 'cache') {
|
|
57
|
+
if (!this.guildId)
|
|
58
|
+
return (mode === 'cache' ? (this.client.cache.adapter.isAsync ? Promise.resolve() : undefined) : Promise.resolve());
|
|
59
|
+
switch (mode) {
|
|
60
|
+
case 'cache':
|
|
61
|
+
return this.client.cache.guilds?.get(this.guildId);
|
|
62
|
+
default:
|
|
63
|
+
return this.client.guilds.fetch(this.guildId, mode === 'rest');
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
get guildId() {
|
|
67
|
+
return this.interaction.guildId;
|
|
68
|
+
}
|
|
69
|
+
get channelId() {
|
|
70
|
+
return this.interaction.channelId;
|
|
71
|
+
}
|
|
72
|
+
get author() {
|
|
73
|
+
return this.interaction.user;
|
|
74
|
+
}
|
|
75
|
+
get member() {
|
|
76
|
+
return this.interaction.member;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
exports.ComponentContext = ComponentContext;
|
|
@@ -3,7 +3,7 @@ import type { ComponentCallback, ListenerOptions, ModalSubmitCallback } from '..
|
|
|
3
3
|
import { LimitedCollection } from '../collection';
|
|
4
4
|
import type { UsingClient } from '../commands';
|
|
5
5
|
import { BaseHandler, type Logger, type OnFailCallback } from '../common';
|
|
6
|
-
import type { ComponentInteraction, ModalSubmitInteraction } from '../structures';
|
|
6
|
+
import type { ComponentInteraction, ModalSubmitInteraction, StringSelectMenuInteraction } from '../structures';
|
|
7
7
|
import { ComponentCommand, ModalCommand } from './command';
|
|
8
8
|
type COMPONENTS = {
|
|
9
9
|
components: {
|
|
@@ -16,21 +16,37 @@ type COMPONENTS = {
|
|
|
16
16
|
timeout?: NodeJS.Timeout;
|
|
17
17
|
__run: (customId: string | string[] | RegExp, callback: ComponentCallback) => any;
|
|
18
18
|
};
|
|
19
|
+
export interface ComponentHandlerLike {
|
|
20
|
+
readonly values: Map<string, COMPONENTS>;
|
|
21
|
+
readonly commands: (ComponentCommand | ModalCommand)[];
|
|
22
|
+
readonly modals: Map<string, ModalSubmitCallback> | LimitedCollection<string, ModalSubmitCallback>;
|
|
23
|
+
onFail: ComponentHandler['onFail'];
|
|
24
|
+
createComponentCollector: ComponentHandler['createComponentCollector'];
|
|
25
|
+
hasModal: ComponentHandler['hasModal'];
|
|
26
|
+
onModalSubmit: ComponentHandler['onModalSubmit'];
|
|
27
|
+
executeModal: ComponentHandler['executeModal'];
|
|
28
|
+
hasComponent: ComponentHandler['hasComponent'];
|
|
29
|
+
executeComponent: ComponentHandler['executeComponent'];
|
|
30
|
+
onComponent: ComponentHandler['onComponent'];
|
|
31
|
+
load: ComponentHandler['load'];
|
|
32
|
+
reload: ComponentHandler['reload'];
|
|
33
|
+
reloadAll: ComponentHandler['reloadAll'];
|
|
34
|
+
onMessageDelete: ComponentHandler['onMessageDelete'];
|
|
35
|
+
}
|
|
19
36
|
export declare class ComponentHandler extends BaseHandler {
|
|
20
37
|
protected client: UsingClient;
|
|
21
|
-
|
|
38
|
+
onFail: OnFailCallback;
|
|
22
39
|
readonly values: Map<string, COMPONENTS>;
|
|
23
40
|
readonly modals: LimitedCollection<string, ModalSubmitCallback>;
|
|
24
41
|
readonly commands: (ComponentCommand | ModalCommand)[];
|
|
25
42
|
protected filter: (path: string) => boolean;
|
|
26
43
|
constructor(logger: Logger, client: UsingClient);
|
|
27
|
-
set OnFail(cb: OnFailCallback);
|
|
28
44
|
createComponentCollector(messageId: string, options?: ListenerOptions): {
|
|
29
|
-
run
|
|
30
|
-
stop
|
|
45
|
+
run<T extends ComponentInteraction | StringSelectMenuInteraction = ComponentInteraction | StringSelectMenuInteraction>(customId: string | string[] | RegExp, callback: ComponentCallback<T>): any;
|
|
46
|
+
stop(reason?: string): any;
|
|
31
47
|
};
|
|
32
48
|
onComponent(id: string, interaction: ComponentInteraction): Promise<void>;
|
|
33
|
-
hasComponent(id: string, customId: string): boolean
|
|
49
|
+
hasComponent(id: string, customId: string): boolean;
|
|
34
50
|
resetTimeouts(id: string): void;
|
|
35
51
|
hasModal(interaction: ModalSubmitInteraction): boolean;
|
|
36
52
|
onModalSubmit(interaction: ModalSubmitInteraction): any;
|
|
@@ -4,9 +4,10 @@ exports.ComponentHandler = void 0;
|
|
|
4
4
|
const collection_1 = require("../collection");
|
|
5
5
|
const common_1 = require("../common");
|
|
6
6
|
const command_1 = require("./command");
|
|
7
|
+
const componentcontext_1 = require("./componentcontext");
|
|
7
8
|
class ComponentHandler extends common_1.BaseHandler {
|
|
8
9
|
client;
|
|
9
|
-
onFail;
|
|
10
|
+
onFail = err => this.logger.warn('<Client>.components.onFail', err);
|
|
10
11
|
values = new Map();
|
|
11
12
|
// 10 minutes timeout, because discord dont send an event when the user cancel the modal
|
|
12
13
|
modals = new collection_1.LimitedCollection({ expire: 60e3 * 10 });
|
|
@@ -16,9 +17,6 @@ class ComponentHandler extends common_1.BaseHandler {
|
|
|
16
17
|
super(logger);
|
|
17
18
|
this.client = client;
|
|
18
19
|
}
|
|
19
|
-
set OnFail(cb) {
|
|
20
|
-
this.onFail = cb;
|
|
21
|
-
}
|
|
22
20
|
createComponentCollector(messageId, options = {}) {
|
|
23
21
|
this.values.set(messageId, {
|
|
24
22
|
components: [],
|
|
@@ -49,6 +47,7 @@ class ComponentHandler extends common_1.BaseHandler {
|
|
|
49
47
|
},
|
|
50
48
|
});
|
|
51
49
|
return {
|
|
50
|
+
//@ts-expect-error generic
|
|
52
51
|
run: this.values.get(messageId).__run,
|
|
53
52
|
stop: (reason) => {
|
|
54
53
|
this.deleteValue(messageId);
|
|
@@ -82,13 +81,13 @@ class ComponentHandler extends common_1.BaseHandler {
|
|
|
82
81
|
});
|
|
83
82
|
}
|
|
84
83
|
hasComponent(id, customId) {
|
|
85
|
-
return this.values.get(id)?.components?.some(x => {
|
|
84
|
+
return (this.values.get(id)?.components?.some(x => {
|
|
86
85
|
if (typeof x.match === 'string')
|
|
87
86
|
return x.match === customId;
|
|
88
87
|
if (Array.isArray(x.match))
|
|
89
88
|
return x.match.includes(customId);
|
|
90
89
|
return customId.match(x.match);
|
|
91
|
-
});
|
|
90
|
+
}) ?? false);
|
|
92
91
|
}
|
|
93
92
|
resetTimeouts(id) {
|
|
94
93
|
const listener = this.values.get(id);
|
|
@@ -139,9 +138,12 @@ class ComponentHandler extends common_1.BaseHandler {
|
|
|
139
138
|
continue;
|
|
140
139
|
component.__filePath = paths[i].path;
|
|
141
140
|
this.commands.push(component);
|
|
141
|
+
await this.__callback?.(component);
|
|
142
142
|
}
|
|
143
143
|
}
|
|
144
144
|
async reload(path) {
|
|
145
|
+
if (!this.client.components)
|
|
146
|
+
return;
|
|
145
147
|
const component = this.client.components.commands.find(x => x.__filePath?.endsWith(`${path}.js`) ||
|
|
146
148
|
x.__filePath?.endsWith(`${path}.ts`) ||
|
|
147
149
|
x.__filePath?.endsWith(path) ||
|
|
@@ -160,6 +162,8 @@ class ComponentHandler extends common_1.BaseHandler {
|
|
|
160
162
|
return imported;
|
|
161
163
|
}
|
|
162
164
|
async reloadAll() {
|
|
165
|
+
if (!this.client.components)
|
|
166
|
+
return;
|
|
163
167
|
for (const i of this.client.components.commands) {
|
|
164
168
|
if (!i.__filePath)
|
|
165
169
|
return this.logger.warn('Unknown command dont have __filePath property', i);
|
|
@@ -169,15 +173,18 @@ class ComponentHandler extends common_1.BaseHandler {
|
|
|
169
173
|
async executeComponent(interaction) {
|
|
170
174
|
for (const i of this.commands) {
|
|
171
175
|
try {
|
|
172
|
-
if (i.type === command_1.InteractionCommandType.COMPONENT &&
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
+
if (i.type === command_1.InteractionCommandType.COMPONENT && i.cType === interaction.componentType) {
|
|
177
|
+
const context = new componentcontext_1.ComponentContext(this.client, interaction);
|
|
178
|
+
const extended = this.client.options?.context?.(interaction) ?? {};
|
|
179
|
+
Object.assign(context, extended);
|
|
180
|
+
if (!(await i.filter(context)))
|
|
181
|
+
continue;
|
|
182
|
+
await i.run(context);
|
|
176
183
|
break;
|
|
177
184
|
}
|
|
178
185
|
}
|
|
179
186
|
catch (e) {
|
|
180
|
-
await this.onFail
|
|
187
|
+
await this.onFail(e);
|
|
181
188
|
}
|
|
182
189
|
}
|
|
183
190
|
}
|
|
@@ -190,7 +197,7 @@ class ComponentHandler extends common_1.BaseHandler {
|
|
|
190
197
|
}
|
|
191
198
|
}
|
|
192
199
|
catch (e) {
|
|
193
|
-
await this.onFail
|
|
200
|
+
await this.onFail(e);
|
|
194
201
|
}
|
|
195
202
|
}
|
|
196
203
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import { BaseComponent } from '
|
|
1
|
+
import { type APIMessageActionRowComponent } from 'discord-api-types/v10';
|
|
2
|
+
import { BaseComponent } from './BaseComponent';
|
|
3
3
|
import { ButtonComponent, LinkButtonComponent } from './ButtonComponent';
|
|
4
4
|
import { ChannelSelectMenuComponent } from './ChannelSelectMenuComponent';
|
|
5
5
|
import { MentionableSelectMenuComponent } from './MentionableSelectMenuComponent';
|