@seedcord/core 0.4.1 → 0.6.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/dist/{Bus-yJGE6Fs2.mjs → Bus-dGy6xq3F.mjs} +43 -40
- package/dist/Bus-dGy6xq3F.mjs.map +1 -0
- package/dist/{Pluggable-BI_LQuPm.mjs → Pluggable-B7_EftHj.mjs} +33 -10
- package/dist/Pluggable-B7_EftHj.mjs.map +1 -0
- package/dist/{Pluggable-bFCmT4oB.d.mts → Pluggable-C5uxmDb-.d.mts} +11 -4
- package/dist/{Plugin-B0SRHzMX.mjs → Plugin-BJfRk0s_.mjs} +3 -3
- package/dist/{Plugin-B0SRHzMX.mjs.map → Plugin-BJfRk0s_.mjs.map} +1 -1
- package/dist/{Plugin-BW2JH2_h.d.mts → Plugin-Bnz61fs_.d.mts} +9 -3
- package/dist/{cursor-CO_MTgdZ.d.mts → cursor-8Y2zpF-Y.d.mts} +4 -25
- package/dist/{cursor-CaT051ii.mjs → cursor-BkI9lxy2.mjs} +6 -29
- package/dist/cursor-BkI9lxy2.mjs.map +1 -0
- package/dist/{index-CvneCObW.d.mts → index-CD8l15aZ.d.mts} +2 -2
- package/dist/index.d.mts +101 -20
- package/dist/index.mjs +113 -16
- package/dist/index.mjs.map +1 -1
- package/dist/internal.index.d.mts +13 -6
- package/dist/internal.index.mjs +11 -11
- package/dist/internal.index.mjs.map +1 -1
- package/dist/node-internal.index.d.mts +10 -5
- package/dist/node-internal.index.mjs +19 -10
- package/dist/node-internal.index.mjs.map +1 -1
- package/dist/node.index.d.mts +1 -1
- package/dist/node.index.mjs +31 -10
- package/dist/node.index.mjs.map +1 -1
- package/dist/{phases-C5Steaa2.d.mts → phases-D0a8BV9Z.d.mts} +10 -7
- package/dist/plugin.index.d.mts +1 -1
- package/dist/plugin.index.mjs +1 -1
- package/dist/{publishDefault-D826XXDQ.mjs → publishDefault-BuSZPbjT.mjs} +2 -2
- package/dist/{publishDefault-D826XXDQ.mjs.map → publishDefault-BuSZPbjT.mjs.map} +1 -1
- package/dist/{slashRouteLeaves-BQmbFm-S.mjs → slashRouteLeaves-C1msUE9Q.mjs} +2 -2
- package/dist/{slashRouteLeaves-BQmbFm-S.mjs.map → slashRouteLeaves-C1msUE9Q.mjs.map} +1 -1
- package/dist/{subscribers-DVa-Pr45.mjs → subscribers-A8lNU5yM.mjs} +2 -2
- package/dist/{subscribers-DVa-Pr45.mjs.map → subscribers-A8lNU5yM.mjs.map} +1 -1
- package/package.json +14 -14
- package/dist/Bus-yJGE6Fs2.mjs.map +0 -1
- package/dist/Pluggable-BI_LQuPm.mjs.map +0 -1
- package/dist/cursor-CaT051ii.mjs.map +0 -1
package/dist/index.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { A as translateSerializationError, C as NotInDm, D as defineEffectGate, E as OnCooldown, F as checkAckLegality,
|
|
2
|
-
import { A as RowComponent, d as WebhookLog, f as Subscriber, g as CommandMetadataKey, k as BuilderComponent, l as WebhookUrl, t as Bus, u as Subscribe,
|
|
3
|
-
import { n as Commands, r as ContextMenus } from "./subscribers-
|
|
1
|
+
import { A as translateSerializationError, B as storeComponentRoute, C as NotInDm, D as defineEffectGate, E as OnCooldown, F as checkAckLegality, G as Notice, I as sendTarget, M as publishResponse, O as defineGate, P as AckTrace, R as contextMenuRouteOf, S as NotAllowed, T as NotOwner, V as storeInteractionRoute, W as NoticeCard, a as RequirePermissions, c as hasAll, d as pickNotice, h as runCheck, i as RequireBotPermissions, j as attemptWrite, k as serializeReply, 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-BkI9lxy2.mjs";
|
|
2
|
+
import { A as RowComponent, d as WebhookLog, f as Subscriber, g as CommandMetadataKey, k as BuilderComponent, l as WebhookUrl, t as Bus, u as Subscribe, y as InteractionKind } from "./Bus-dGy6xq3F.mjs";
|
|
3
|
+
import { n as Commands, r as ContextMenus } from "./subscribers-A8lNU5yM.mjs";
|
|
4
4
|
import { n as StartupPhase, t as ShutdownPhase } from "./phases-BauKJOTT.mjs";
|
|
5
5
|
import "reflect-metadata";
|
|
6
|
-
import { CustomId, setCustomIdErrors, setCustomIdErrors as setCustomIdErrors$1 } from "@seedcord/custom-id";
|
|
6
|
+
import { CustomId, decodeFor, prefixOf, setCustomIdErrors, setCustomIdErrors as setCustomIdErrors$1 } from "@seedcord/custom-id";
|
|
7
7
|
import { ActionRowBuilder, ButtonBuilder, TextDisplayBuilder } from "@discordjs/builders";
|
|
8
8
|
import { ApplicationCommandType, ButtonStyle } from "discord-api-types/v10";
|
|
9
9
|
import { SeedcordErrorCode } from "@seedcord/errors";
|
|
@@ -193,24 +193,121 @@ function ModalRoute(...defs) {
|
|
|
193
193
|
};
|
|
194
194
|
}
|
|
195
195
|
/**
|
|
196
|
-
* Routes select menu interactions to
|
|
196
|
+
* Routes string select menu interactions to a `StringMenuHandler`.
|
|
197
197
|
*
|
|
198
|
-
* Pass the
|
|
199
|
-
* generic
|
|
198
|
+
* Pass the {@link CustomId} definition(s) this handler decodes and list the same ones in the handler's
|
|
199
|
+
* generic. The handler reads the chosen option values from `this.values`.
|
|
200
|
+
*
|
|
201
|
+
* @param defs - The customId definition(s) this handler decodes, one per route.
|
|
202
|
+
* @decorator
|
|
203
|
+
* @example
|
|
204
|
+
* ```ts
|
|
205
|
+
* \@StringMenuRoute(TopicsId)
|
|
206
|
+
* class Topics extends StringMenuHandler<[typeof TopicsId]> {
|
|
207
|
+
* async execute() {
|
|
208
|
+
* await this.update(`following ${this.values.join(', ')}`);
|
|
209
|
+
* }
|
|
210
|
+
* }
|
|
211
|
+
* ```
|
|
212
|
+
*/
|
|
213
|
+
function StringMenuRoute(...defs) {
|
|
214
|
+
return function(constructor) {
|
|
215
|
+
storeComponentRoute("stringMenu", defs, constructor);
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* Routes user select menu interactions to a `UserMenuHandler`.
|
|
220
|
+
*
|
|
221
|
+
* Pass the {@link CustomId} definition(s) this handler decodes and list the same ones in the handler's
|
|
222
|
+
* generic. Beside `this.values` the handler declares `this.users` and `this.members`. Discord resolves
|
|
223
|
+
* the members only inside a guild.
|
|
224
|
+
*
|
|
225
|
+
* @param defs - The customId definition(s) this handler decodes, one per route.
|
|
226
|
+
* @decorator
|
|
227
|
+
* @example
|
|
228
|
+
* ```ts
|
|
229
|
+
* \@UserMenuRoute(AssignId)
|
|
230
|
+
* class Assign extends UserMenuHandler<[typeof AssignId]> {
|
|
231
|
+
* async execute() {
|
|
232
|
+
* const { roleId } = this.params;
|
|
233
|
+
* await this.reply(`assigning ${this.users.size} member(s) to <@&${roleId}>`);
|
|
234
|
+
* }
|
|
235
|
+
* }
|
|
236
|
+
* ```
|
|
237
|
+
*/
|
|
238
|
+
function UserMenuRoute(...defs) {
|
|
239
|
+
return function(constructor) {
|
|
240
|
+
storeComponentRoute("userMenu", defs, constructor);
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* Routes role select menu interactions to a `RoleMenuHandler`.
|
|
245
|
+
*
|
|
246
|
+
* Pass the {@link CustomId} definition(s) this handler decodes and list the same ones in the handler's
|
|
247
|
+
* generic. Beside `this.values` the handler declares `this.roles`.
|
|
248
|
+
*
|
|
249
|
+
* @param defs - The customId definition(s) this handler decodes, one per route.
|
|
250
|
+
* @decorator
|
|
251
|
+
* @example
|
|
252
|
+
* ```ts
|
|
253
|
+
* \@RoleMenuRoute(GrantId)
|
|
254
|
+
* class Grant extends RoleMenuHandler<[typeof GrantId]> {
|
|
255
|
+
* async execute() {
|
|
256
|
+
* await this.update(`granting ${this.roles.size} role(s)`);
|
|
257
|
+
* }
|
|
258
|
+
* }
|
|
259
|
+
* ```
|
|
260
|
+
*/
|
|
261
|
+
function RoleMenuRoute(...defs) {
|
|
262
|
+
return function(constructor) {
|
|
263
|
+
storeComponentRoute("roleMenu", defs, constructor);
|
|
264
|
+
};
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* Routes channel select menu interactions to a `ChannelMenuHandler`.
|
|
268
|
+
*
|
|
269
|
+
* Pass the {@link CustomId} definition(s) this handler decodes and list the same ones in the handler's
|
|
270
|
+
* generic. Beside `this.values` the handler declares `this.channels`.
|
|
200
271
|
*
|
|
201
|
-
* @param type - Select menu kind from {@link SelectMenuKind}.
|
|
202
272
|
* @param defs - The customId definition(s) this handler decodes, one per route.
|
|
203
273
|
* @decorator
|
|
274
|
+
* @example
|
|
275
|
+
* ```ts
|
|
276
|
+
* \@ChannelMenuRoute(LogTargetId)
|
|
277
|
+
* class LogTarget extends ChannelMenuHandler<[typeof LogTargetId]> {
|
|
278
|
+
* async execute() {
|
|
279
|
+
* await this.update(`logging to ${this.channels.size} channel(s)`);
|
|
280
|
+
* }
|
|
281
|
+
* }
|
|
282
|
+
* ```
|
|
283
|
+
*/
|
|
284
|
+
function ChannelMenuRoute(...defs) {
|
|
285
|
+
return function(constructor) {
|
|
286
|
+
storeComponentRoute("channelMenu", defs, constructor);
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* Routes mentionable select menu interactions to a `MentionableMenuHandler`.
|
|
204
291
|
*
|
|
292
|
+
* Pass the {@link CustomId} definition(s) this handler decodes and list the same ones in the handler's
|
|
293
|
+
* generic. A mentionable menu accepts users and roles together. `this.users`, `this.members`, and
|
|
294
|
+
* `this.roles` can each come back empty.
|
|
295
|
+
*
|
|
296
|
+
* @param defs - The customId definition(s) this handler decodes, one per route.
|
|
297
|
+
* @decorator
|
|
205
298
|
* @example
|
|
206
|
-
* ```
|
|
207
|
-
* \@
|
|
208
|
-
* class
|
|
299
|
+
* ```ts
|
|
300
|
+
* \@MentionableMenuRoute(InviteId)
|
|
301
|
+
* class Invite extends MentionableMenuHandler<[typeof InviteId]> {
|
|
302
|
+
* async execute() {
|
|
303
|
+
* await this.update(`inviting ${this.users.size} user(s) and ${this.roles.size} role(s)`);
|
|
304
|
+
* }
|
|
305
|
+
* }
|
|
209
306
|
* ```
|
|
210
307
|
*/
|
|
211
|
-
function
|
|
308
|
+
function MentionableMenuRoute(...defs) {
|
|
212
309
|
return function(constructor) {
|
|
213
|
-
storeComponentRoute(
|
|
310
|
+
storeComponentRoute("mentionableMenu", defs, constructor);
|
|
214
311
|
};
|
|
215
312
|
}
|
|
216
313
|
|
|
@@ -875,7 +972,7 @@ function paginate(items, page, perPage) {
|
|
|
875
972
|
}
|
|
876
973
|
|
|
877
974
|
//#endregion
|
|
878
|
-
//#region src/pagination/
|
|
975
|
+
//#region src/pagination/Controls.ts
|
|
879
976
|
const DEFAULT_LABEL = {
|
|
880
977
|
first: "First",
|
|
881
978
|
prev: "Prev",
|
|
@@ -1080,8 +1177,8 @@ var CursorSourceBase = class {
|
|
|
1080
1177
|
//#endregion
|
|
1081
1178
|
//#region src/index.ts
|
|
1082
1179
|
/** Package version */
|
|
1083
|
-
const version = "0.
|
|
1180
|
+
const version = "0.6.0";
|
|
1084
1181
|
|
|
1085
1182
|
//#endregion
|
|
1086
|
-
export { ArraySourceBase, AutocompleteRoute, BaseHandler, BaseReplySender, BuilderComponent, Bus, ButtonRoute, Commands, ContextMenus, Cooldown, CursorSourceBase, CustomId, DispatchContext, DmOnly, Fault, GuildOnly, MessageContextMenuRoute, ModalRoute, Notice, OwnerOnly, PaginatorBase, RegisterCommand, RepliableHandler, RequireBotPermissions, RequirePermissions, RequireRole, ResolvedEmoji,
|
|
1183
|
+
export { ArraySourceBase, AutocompleteRoute, BaseHandler, BaseReplySender, BuilderComponent, Bus, ButtonRoute, ChannelMenuRoute, Commands, ContextMenus, Cooldown, CursorSourceBase, CustomId, DispatchContext, DmOnly, Fault, GuildOnly, InteractionKind, MentionableMenuRoute, MessageContextMenuRoute, ModalRoute, Notice, OwnerOnly, PaginatorBase, RegisterCommand, RepliableHandler, RequireBotPermissions, RequirePermissions, RequireRole, ResolvedEmoji, RoleMenuRoute, RowComponent, ShutdownPhase, Silence, SlashRoute, StartupPhase, StringMenuRoute, Subscribe, Subscriber, UserContextMenuRoute, UserMenuRoute, WebhookLog, WebhookUrl, and, assertPermissions, decodeFor, defineEffectGate, defineGate, mergeRoles, or, paginate, prefixOf, setCustomIdErrors, version };
|
|
1087
1184
|
//# sourceMappingURL=index.mjs.map
|