discord-embed-router 0.0.3 → 0.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/LICENSE +21 -674
- package/README.md +1 -1
- package/dist/index.d.mts +237 -2
- package/dist/index.d.ts +237 -2
- package/dist/index.js +523 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +513 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +19 -13
package/README.md
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -1,3 +1,238 @@
|
|
|
1
|
-
|
|
1
|
+
import { ParamData, Path, MatchFunction, MatchResult, TokenData } from 'path-to-regexp';
|
|
2
|
+
import { Interaction, InteractionEditReplyOptions, ButtonInteraction, AnySelectMenuInteraction, InteractionReplyOptions, ButtonBuilder, APIButtonComponent, StringSelectMenuOptionBuilder, SelectMenuComponentOptionData, APISelectMenuOption, StringSelectMenuBuilder, StringSelectMenuComponentData, APIStringSelectComponent, RestOrArray, ChannelSelectMenuBuilder, ChannelSelectMenuComponentData, APIChannelSelectComponent, RoleSelectMenuBuilder, RoleSelectMenuComponentData, APIRoleSelectComponent, UserSelectMenuBuilder, UserSelectMenuComponentData, APIUserSelectComponent } from 'discord.js';
|
|
2
3
|
|
|
3
|
-
|
|
4
|
+
type State<L, P extends ParamData = ParamData> = MatchResult<P> & {
|
|
5
|
+
embedRouter: EmbedRouter<L>;
|
|
6
|
+
locals?: L | undefined;
|
|
7
|
+
query: URLSearchParams;
|
|
8
|
+
};
|
|
9
|
+
type RouteResponse = InteractionEditReplyOptions;
|
|
10
|
+
type RouteHandler<L, P extends ParamData = ParamData> = (interaction: Interaction, state: State<L, P>) => Promise<RouteResponse> | RouteResponse;
|
|
11
|
+
type CompiledRoute<L, P extends ParamData = ParamData> = {
|
|
12
|
+
path: Path[];
|
|
13
|
+
matchFunction: MatchFunction<P>;
|
|
14
|
+
handler: RouteHandler<L, P>;
|
|
15
|
+
};
|
|
16
|
+
type ResolvedRoute<L, P extends ParamData = ParamData> = {
|
|
17
|
+
state: State<L, P>;
|
|
18
|
+
handler: RouteHandler<L, P>;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
type TakeIdentifier<T extends string, Name extends string = ""> = T extends `${infer Char}${infer Rest}` ? Char extends "/" | ":" | "*" | "{" | "}" ? [Name, T] : TakeIdentifier<Rest, `${Name}${Char}`> : [Name, T];
|
|
22
|
+
type TakeQuoted<T extends string, Name extends string = ""> = T extends `"${infer Rest}` ? [Name, Rest] : T extends `${infer Char}${infer Rest}` ? TakeQuoted<Rest, `${Name}${Char}`> : [Name, T];
|
|
23
|
+
type ParseName<T extends string> = T extends `"${infer Rest}` ? TakeQuoted<Rest> : TakeIdentifier<T>;
|
|
24
|
+
type ExtractParams<T extends string | TokenData, Depth extends string = ""> = T extends TokenData ? ParamData : T extends string ? T extends `${infer Char}${infer Rest}` ? Char extends ":" | "*" ? ParseName<Rest> extends [
|
|
25
|
+
infer Name extends string,
|
|
26
|
+
infer After extends string
|
|
27
|
+
] ? (Depth extends "" ? {
|
|
28
|
+
[K in Name]: string;
|
|
29
|
+
} : {
|
|
30
|
+
[K in Name]?: string;
|
|
31
|
+
}) & ExtractParams<After, Depth> : ExtractParams<Rest, Depth> : Char extends "{" ? ExtractParams<Rest, `${Depth}1`> : Char extends "}" ? ExtractParams<Rest, Depth extends `1${infer Rest2}` ? Rest2 : Depth> : ExtractParams<Rest, Depth> : object : never;
|
|
32
|
+
|
|
33
|
+
declare class EmbedRouter<L> {
|
|
34
|
+
private static usedIdentifiers;
|
|
35
|
+
private name;
|
|
36
|
+
private idPrefix;
|
|
37
|
+
private identifier;
|
|
38
|
+
getIdPrefix(): string;
|
|
39
|
+
private routes;
|
|
40
|
+
/**
|
|
41
|
+
*
|
|
42
|
+
* @param name the name to give the router. ensures buttons stay connected across restarts
|
|
43
|
+
* @param idPrefix the prefix for RouteButtonBuilder customIds
|
|
44
|
+
*/
|
|
45
|
+
constructor({ name, idPrefix, }?: {
|
|
46
|
+
name?: string;
|
|
47
|
+
idPrefix?: string;
|
|
48
|
+
});
|
|
49
|
+
private updateIdentifier;
|
|
50
|
+
/**
|
|
51
|
+
* Registers a path with the router
|
|
52
|
+
*
|
|
53
|
+
* @param routePath path to match with
|
|
54
|
+
* @param handler function that generates the message when a path is matched
|
|
55
|
+
*/
|
|
56
|
+
get<P extends Path = Path>(routePath: P | P[], handler: RouteHandler<L, ExtractParams<P>>): void;
|
|
57
|
+
/**
|
|
58
|
+
* Adds a subrouter to the router
|
|
59
|
+
*
|
|
60
|
+
* @param routePath path of the router
|
|
61
|
+
* @param embedRouter router to add at the path
|
|
62
|
+
*/
|
|
63
|
+
use<P extends Path = Path>(routePath: P, embedRouter: EmbedRouter<L>): void;
|
|
64
|
+
/**
|
|
65
|
+
* Must be attached to "interactionCreate" event for RouteButtonBuilder to work
|
|
66
|
+
*
|
|
67
|
+
* @param interaction interactions from "interactionCreate" (filter for ButtonInteractions)
|
|
68
|
+
*/
|
|
69
|
+
listener(interaction: ButtonInteraction | AnySelectMenuInteraction, locals?: L): Promise<void>;
|
|
70
|
+
/**
|
|
71
|
+
* Connect or update an interaction message to a path
|
|
72
|
+
*
|
|
73
|
+
* @param interaction interaction to connect to
|
|
74
|
+
* @param path path to route the interaction to
|
|
75
|
+
* @param flags optional discord flags to send with message (only allowed on first reply)
|
|
76
|
+
*/
|
|
77
|
+
dispatch<P extends Path = Path>(interaction: Interaction, path: P, locals?: L, flags?: InteractionReplyOptions["flags"]): Promise<void>;
|
|
78
|
+
private resolve;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
declare class RouteButtonBuilder<L> extends ButtonBuilder {
|
|
82
|
+
private embedRouter;
|
|
83
|
+
/**
|
|
84
|
+
*
|
|
85
|
+
* @param embedRouter the router you want to route with
|
|
86
|
+
* @param data the data to construct a component out of
|
|
87
|
+
*/
|
|
88
|
+
constructor(embedRouter: EmbedRouter<L>, data?: Omit<Partial<APIButtonComponent>, "custom_id" | "url">);
|
|
89
|
+
/**
|
|
90
|
+
* Not supported for RouteButtonBuilder
|
|
91
|
+
*
|
|
92
|
+
* @remarks
|
|
93
|
+
* @param
|
|
94
|
+
*/
|
|
95
|
+
setURL(): this;
|
|
96
|
+
/**
|
|
97
|
+
* Not supported for RouteButtonBuilder (use setTo)
|
|
98
|
+
*
|
|
99
|
+
* @remarks
|
|
100
|
+
* @param
|
|
101
|
+
*/
|
|
102
|
+
setCustomId(): this;
|
|
103
|
+
/**
|
|
104
|
+
* Sets the path to route to when clicked
|
|
105
|
+
*
|
|
106
|
+
* @param path the path to route to
|
|
107
|
+
* @param query any query parameters you want to add
|
|
108
|
+
*/
|
|
109
|
+
setTo<P extends Path>(path: P, query?: ConstructorParameters<typeof URLSearchParams>[0]): this;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
declare class RouteStringSelectMenuOptionBuilder extends StringSelectMenuOptionBuilder {
|
|
113
|
+
/**
|
|
114
|
+
*
|
|
115
|
+
* @param data the data to construct a component out of
|
|
116
|
+
*/
|
|
117
|
+
constructor(data?: Omit<SelectMenuComponentOptionData | APISelectMenuOption, "value"> & {
|
|
118
|
+
to: string;
|
|
119
|
+
});
|
|
120
|
+
/**
|
|
121
|
+
* Not supported for RouteStringSelectMenuOptionBuilder (use setTo)
|
|
122
|
+
*
|
|
123
|
+
* @remarks
|
|
124
|
+
* @param
|
|
125
|
+
*/
|
|
126
|
+
setValue(): this;
|
|
127
|
+
/**
|
|
128
|
+
* Sets the path to route to when clicked
|
|
129
|
+
*
|
|
130
|
+
* @param path the path to route to
|
|
131
|
+
* @param query any query parameters you want to add
|
|
132
|
+
*/
|
|
133
|
+
setTo<P extends Path>(path: P, query?: ConstructorParameters<typeof URLSearchParams>[0]): this;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
declare class RouteStringSelectMenuBuilder<L, P extends Path> extends StringSelectMenuBuilder {
|
|
137
|
+
private embedRouter;
|
|
138
|
+
/**
|
|
139
|
+
*
|
|
140
|
+
* @param embedRouter the router you want to route with
|
|
141
|
+
* @param path the path to redirect to, :to or *to in path will be replaced with the selected user's id
|
|
142
|
+
* @param query any query parameters you want to add, :to will be replaced with the selected user's id
|
|
143
|
+
* @param data the data to construct a component out of
|
|
144
|
+
*/
|
|
145
|
+
constructor(embedRouter: EmbedRouter<L>, path?: P | string, query?: ConstructorParameters<typeof URLSearchParams>[0], data?: Partial<StringSelectMenuComponentData | APIStringSelectComponent>);
|
|
146
|
+
/**
|
|
147
|
+
* Not supported for RouteStringSelectMenuBuilder (customId set from embedRouter)
|
|
148
|
+
*
|
|
149
|
+
* @remarks
|
|
150
|
+
* @param
|
|
151
|
+
*/
|
|
152
|
+
setCustomId(): this;
|
|
153
|
+
/**
|
|
154
|
+
* Not supported for RouteStringSelectMenuBuilder (use addTos)
|
|
155
|
+
*
|
|
156
|
+
* @remarks
|
|
157
|
+
* @param
|
|
158
|
+
*/
|
|
159
|
+
addOptions(): this;
|
|
160
|
+
/**
|
|
161
|
+
* Not supported for RouteStringSelectMenuBuilder (use setTos)
|
|
162
|
+
*
|
|
163
|
+
* @remarks
|
|
164
|
+
* @param
|
|
165
|
+
*/
|
|
166
|
+
setOptions(): this;
|
|
167
|
+
/**
|
|
168
|
+
* Adds route select menu options to builder
|
|
169
|
+
*
|
|
170
|
+
* @param tos the list of route select menu options
|
|
171
|
+
*/
|
|
172
|
+
addTos(...tos: RestOrArray<RouteStringSelectMenuOptionBuilder | ConstructorParameters<typeof RouteStringSelectMenuOptionBuilder>[0]>): this;
|
|
173
|
+
/**
|
|
174
|
+
* Sets route select menu options to builder
|
|
175
|
+
*
|
|
176
|
+
* @param tos the list of route select menu options
|
|
177
|
+
*/
|
|
178
|
+
setTos(...tos: RestOrArray<RouteStringSelectMenuOptionBuilder | ConstructorParameters<typeof RouteStringSelectMenuOptionBuilder>[0]>): this;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
declare class RouteChannelSelectMenuBuilder<L, P extends Path> extends ChannelSelectMenuBuilder {
|
|
182
|
+
private embedRouter;
|
|
183
|
+
/**
|
|
184
|
+
*
|
|
185
|
+
* @param embedRouter the router you want to route with
|
|
186
|
+
* @param path the path to redirect to, :channelId in path will be replaced with the selected user's id
|
|
187
|
+
* @param query any query parameters you want to add, :channelId will be replaced with the selected user's id
|
|
188
|
+
* @param data the data to construct a component out of
|
|
189
|
+
*/
|
|
190
|
+
constructor(embedRouter: EmbedRouter<L>, path: P, query?: ConstructorParameters<typeof URLSearchParams>[0], data?: Partial<ChannelSelectMenuComponentData | APIChannelSelectComponent>);
|
|
191
|
+
/**
|
|
192
|
+
* Not supported for RouteChannelSelectMenuBuilder (customId set from embedRouter)
|
|
193
|
+
*
|
|
194
|
+
* @remarks
|
|
195
|
+
* @param
|
|
196
|
+
*/
|
|
197
|
+
setCustomId(): this;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
declare class RouteRoleSelectMenuBuilder<L, P extends Path> extends RoleSelectMenuBuilder {
|
|
201
|
+
private embedRouter;
|
|
202
|
+
/**
|
|
203
|
+
*
|
|
204
|
+
* @param embedRouter the router you want to route with
|
|
205
|
+
* @param path the path to redirect to, :roleId in path will be replaced with the selected user's id
|
|
206
|
+
* @param query any query parameters you want to add, :roleId will be replaced with the selected user's id
|
|
207
|
+
* @param data the data to construct a component out of
|
|
208
|
+
*/
|
|
209
|
+
constructor(embedRouter: EmbedRouter<L>, path: P, query?: ConstructorParameters<typeof URLSearchParams>[0], data?: Partial<RoleSelectMenuComponentData | APIRoleSelectComponent>);
|
|
210
|
+
/**
|
|
211
|
+
* Not supported for RouteRoleSelectMenuBuilder (customId set from embedRouter)
|
|
212
|
+
*
|
|
213
|
+
* @remarks
|
|
214
|
+
* @param
|
|
215
|
+
*/
|
|
216
|
+
setCustomId(): this;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
declare class RouteUserSelectMenuBuilder<L, P extends Path> extends UserSelectMenuBuilder {
|
|
220
|
+
private embedRouter;
|
|
221
|
+
/**
|
|
222
|
+
*
|
|
223
|
+
* @param embedRouter the router you want to route with
|
|
224
|
+
* @param path the path to redirect to, :userId in path will be replaced with the selected user's id
|
|
225
|
+
* @param query any query parameters you want to add, :userId will be replaced with the selected user's id
|
|
226
|
+
* @param data the data to construct a component out of
|
|
227
|
+
*/
|
|
228
|
+
constructor(embedRouter: EmbedRouter<L>, path: P, query?: ConstructorParameters<typeof URLSearchParams>[0], data?: Partial<UserSelectMenuComponentData | APIUserSelectComponent>);
|
|
229
|
+
/**
|
|
230
|
+
* Not supported for RouteUserSelectMenuBuilder (customId set from embedRouter)
|
|
231
|
+
*
|
|
232
|
+
* @remarks
|
|
233
|
+
* @param
|
|
234
|
+
*/
|
|
235
|
+
setCustomId(): this;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
export { type CompiledRoute, EmbedRouter, type ResolvedRoute, RouteButtonBuilder, RouteChannelSelectMenuBuilder, type RouteHandler, type RouteResponse, RouteRoleSelectMenuBuilder, RouteStringSelectMenuBuilder, RouteStringSelectMenuOptionBuilder, RouteUserSelectMenuBuilder, type State };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,238 @@
|
|
|
1
|
-
|
|
1
|
+
import { ParamData, Path, MatchFunction, MatchResult, TokenData } from 'path-to-regexp';
|
|
2
|
+
import { Interaction, InteractionEditReplyOptions, ButtonInteraction, AnySelectMenuInteraction, InteractionReplyOptions, ButtonBuilder, APIButtonComponent, StringSelectMenuOptionBuilder, SelectMenuComponentOptionData, APISelectMenuOption, StringSelectMenuBuilder, StringSelectMenuComponentData, APIStringSelectComponent, RestOrArray, ChannelSelectMenuBuilder, ChannelSelectMenuComponentData, APIChannelSelectComponent, RoleSelectMenuBuilder, RoleSelectMenuComponentData, APIRoleSelectComponent, UserSelectMenuBuilder, UserSelectMenuComponentData, APIUserSelectComponent } from 'discord.js';
|
|
2
3
|
|
|
3
|
-
|
|
4
|
+
type State<L, P extends ParamData = ParamData> = MatchResult<P> & {
|
|
5
|
+
embedRouter: EmbedRouter<L>;
|
|
6
|
+
locals?: L | undefined;
|
|
7
|
+
query: URLSearchParams;
|
|
8
|
+
};
|
|
9
|
+
type RouteResponse = InteractionEditReplyOptions;
|
|
10
|
+
type RouteHandler<L, P extends ParamData = ParamData> = (interaction: Interaction, state: State<L, P>) => Promise<RouteResponse> | RouteResponse;
|
|
11
|
+
type CompiledRoute<L, P extends ParamData = ParamData> = {
|
|
12
|
+
path: Path[];
|
|
13
|
+
matchFunction: MatchFunction<P>;
|
|
14
|
+
handler: RouteHandler<L, P>;
|
|
15
|
+
};
|
|
16
|
+
type ResolvedRoute<L, P extends ParamData = ParamData> = {
|
|
17
|
+
state: State<L, P>;
|
|
18
|
+
handler: RouteHandler<L, P>;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
type TakeIdentifier<T extends string, Name extends string = ""> = T extends `${infer Char}${infer Rest}` ? Char extends "/" | ":" | "*" | "{" | "}" ? [Name, T] : TakeIdentifier<Rest, `${Name}${Char}`> : [Name, T];
|
|
22
|
+
type TakeQuoted<T extends string, Name extends string = ""> = T extends `"${infer Rest}` ? [Name, Rest] : T extends `${infer Char}${infer Rest}` ? TakeQuoted<Rest, `${Name}${Char}`> : [Name, T];
|
|
23
|
+
type ParseName<T extends string> = T extends `"${infer Rest}` ? TakeQuoted<Rest> : TakeIdentifier<T>;
|
|
24
|
+
type ExtractParams<T extends string | TokenData, Depth extends string = ""> = T extends TokenData ? ParamData : T extends string ? T extends `${infer Char}${infer Rest}` ? Char extends ":" | "*" ? ParseName<Rest> extends [
|
|
25
|
+
infer Name extends string,
|
|
26
|
+
infer After extends string
|
|
27
|
+
] ? (Depth extends "" ? {
|
|
28
|
+
[K in Name]: string;
|
|
29
|
+
} : {
|
|
30
|
+
[K in Name]?: string;
|
|
31
|
+
}) & ExtractParams<After, Depth> : ExtractParams<Rest, Depth> : Char extends "{" ? ExtractParams<Rest, `${Depth}1`> : Char extends "}" ? ExtractParams<Rest, Depth extends `1${infer Rest2}` ? Rest2 : Depth> : ExtractParams<Rest, Depth> : object : never;
|
|
32
|
+
|
|
33
|
+
declare class EmbedRouter<L> {
|
|
34
|
+
private static usedIdentifiers;
|
|
35
|
+
private name;
|
|
36
|
+
private idPrefix;
|
|
37
|
+
private identifier;
|
|
38
|
+
getIdPrefix(): string;
|
|
39
|
+
private routes;
|
|
40
|
+
/**
|
|
41
|
+
*
|
|
42
|
+
* @param name the name to give the router. ensures buttons stay connected across restarts
|
|
43
|
+
* @param idPrefix the prefix for RouteButtonBuilder customIds
|
|
44
|
+
*/
|
|
45
|
+
constructor({ name, idPrefix, }?: {
|
|
46
|
+
name?: string;
|
|
47
|
+
idPrefix?: string;
|
|
48
|
+
});
|
|
49
|
+
private updateIdentifier;
|
|
50
|
+
/**
|
|
51
|
+
* Registers a path with the router
|
|
52
|
+
*
|
|
53
|
+
* @param routePath path to match with
|
|
54
|
+
* @param handler function that generates the message when a path is matched
|
|
55
|
+
*/
|
|
56
|
+
get<P extends Path = Path>(routePath: P | P[], handler: RouteHandler<L, ExtractParams<P>>): void;
|
|
57
|
+
/**
|
|
58
|
+
* Adds a subrouter to the router
|
|
59
|
+
*
|
|
60
|
+
* @param routePath path of the router
|
|
61
|
+
* @param embedRouter router to add at the path
|
|
62
|
+
*/
|
|
63
|
+
use<P extends Path = Path>(routePath: P, embedRouter: EmbedRouter<L>): void;
|
|
64
|
+
/**
|
|
65
|
+
* Must be attached to "interactionCreate" event for RouteButtonBuilder to work
|
|
66
|
+
*
|
|
67
|
+
* @param interaction interactions from "interactionCreate" (filter for ButtonInteractions)
|
|
68
|
+
*/
|
|
69
|
+
listener(interaction: ButtonInteraction | AnySelectMenuInteraction, locals?: L): Promise<void>;
|
|
70
|
+
/**
|
|
71
|
+
* Connect or update an interaction message to a path
|
|
72
|
+
*
|
|
73
|
+
* @param interaction interaction to connect to
|
|
74
|
+
* @param path path to route the interaction to
|
|
75
|
+
* @param flags optional discord flags to send with message (only allowed on first reply)
|
|
76
|
+
*/
|
|
77
|
+
dispatch<P extends Path = Path>(interaction: Interaction, path: P, locals?: L, flags?: InteractionReplyOptions["flags"]): Promise<void>;
|
|
78
|
+
private resolve;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
declare class RouteButtonBuilder<L> extends ButtonBuilder {
|
|
82
|
+
private embedRouter;
|
|
83
|
+
/**
|
|
84
|
+
*
|
|
85
|
+
* @param embedRouter the router you want to route with
|
|
86
|
+
* @param data the data to construct a component out of
|
|
87
|
+
*/
|
|
88
|
+
constructor(embedRouter: EmbedRouter<L>, data?: Omit<Partial<APIButtonComponent>, "custom_id" | "url">);
|
|
89
|
+
/**
|
|
90
|
+
* Not supported for RouteButtonBuilder
|
|
91
|
+
*
|
|
92
|
+
* @remarks
|
|
93
|
+
* @param
|
|
94
|
+
*/
|
|
95
|
+
setURL(): this;
|
|
96
|
+
/**
|
|
97
|
+
* Not supported for RouteButtonBuilder (use setTo)
|
|
98
|
+
*
|
|
99
|
+
* @remarks
|
|
100
|
+
* @param
|
|
101
|
+
*/
|
|
102
|
+
setCustomId(): this;
|
|
103
|
+
/**
|
|
104
|
+
* Sets the path to route to when clicked
|
|
105
|
+
*
|
|
106
|
+
* @param path the path to route to
|
|
107
|
+
* @param query any query parameters you want to add
|
|
108
|
+
*/
|
|
109
|
+
setTo<P extends Path>(path: P, query?: ConstructorParameters<typeof URLSearchParams>[0]): this;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
declare class RouteStringSelectMenuOptionBuilder extends StringSelectMenuOptionBuilder {
|
|
113
|
+
/**
|
|
114
|
+
*
|
|
115
|
+
* @param data the data to construct a component out of
|
|
116
|
+
*/
|
|
117
|
+
constructor(data?: Omit<SelectMenuComponentOptionData | APISelectMenuOption, "value"> & {
|
|
118
|
+
to: string;
|
|
119
|
+
});
|
|
120
|
+
/**
|
|
121
|
+
* Not supported for RouteStringSelectMenuOptionBuilder (use setTo)
|
|
122
|
+
*
|
|
123
|
+
* @remarks
|
|
124
|
+
* @param
|
|
125
|
+
*/
|
|
126
|
+
setValue(): this;
|
|
127
|
+
/**
|
|
128
|
+
* Sets the path to route to when clicked
|
|
129
|
+
*
|
|
130
|
+
* @param path the path to route to
|
|
131
|
+
* @param query any query parameters you want to add
|
|
132
|
+
*/
|
|
133
|
+
setTo<P extends Path>(path: P, query?: ConstructorParameters<typeof URLSearchParams>[0]): this;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
declare class RouteStringSelectMenuBuilder<L, P extends Path> extends StringSelectMenuBuilder {
|
|
137
|
+
private embedRouter;
|
|
138
|
+
/**
|
|
139
|
+
*
|
|
140
|
+
* @param embedRouter the router you want to route with
|
|
141
|
+
* @param path the path to redirect to, :to or *to in path will be replaced with the selected user's id
|
|
142
|
+
* @param query any query parameters you want to add, :to will be replaced with the selected user's id
|
|
143
|
+
* @param data the data to construct a component out of
|
|
144
|
+
*/
|
|
145
|
+
constructor(embedRouter: EmbedRouter<L>, path?: P | string, query?: ConstructorParameters<typeof URLSearchParams>[0], data?: Partial<StringSelectMenuComponentData | APIStringSelectComponent>);
|
|
146
|
+
/**
|
|
147
|
+
* Not supported for RouteStringSelectMenuBuilder (customId set from embedRouter)
|
|
148
|
+
*
|
|
149
|
+
* @remarks
|
|
150
|
+
* @param
|
|
151
|
+
*/
|
|
152
|
+
setCustomId(): this;
|
|
153
|
+
/**
|
|
154
|
+
* Not supported for RouteStringSelectMenuBuilder (use addTos)
|
|
155
|
+
*
|
|
156
|
+
* @remarks
|
|
157
|
+
* @param
|
|
158
|
+
*/
|
|
159
|
+
addOptions(): this;
|
|
160
|
+
/**
|
|
161
|
+
* Not supported for RouteStringSelectMenuBuilder (use setTos)
|
|
162
|
+
*
|
|
163
|
+
* @remarks
|
|
164
|
+
* @param
|
|
165
|
+
*/
|
|
166
|
+
setOptions(): this;
|
|
167
|
+
/**
|
|
168
|
+
* Adds route select menu options to builder
|
|
169
|
+
*
|
|
170
|
+
* @param tos the list of route select menu options
|
|
171
|
+
*/
|
|
172
|
+
addTos(...tos: RestOrArray<RouteStringSelectMenuOptionBuilder | ConstructorParameters<typeof RouteStringSelectMenuOptionBuilder>[0]>): this;
|
|
173
|
+
/**
|
|
174
|
+
* Sets route select menu options to builder
|
|
175
|
+
*
|
|
176
|
+
* @param tos the list of route select menu options
|
|
177
|
+
*/
|
|
178
|
+
setTos(...tos: RestOrArray<RouteStringSelectMenuOptionBuilder | ConstructorParameters<typeof RouteStringSelectMenuOptionBuilder>[0]>): this;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
declare class RouteChannelSelectMenuBuilder<L, P extends Path> extends ChannelSelectMenuBuilder {
|
|
182
|
+
private embedRouter;
|
|
183
|
+
/**
|
|
184
|
+
*
|
|
185
|
+
* @param embedRouter the router you want to route with
|
|
186
|
+
* @param path the path to redirect to, :channelId in path will be replaced with the selected user's id
|
|
187
|
+
* @param query any query parameters you want to add, :channelId will be replaced with the selected user's id
|
|
188
|
+
* @param data the data to construct a component out of
|
|
189
|
+
*/
|
|
190
|
+
constructor(embedRouter: EmbedRouter<L>, path: P, query?: ConstructorParameters<typeof URLSearchParams>[0], data?: Partial<ChannelSelectMenuComponentData | APIChannelSelectComponent>);
|
|
191
|
+
/**
|
|
192
|
+
* Not supported for RouteChannelSelectMenuBuilder (customId set from embedRouter)
|
|
193
|
+
*
|
|
194
|
+
* @remarks
|
|
195
|
+
* @param
|
|
196
|
+
*/
|
|
197
|
+
setCustomId(): this;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
declare class RouteRoleSelectMenuBuilder<L, P extends Path> extends RoleSelectMenuBuilder {
|
|
201
|
+
private embedRouter;
|
|
202
|
+
/**
|
|
203
|
+
*
|
|
204
|
+
* @param embedRouter the router you want to route with
|
|
205
|
+
* @param path the path to redirect to, :roleId in path will be replaced with the selected user's id
|
|
206
|
+
* @param query any query parameters you want to add, :roleId will be replaced with the selected user's id
|
|
207
|
+
* @param data the data to construct a component out of
|
|
208
|
+
*/
|
|
209
|
+
constructor(embedRouter: EmbedRouter<L>, path: P, query?: ConstructorParameters<typeof URLSearchParams>[0], data?: Partial<RoleSelectMenuComponentData | APIRoleSelectComponent>);
|
|
210
|
+
/**
|
|
211
|
+
* Not supported for RouteRoleSelectMenuBuilder (customId set from embedRouter)
|
|
212
|
+
*
|
|
213
|
+
* @remarks
|
|
214
|
+
* @param
|
|
215
|
+
*/
|
|
216
|
+
setCustomId(): this;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
declare class RouteUserSelectMenuBuilder<L, P extends Path> extends UserSelectMenuBuilder {
|
|
220
|
+
private embedRouter;
|
|
221
|
+
/**
|
|
222
|
+
*
|
|
223
|
+
* @param embedRouter the router you want to route with
|
|
224
|
+
* @param path the path to redirect to, :userId in path will be replaced with the selected user's id
|
|
225
|
+
* @param query any query parameters you want to add, :userId will be replaced with the selected user's id
|
|
226
|
+
* @param data the data to construct a component out of
|
|
227
|
+
*/
|
|
228
|
+
constructor(embedRouter: EmbedRouter<L>, path: P, query?: ConstructorParameters<typeof URLSearchParams>[0], data?: Partial<UserSelectMenuComponentData | APIUserSelectComponent>);
|
|
229
|
+
/**
|
|
230
|
+
* Not supported for RouteUserSelectMenuBuilder (customId set from embedRouter)
|
|
231
|
+
*
|
|
232
|
+
* @remarks
|
|
233
|
+
* @param
|
|
234
|
+
*/
|
|
235
|
+
setCustomId(): this;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
export { type CompiledRoute, EmbedRouter, type ResolvedRoute, RouteButtonBuilder, RouteChannelSelectMenuBuilder, type RouteHandler, type RouteResponse, RouteRoleSelectMenuBuilder, RouteStringSelectMenuBuilder, RouteStringSelectMenuOptionBuilder, RouteUserSelectMenuBuilder, type State };
|