@seedcord/core 0.2.1 → 0.3.1
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/dist/{Bus-DcuUtOEL.mjs → Bus-BvF4VShN.mjs} +17 -2
- package/dist/Bus-BvF4VShN.mjs.map +1 -0
- package/dist/Plugin-CQ9IEj5X.d.mts +193 -0
- package/dist/{Plugin-Bkeqcjy6.mjs → Plugin-D9ykXA5g.mjs} +26 -5
- package/dist/Plugin-D9ykXA5g.mjs.map +1 -0
- package/dist/{cursor-0Dpi07Sj.d.mts → cursor-BANzac53.d.mts} +56 -92
- package/dist/{cursor-BRyCNqRV.mjs → cursor-CuoA9cRh.mjs} +5 -152
- package/dist/cursor-CuoA9cRh.mjs.map +1 -0
- package/dist/{index-uBwh8r7x.d.mts → index-rt8rZg4d.d.mts} +2 -2
- package/dist/index.d.mts +96 -23
- package/dist/index.mjs +37 -17
- package/dist/index.mjs.map +1 -1
- package/dist/internal.index.d.mts +9 -8
- package/dist/internal.index.mjs +4 -3
- package/dist/internal.index.mjs.map +1 -1
- package/dist/node-internal.index.d.mts +22 -31
- package/dist/node-internal.index.mjs +61 -31
- package/dist/node-internal.index.mjs.map +1 -1
- package/dist/{Plugin-B6iRzm3g.d.mts → phases-hBxMCD2V.d.mts} +14 -142
- package/dist/plugin.index.d.mts +2 -2
- package/dist/plugin.index.mjs +1 -1
- package/dist/subscribers-wnMyNYZd.mjs +139 -0
- package/dist/subscribers-wnMyNYZd.mjs.map +1 -0
- package/package.json +4 -4
- package/dist/Bus-DcuUtOEL.mjs.map +0 -1
- package/dist/Plugin-Bkeqcjy6.mjs.map +0 -1
- package/dist/cursor-BRyCNqRV.mjs.map +0 -1
- package/dist/subscribers-DuHg-bGT.mjs +0 -3
package/dist/index.d.mts
CHANGED
|
@@ -1,36 +1,93 @@
|
|
|
1
|
-
import { $ as
|
|
1
|
+
import { $ as RegisterCommand, B as SelectMenuKind, C as Gate, D as defineEffectGate, E as RequiredOf, F as ComponentKindBrand, I as ContextMenuKindBrand, J as CustomId, L as ContextMenuNamesBrand, N as AutocompleteRouteBrand, O as defineGate, P as ComponentDefsBrand, R as SlashRouteBrand, S as EffectGate, T as GuildPermissionsContext, a as AutocompleteOptions, at as RowType, b as JoinNames, d as RequirePermissionsOptions, et as Promisable, f as RequireRole, ft as ContextMenuKind, g as GateNoticeOptions, gt as UserContextMenuRegistry, h as PermissionScope, ht as NamesFor, it as BuilderType, k as BaseReplySender, l as RequireBotPermissions, mt as MessageContextMenuRegistry, n as PageCursor, nt as BuilderComponent, p as RequireRoleOptions, q as AnyCustomId, rt as RowComponent, u as RequirePermissions, ut as SlashRegistry, w as GateContextBase, x as TwoOrMore, y as IntersectRequired } from "./cursor-BANzac53.mjs";
|
|
2
2
|
import { t as Constructor } from "./basic-Dng__Ena.mjs";
|
|
3
|
-
import {
|
|
4
|
-
import { a as Subscribe, i as WebhookFile, n as WebhookLog, o as SubscribeOptions, r as WebhookReport, t as WebhookUrl } from "./index-
|
|
3
|
+
import { c as Subscriber, d as FaultSource, f as SubscriptionData, h as Notice, i as Bus, m as Subscriptions, n as StartupPhase, p as SubscriptionKey, r as CoreBase, t as ShutdownPhase, u as DispatchOutcome } from "./phases-hBxMCD2V.mjs";
|
|
4
|
+
import { a as Subscribe, i as WebhookFile, n as WebhookLog, o as SubscribeOptions, r as WebhookReport, t as WebhookUrl } from "./index-rt8rZg4d.mjs";
|
|
5
5
|
import "reflect-metadata";
|
|
6
6
|
import { ActionRowBuilder, ButtonBuilder } from "@discordjs/builders";
|
|
7
7
|
import { Logger } from "@seedcord/logger";
|
|
8
8
|
import { APIMessageComponentEmoji, ApplicationCommandType, ButtonStyle } from "discord-api-types/v10";
|
|
9
9
|
import { ValidDuration } from "@seedcord/utils";
|
|
10
10
|
import { DeferOpts, EpochMs, LoggerChannelId, RenderContext, ReplyResponse, SendOpts, V2Component } from "@seedcord/types";
|
|
11
|
+
//#region src/commands/CommandInjector.d.ts
|
|
12
|
+
/** What {@link Commands} resolves to for one slash route. */
|
|
13
|
+
interface CommandInfo {
|
|
14
|
+
/** The clickable `</config set:id>` mention. A route whose id did not resolve falls back to `/config set`. */
|
|
15
|
+
readonly mention: string;
|
|
16
|
+
/** The deployed command id. Absent when the command deployed to two or more guilds. */
|
|
17
|
+
readonly id?: string;
|
|
18
|
+
/** The full route, e.g. `config/set`. */
|
|
19
|
+
readonly route: string;
|
|
20
|
+
/** The route's own description, taken from the subcommand for a nested route. */
|
|
21
|
+
readonly description: string;
|
|
22
|
+
}
|
|
23
|
+
/** Each registered slash route mapped to its deployed command. */
|
|
24
|
+
type InjectedCommandMap = { [K in keyof SlashRegistry]: CommandInfo; };
|
|
25
|
+
/**
|
|
26
|
+
* The bot's deployed slash commands, keyed by {@link SlashRegistry}. Filled by
|
|
27
|
+
* {@link CommandInjector} after each deploy, and a read before that throws.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```ts
|
|
31
|
+
* import { Commands } from '@seedcord/gateway';
|
|
32
|
+
*
|
|
33
|
+
* await this.reply(`Try ${Commands['config/set'].mention}`);
|
|
34
|
+
*
|
|
35
|
+
* // a help listing
|
|
36
|
+
* const lines = Object.values(Commands).map((c) => `${c.mention} ${c.description}`);
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
declare const Commands: InjectedCommandMap;
|
|
40
|
+
/** What {@link ContextMenus} resolves to for one context-menu command. */
|
|
41
|
+
interface ContextMenuInfo {
|
|
42
|
+
/** The deployed command id. Absent when the command deployed to two or more guilds. */
|
|
43
|
+
readonly id?: string;
|
|
44
|
+
/** The name shown in Discord's right-click menu. */
|
|
45
|
+
readonly name: string;
|
|
46
|
+
readonly kind: ContextMenuKind;
|
|
47
|
+
}
|
|
48
|
+
/** Deployed context-menu commands, split by kind because Discord scopes name uniqueness per command type. */
|
|
49
|
+
interface InjectedContextMenuMap {
|
|
50
|
+
readonly user: { [K in keyof UserContextMenuRegistry]: ContextMenuInfo; };
|
|
51
|
+
readonly message: { [K in keyof MessageContextMenuRegistry]: ContextMenuInfo; };
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* The bot's deployed context-menu commands. Filled by {@link CommandInjector} after each deploy, and a read
|
|
55
|
+
* before that throws.
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* ```ts
|
|
59
|
+
* import { ContextMenus } from '@seedcord/gateway';
|
|
60
|
+
*
|
|
61
|
+
* const id = ContextMenus.user['View Profile'].id;
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
64
|
+
declare const ContextMenus: InjectedContextMenuMap;
|
|
65
|
+
//#endregion
|
|
11
66
|
//#region src/decorators/routes.d.ts
|
|
12
67
|
type ComponentBrand = 'button' | 'modal' | SelectMenuKind;
|
|
13
68
|
type AnyHandlerCtor = new (...args: any[]) => unknown;
|
|
14
69
|
type SlashRouteOf<TCtor extends AnyHandlerCtor> = InstanceType<TCtor> extends {
|
|
15
|
-
[SlashRouteBrand]?: infer Route extends keyof
|
|
70
|
+
[SlashRouteBrand]?: infer Route extends keyof SlashRegistry;
|
|
16
71
|
} ? Route : never;
|
|
17
72
|
type AutocompleteRouteOf<TCtor extends AnyHandlerCtor> = InstanceType<TCtor> extends {
|
|
18
|
-
[AutocompleteRouteBrand]?: infer Route extends keyof
|
|
73
|
+
[AutocompleteRouteBrand]?: infer Route extends keyof SlashRegistry;
|
|
19
74
|
} ? Route : never;
|
|
20
75
|
type ContextMenuKindOf<TCtor extends AnyHandlerCtor> = InstanceType<TCtor> extends {
|
|
21
76
|
[ContextMenuKindBrand]?: infer Kind extends ContextMenuKind;
|
|
22
77
|
} ? Kind : never;
|
|
78
|
+
type ContextMenuNamesOf<TCtor extends AnyHandlerCtor> = InstanceType<TCtor> extends {
|
|
79
|
+
[ContextMenuNamesBrand]?: infer Names;
|
|
80
|
+
} ? Names : never;
|
|
23
81
|
type ComponentOf<TCtor extends AnyHandlerCtor> = InstanceType<TCtor> extends {
|
|
24
82
|
[ComponentKindBrand]?: infer Brand extends ComponentBrand;
|
|
25
83
|
} ? Brand : never;
|
|
26
84
|
type DefsOf<TCtor extends AnyHandlerCtor> = InstanceType<TCtor> extends {
|
|
27
85
|
[ComponentDefsBrand]?: infer Defs extends readonly AnyCustomId[];
|
|
28
86
|
} ? Defs : never;
|
|
29
|
-
type AssertSlashRoute<Route extends keyof
|
|
30
|
-
type AssertAutocompleteRoute<Route extends keyof
|
|
31
|
-
type AssertContextMenuRoute<Kind extends ContextMenuKind, TCtor extends AnyHandlerCtor> = [Kind] extends [ContextMenuKindOf<TCtor>] ? [ContextMenuKindOf<TCtor>] extends [Kind] ? TCtor : Constructor<['ContextMenuHandler declares a kind the ContextMenuRoute decorator does not match', ContextMenuKindOf<TCtor>]> : Constructor<['ContextMenuRoute does not match the ContextMenuHandler generic', Kind]>;
|
|
87
|
+
type AssertSlashRoute<Route extends keyof SlashRegistry, TCtor extends AnyHandlerCtor> = [Route] extends [SlashRouteOf<TCtor>] ? [SlashRouteOf<TCtor>] extends [Route] ? TCtor : Constructor<['SlashHandler declares a route the SlashRoute decorator does not list', SlashRouteOf<TCtor>]> : Constructor<['SlashRoute does not match the SlashHandler generic', Route]>;
|
|
88
|
+
type AssertAutocompleteRoute<Route extends keyof SlashRegistry, TCtor extends AnyHandlerCtor> = [Route] extends [AutocompleteRouteOf<TCtor>] ? [AutocompleteRouteOf<TCtor>] extends [Route] ? TCtor : Constructor<['AutocompleteHandler declares a command the AutocompleteRoute decorator does not list', AutocompleteRouteOf<TCtor>]> : Constructor<['AutocompleteRoute does not match the AutocompleteHandler generic', Route]>;
|
|
89
|
+
type AssertContextMenuRoute<Kind extends ContextMenuKind, Names extends NamesFor<Kind>, TCtor extends AnyHandlerCtor> = [Kind] extends [ContextMenuKindOf<TCtor>] ? [ContextMenuKindOf<TCtor>] extends [Kind] ? [Names] extends [ContextMenuNamesOf<TCtor>] ? [ContextMenuNamesOf<TCtor>] extends [Names] ? TCtor : Constructor<['ContextMenuHandler declares a name the ContextMenuRoute decorator does not list', ContextMenuNamesOf<TCtor>]> : Constructor<['ContextMenuRoute lists a name the ContextMenuHandler generic does not declare', Names]> : Constructor<['ContextMenuHandler declares a kind the ContextMenuRoute decorator does not match', ContextMenuKindOf<TCtor>]> : Constructor<['ContextMenuRoute does not match the ContextMenuHandler generic', Kind]>;
|
|
32
90
|
type AssertComponentRoute<Brand extends ComponentBrand, Defs extends readonly AnyCustomId[], TCtor extends AnyHandlerCtor> = [ComponentOf<TCtor>] extends [Brand] ? [Brand] extends [ComponentOf<TCtor>] ? [DefsOf<TCtor>] extends [Defs] ? TCtor : Constructor<['the customId definitions do not match the handler generic', DefsOf<TCtor>]> : Constructor<['the decorator does not match the handler kind', ComponentOf<TCtor>]> : Constructor<['the decorator does not match the handler kind', ComponentOf<TCtor>]>;
|
|
33
|
-
type NamesFor<Kind extends ContextMenuKind> = Kind extends ApplicationCommandType.User ? keyof UserContextMenuRegistry : keyof MessageContextMenuRegistry;
|
|
34
91
|
/**
|
|
35
92
|
* Routes one or more slash commands to a `SlashHandler`.
|
|
36
93
|
*
|
|
@@ -50,7 +107,7 @@ type NamesFor<Kind extends ContextMenuKind> = Kind extends ApplicationCommandTyp
|
|
|
50
107
|
* }
|
|
51
108
|
* ```
|
|
52
109
|
*/
|
|
53
|
-
declare function SlashRoute<const Route extends keyof
|
|
110
|
+
declare function SlashRoute<const Route extends keyof SlashRegistry>(...routes: Route[]): <TCtor extends AnyHandlerCtor>(constructor: AssertSlashRoute<Route, TCtor>) => void;
|
|
54
111
|
/**
|
|
55
112
|
* Routes one or more commands' autocomplete to an `AutocompleteHandler`.
|
|
56
113
|
*
|
|
@@ -71,29 +128,45 @@ declare function SlashRoute<const Route extends keyof SlashOptionRegistry>(...ro
|
|
|
71
128
|
* }
|
|
72
129
|
* ```
|
|
73
130
|
*/
|
|
74
|
-
declare function AutocompleteRoute<const Route extends keyof
|
|
131
|
+
declare function AutocompleteRoute<const Route extends keyof SlashRegistry>(...routes: Route[]): <TCtor extends AnyHandlerCtor>(constructor: AssertAutocompleteRoute<Route, TCtor>) => void;
|
|
75
132
|
/**
|
|
76
|
-
* Routes one or more context-menu commands to a `
|
|
133
|
+
* Routes one or more user context-menu commands to a `UserContextMenuHandler`.
|
|
77
134
|
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
* declare the same kind, cross-checked both directions. Context menus carry no options, so a multi-name
|
|
81
|
-
* handler reads `this.target` uniformly with no branch.
|
|
135
|
+
* Every name is checked against the user registry. The handler's generic must declare the same names,
|
|
136
|
+
* checked in both directions.
|
|
82
137
|
*
|
|
83
|
-
* @param
|
|
84
|
-
* @param names - The command name(s) this handler serves, keyed off the matching registry.
|
|
138
|
+
* @param names - The command name(s) this handler serves.
|
|
85
139
|
* @decorator
|
|
86
140
|
* @example
|
|
87
141
|
* ```ts
|
|
88
|
-
* \@
|
|
89
|
-
* class ViewProfile extends
|
|
142
|
+
* \@UserContextMenuRoute('View Profile')
|
|
143
|
+
* class ViewProfile extends UserContextMenuHandler<'View Profile'> {
|
|
90
144
|
* async execute() {
|
|
91
145
|
* const user = this.target;
|
|
92
146
|
* }
|
|
93
147
|
* }
|
|
94
148
|
* ```
|
|
95
149
|
*/
|
|
96
|
-
declare function
|
|
150
|
+
declare function UserContextMenuRoute<const Names extends NamesFor<ApplicationCommandType.User>>(...names: Names[]): <TCtor extends AnyHandlerCtor>(constructor: AssertContextMenuRoute<ApplicationCommandType.User, Names, TCtor>) => void;
|
|
151
|
+
/**
|
|
152
|
+
* Routes one or more message context-menu commands to a `MessageContextMenuHandler`.
|
|
153
|
+
*
|
|
154
|
+
* Every name is checked against the message registry. The handler's generic must declare the same names,
|
|
155
|
+
* checked in both directions.
|
|
156
|
+
*
|
|
157
|
+
* @param names - The command name(s) this handler serves.
|
|
158
|
+
* @decorator
|
|
159
|
+
* @example
|
|
160
|
+
* ```ts
|
|
161
|
+
* \@MessageContextMenuRoute('Report Message')
|
|
162
|
+
* class ReportMessage extends MessageContextMenuHandler<'Report Message'> {
|
|
163
|
+
* async execute() {
|
|
164
|
+
* const message = this.target;
|
|
165
|
+
* }
|
|
166
|
+
* }
|
|
167
|
+
* ```
|
|
168
|
+
*/
|
|
169
|
+
declare function MessageContextMenuRoute<const Names extends NamesFor<ApplicationCommandType.Message>>(...names: Names[]): <TCtor extends AnyHandlerCtor>(constructor: AssertContextMenuRoute<ApplicationCommandType.Message, Names, TCtor>) => void;
|
|
97
170
|
/**
|
|
98
171
|
* Routes button interactions to handler classes.
|
|
99
172
|
*
|
|
@@ -138,7 +211,7 @@ declare function SelectMenuRoute<const Kind extends SelectMenuKind, const Defs e
|
|
|
138
211
|
//#region src/dispatch/DispatchContext.d.ts
|
|
139
212
|
/**
|
|
140
213
|
* The per-dispatch bag. Any code can merge fields into it by declaration merging, the
|
|
141
|
-
* same pattern as {@link
|
|
214
|
+
* same pattern as {@link SlashRegistry}. It stays empty until one does, so `keyof DispatchState` is
|
|
142
215
|
* `never` and the bag is inert.
|
|
143
216
|
*/
|
|
144
217
|
interface DispatchState {}
|
|
@@ -769,5 +842,5 @@ declare abstract class PaginatorBase<Item, Prefix extends string, Ctx> {
|
|
|
769
842
|
/** Package version */
|
|
770
843
|
declare const version: string;
|
|
771
844
|
//#endregion
|
|
772
|
-
export { ArraySource, type AutocompleteOptions, AutocompleteRoute, BaseHandler, BuilderComponent, type BuilderType, Bus, ButtonRoute, type CommandInfo, Commands, type ContextMenuInfo,
|
|
845
|
+
export { ArraySource, type AutocompleteOptions, AutocompleteRoute, BaseHandler, BuilderComponent, type BuilderType, Bus, ButtonRoute, type CommandInfo, Commands, type ContextMenuInfo, ContextMenus, type ControlCosmetics, type ControlKey, Cooldown, type CooldownOptions, type CoreBase, CursorSource, CustomId, DispatchContext, type DispatchOutcome, type DispatchState, DmOnly, type EffectGate, Fault, type FaultSource, type Gate, type GateContextBase, type GateNoticeOptions, GuildOnly, type GuildPermissionsContext, type InjectedCommandMap, type InjectedContextMenuMap, type ItemRender, type MessageContextMenuRegistry, MessageContextMenuRoute, ModalRoute, Notice, OwnerOnly, type PageRender, type PageSource, type PageView, PaginatorBase, type PaginatorConfig, type PaginatorControls, type PermissionAssertion, type PermissionNoticeOverrides, type PermissionScope, RegisterCommand, RepliableHandler, RequireBotPermissions, RequirePermissions, type RequirePermissionsOptions, RequireRole, type RequireRoleOptions, type RequiredOf, ResolvedEmoji, RowComponent, type RowType, SelectMenuKind, SelectMenuRoute, ShutdownPhase, Silence, type SlashRegistry, SlashRoute, StartupPhase, Subscribe, type SubscribeOptions, Subscriber, type SubscriptionData, type SubscriptionKey, type Subscriptions, type UserContextMenuRegistry, UserContextMenuRoute, type WebhookFile, WebhookLog, type WebhookReport, WebhookUrl, and, assertPermissions, defineEffectGate, defineGate, mergeRoles, or, paginate, version };
|
|
773
846
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.mjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { a as WebhookUrl, b as InteractionRoutes, c as Subscriber, f as BuilderComponent, h as CommandMetadataKey, o as Subscribe, p as RowComponent, s as WebhookLog, t as Bus } from "./Bus-
|
|
2
|
-
import {
|
|
1
|
+
import { a as WebhookUrl, b as InteractionRoutes, c as Subscriber, f as BuilderComponent, h as CommandMetadataKey, o as Subscribe, p as RowComponent, s as WebhookLog, t as Bus } from "./Bus-BvF4VShN.mjs";
|
|
2
|
+
import { n as Commands, r as ContextMenus } from "./subscribers-wnMyNYZd.mjs";
|
|
3
|
+
import { C as NotInDm, D as defineEffectGate, E as OnCooldown, F as storeInteractionRoute, H as Notice, N as selectMenuRouteOf, O as defineGate, P as storeComponentRoute, R as CustomId, S as NotAllowed, T as NotOwner, V as NoticeCard, a as RequirePermissions, c as hasAll, d as pickNotice, h as runCheck, i as RequireBotPermissions, j as contextMenuRouteOf, k as SelectMenuKind, l as missingNames, m as rollbackCommits, n as pageCursor, o as RequireRole, p as markCommits, r as Silence, t as PAGE_MAX, u as presentNames, v as HasDangerousPermissions, w as NotInGuild, x as NeedsAny, y as MissingPermissions } from "./cursor-CuoA9cRh.mjs";
|
|
3
4
|
import { n as StartupPhase, t as ShutdownPhase } from "./phases-BauKJOTT.mjs";
|
|
4
|
-
import "./subscribers-DuHg-bGT.mjs";
|
|
5
5
|
import "reflect-metadata";
|
|
6
6
|
import { ActionRowBuilder, ButtonBuilder, TextDisplayBuilder } from "@discordjs/builders";
|
|
7
7
|
import { SeedcordErrorCode } from "@seedcord/errors";
|
|
8
8
|
import { Logger } from "@seedcord/logger";
|
|
9
|
-
import { ButtonStyle } from "discord-api-types/v10";
|
|
9
|
+
import { ApplicationCommandType, ButtonStyle } from "discord-api-types/v10";
|
|
10
10
|
import { SeedcordError, SeedcordRangeError, SeedcordTypeError } from "@seedcord/errors/internal";
|
|
11
11
|
import { parseDuration } from "@seedcord/utils";
|
|
12
12
|
|
|
@@ -81,29 +81,49 @@ function AutocompleteRoute(...routes) {
|
|
|
81
81
|
};
|
|
82
82
|
}
|
|
83
83
|
/**
|
|
84
|
-
* Routes one or more context-menu commands to a `
|
|
84
|
+
* Routes one or more user context-menu commands to a `UserContextMenuHandler`.
|
|
85
85
|
*
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
* declare the same kind, cross-checked both directions. Context menus carry no options, so a multi-name
|
|
89
|
-
* handler reads `this.target` uniformly with no branch.
|
|
86
|
+
* Every name is checked against the user registry. The handler's generic must declare the same names,
|
|
87
|
+
* checked in both directions.
|
|
90
88
|
*
|
|
91
|
-
* @param
|
|
92
|
-
* @param names - The command name(s) this handler serves, keyed off the matching registry.
|
|
89
|
+
* @param names - The command name(s) this handler serves.
|
|
93
90
|
* @decorator
|
|
94
91
|
* @example
|
|
95
92
|
* ```ts
|
|
96
|
-
* \@
|
|
97
|
-
* class ViewProfile extends
|
|
93
|
+
* \@UserContextMenuRoute('View Profile')
|
|
94
|
+
* class ViewProfile extends UserContextMenuHandler<'View Profile'> {
|
|
98
95
|
* async execute() {
|
|
99
96
|
* const user = this.target;
|
|
100
97
|
* }
|
|
101
98
|
* }
|
|
102
99
|
* ```
|
|
103
100
|
*/
|
|
104
|
-
function
|
|
101
|
+
function UserContextMenuRoute(...names) {
|
|
105
102
|
return function(constructor) {
|
|
106
|
-
storeInteractionRoute(contextMenuRouteOf(
|
|
103
|
+
storeInteractionRoute(contextMenuRouteOf(ApplicationCommandType.User), names, constructor);
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Routes one or more message context-menu commands to a `MessageContextMenuHandler`.
|
|
108
|
+
*
|
|
109
|
+
* Every name is checked against the message registry. The handler's generic must declare the same names,
|
|
110
|
+
* checked in both directions.
|
|
111
|
+
*
|
|
112
|
+
* @param names - The command name(s) this handler serves.
|
|
113
|
+
* @decorator
|
|
114
|
+
* @example
|
|
115
|
+
* ```ts
|
|
116
|
+
* \@MessageContextMenuRoute('Report Message')
|
|
117
|
+
* class ReportMessage extends MessageContextMenuHandler<'Report Message'> {
|
|
118
|
+
* async execute() {
|
|
119
|
+
* const message = this.target;
|
|
120
|
+
* }
|
|
121
|
+
* }
|
|
122
|
+
* ```
|
|
123
|
+
*/
|
|
124
|
+
function MessageContextMenuRoute(...names) {
|
|
125
|
+
return function(constructor) {
|
|
126
|
+
storeInteractionRoute(contextMenuRouteOf(ApplicationCommandType.Message), names, constructor);
|
|
107
127
|
};
|
|
108
128
|
}
|
|
109
129
|
/**
|
|
@@ -858,8 +878,8 @@ var CursorSource = class {
|
|
|
858
878
|
//#endregion
|
|
859
879
|
//#region src/index.ts
|
|
860
880
|
/** Package version */
|
|
861
|
-
const version = "0.
|
|
881
|
+
const version = "0.3.1";
|
|
862
882
|
|
|
863
883
|
//#endregion
|
|
864
|
-
export { ArraySource, AutocompleteRoute, BaseHandler, BuilderComponent, Bus, ButtonRoute, Commands,
|
|
884
|
+
export { ArraySource, AutocompleteRoute, BaseHandler, BuilderComponent, Bus, ButtonRoute, Commands, ContextMenus, Cooldown, CursorSource, CustomId, DispatchContext, DmOnly, Fault, GuildOnly, MessageContextMenuRoute, ModalRoute, Notice, OwnerOnly, PaginatorBase, RegisterCommand, RepliableHandler, RequireBotPermissions, RequirePermissions, RequireRole, ResolvedEmoji, RowComponent, SelectMenuKind, SelectMenuRoute, ShutdownPhase, Silence, SlashRoute, StartupPhase, Subscribe, Subscriber, UserContextMenuRoute, WebhookLog, WebhookUrl, and, assertPermissions, defineEffectGate, defineGate, mergeRoles, or, paginate, version };
|
|
865
885
|
//# sourceMappingURL=index.mjs.map
|