seedcord 0.16.0-next.2 → 0.16.0-next.3
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/index.cjs +81 -80
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +8 -8
- package/dist/index.mjs +19 -18
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -6
package/dist/index.cjs
CHANGED
|
@@ -30,12 +30,13 @@ require("reflect-metadata");
|
|
|
30
30
|
let _seedcord_errors = require("@seedcord/errors");
|
|
31
31
|
let _seedcord_errors_internal = require("@seedcord/errors/internal");
|
|
32
32
|
let discord_js = require("discord.js");
|
|
33
|
-
let
|
|
34
|
-
let
|
|
33
|
+
let _seedcord_core_internal = require("@seedcord/core/internal");
|
|
34
|
+
let _seedcord_core = require("@seedcord/core");
|
|
35
35
|
let _seedcord_utils = require("@seedcord/utils");
|
|
36
36
|
let _seedcord_services = require("@seedcord/services");
|
|
37
37
|
let chalk = require("chalk");
|
|
38
38
|
chalk = __toESM(chalk, 1);
|
|
39
|
+
let _discordjs_builders = require("@discordjs/builders");
|
|
39
40
|
let _seedcord_utils_internal = require("@seedcord/utils/internal");
|
|
40
41
|
let node_fs = require("node:fs");
|
|
41
42
|
let node_path = require("node:path");
|
|
@@ -485,7 +486,7 @@ function SelectMenuRoute(type, ...defs) {
|
|
|
485
486
|
}
|
|
486
487
|
function storeComponentRoute(route, defs, constructor) {
|
|
487
488
|
storeMetadata(route, defs.map((def) => def.prefix), constructor);
|
|
488
|
-
Reflect.defineMetadata(
|
|
489
|
+
Reflect.defineMetadata(_seedcord_core_internal.ComponentDefsKey, defs, constructor);
|
|
489
490
|
}
|
|
490
491
|
function storeMetadata(route, routes, constructor) {
|
|
491
492
|
const key = InteractionRouteKeys[route];
|
|
@@ -658,9 +659,9 @@ function labelFor(subject) {
|
|
|
658
659
|
|
|
659
660
|
//#endregion
|
|
660
661
|
//#region src/bot/notices/index.ts
|
|
661
|
-
var GateNotice = class extends
|
|
662
|
+
var GateNotice = class extends _seedcord_core.Notice {
|
|
662
663
|
render() {
|
|
663
|
-
return { components: [new
|
|
664
|
+
return { components: [new _seedcord_core_internal.NoticeCard(this.message).component] };
|
|
664
665
|
}
|
|
665
666
|
};
|
|
666
667
|
var NotOwner = class extends GateNotice {
|
|
@@ -697,25 +698,25 @@ var MissingRole = class extends GateNotice {
|
|
|
697
698
|
this.role = role;
|
|
698
699
|
}
|
|
699
700
|
};
|
|
700
|
-
var NotAllowed = class extends
|
|
701
|
+
var NotAllowed = class extends _seedcord_core.Notice {
|
|
701
702
|
constructor() {
|
|
702
703
|
super("not allowed");
|
|
703
704
|
}
|
|
704
705
|
render() {
|
|
705
|
-
return { components: [new
|
|
706
|
+
return { components: [new _seedcord_core_internal.NoticeCard("You are not allowed to use this command.").component] };
|
|
706
707
|
}
|
|
707
708
|
};
|
|
708
|
-
var NeedsAny = class extends
|
|
709
|
+
var NeedsAny = class extends _seedcord_core.Notice {
|
|
709
710
|
summaries;
|
|
710
711
|
constructor(summaries) {
|
|
711
712
|
super("not allowed");
|
|
712
713
|
this.summaries = summaries;
|
|
713
714
|
}
|
|
714
715
|
render() {
|
|
715
|
-
return { components: [new
|
|
716
|
+
return { components: [new _seedcord_core_internal.NoticeCard(`You need any of:\n${this.summaries.map((summary) => `• ${summary}`).join("\n")}`).component] };
|
|
716
717
|
}
|
|
717
718
|
};
|
|
718
|
-
var RoleHigherThanMe = class extends
|
|
719
|
+
var RoleHigherThanMe = class extends _seedcord_core.Notice {
|
|
719
720
|
role;
|
|
720
721
|
botRole;
|
|
721
722
|
constructor(message, role, botRole) {
|
|
@@ -724,18 +725,18 @@ var RoleHigherThanMe = class extends _seedcord_kit.Notice {
|
|
|
724
725
|
this.botRole = botRole;
|
|
725
726
|
}
|
|
726
727
|
render() {
|
|
727
|
-
return { components: [new
|
|
728
|
+
return { components: [new _seedcord_core_internal.NoticeCard(`I cannot assign a role that is higher than me.\n\nThe role <@&${this.role.id}> is higher than my role <@&${this.botRole.id}> in the hierarchy.`).component] };
|
|
728
729
|
}
|
|
729
730
|
};
|
|
730
|
-
var CannotAssignBotRole = class extends
|
|
731
|
+
var CannotAssignBotRole = class extends _seedcord_core.Notice {
|
|
731
732
|
constructor(message = "I cannot assign a managed role.") {
|
|
732
733
|
super(message);
|
|
733
734
|
}
|
|
734
735
|
render() {
|
|
735
|
-
return { components: [new
|
|
736
|
+
return { components: [new _seedcord_core_internal.NoticeCard("I cannot assign a managed role.").component] };
|
|
736
737
|
}
|
|
737
738
|
};
|
|
738
|
-
var MissingPermissions = class extends
|
|
739
|
+
var MissingPermissions = class extends _seedcord_core.Notice {
|
|
739
740
|
where;
|
|
740
741
|
missingPerms;
|
|
741
742
|
constructor(message, where, missingPerms) {
|
|
@@ -745,10 +746,10 @@ var MissingPermissions = class extends _seedcord_kit.Notice {
|
|
|
745
746
|
}
|
|
746
747
|
render() {
|
|
747
748
|
const bullets = this.missingPerms.map((perm) => `• ${perm}`).join("\n");
|
|
748
|
-
return { components: [new
|
|
749
|
+
return { components: [new _seedcord_core_internal.NoticeCard(`The ${labelFor(this.where)} ${mentionFor(this.where)} is missing the following permission entries:\n\n${bullets}`).component] };
|
|
749
750
|
}
|
|
750
751
|
};
|
|
751
|
-
var HasDangerousPermissions = class extends
|
|
752
|
+
var HasDangerousPermissions = class extends _seedcord_core.Notice {
|
|
752
753
|
target;
|
|
753
754
|
dangerousPerms;
|
|
754
755
|
constructor(message, target, dangerousPerms) {
|
|
@@ -758,45 +759,45 @@ var HasDangerousPermissions = class extends _seedcord_kit.Notice {
|
|
|
758
759
|
}
|
|
759
760
|
render() {
|
|
760
761
|
const bullets = this.dangerousPerms.map((perm) => `• ${perm}`).join("\n");
|
|
761
|
-
return { components: [new
|
|
762
|
+
return { components: [new _seedcord_core_internal.NoticeCard(`The ${labelFor(this.target)} ${mentionFor(this.target)} has the following permission entries that must not be enabled:\n\n${bullets}`).component] };
|
|
762
763
|
}
|
|
763
764
|
};
|
|
764
|
-
var UserNotFound = class extends
|
|
765
|
+
var UserNotFound = class extends _seedcord_core.Notice {
|
|
765
766
|
userArg;
|
|
766
767
|
constructor(userArg) {
|
|
767
768
|
super(`User not found: ${userArg}`);
|
|
768
769
|
this.userArg = userArg;
|
|
769
770
|
}
|
|
770
771
|
render() {
|
|
771
|
-
return { components: [new
|
|
772
|
+
return { components: [new _seedcord_core_internal.NoticeCard(`User probably doesn't exist or was deleted.\n**User Argument:** \`${this.userArg}\`\nPlease check the user ID and try again. Only pass valid user IDs as the argument.`, "User Not Found").component] };
|
|
772
773
|
}
|
|
773
774
|
};
|
|
774
|
-
var UserNotInGuild = class extends
|
|
775
|
+
var UserNotInGuild = class extends _seedcord_core.Notice {
|
|
775
776
|
constructor(message = "User is not in the guild.") {
|
|
776
777
|
super(message);
|
|
777
778
|
}
|
|
778
779
|
render() {
|
|
779
|
-
return { components: [new
|
|
780
|
+
return { components: [new _seedcord_core_internal.NoticeCard(this.message).component] };
|
|
780
781
|
}
|
|
781
782
|
};
|
|
782
|
-
var RoleDoesNotExist = class extends
|
|
783
|
+
var RoleDoesNotExist = class extends _seedcord_core.Notice {
|
|
783
784
|
roleId;
|
|
784
785
|
constructor(message, roleId) {
|
|
785
786
|
super(message);
|
|
786
787
|
this.roleId = roleId;
|
|
787
788
|
}
|
|
788
789
|
render() {
|
|
789
|
-
return { components: [new
|
|
790
|
+
return { components: [new _seedcord_core_internal.NoticeCard(`The role with ID \`${this.roleId}\` does not exist.`).component] };
|
|
790
791
|
}
|
|
791
792
|
};
|
|
792
|
-
var CouldNotFindChannel = class extends
|
|
793
|
+
var CouldNotFindChannel = class extends _seedcord_core.Notice {
|
|
793
794
|
channelId;
|
|
794
795
|
constructor(message, channelId) {
|
|
795
796
|
super(message);
|
|
796
797
|
this.channelId = channelId;
|
|
797
798
|
}
|
|
798
799
|
render() {
|
|
799
|
-
return { components: [new
|
|
800
|
+
return { components: [new _seedcord_core_internal.NoticeCard(`Could not find channel with ID \`${this.channelId}\`. It could also be that the channel is not a text channel.`).component] };
|
|
800
801
|
}
|
|
801
802
|
};
|
|
802
803
|
|
|
@@ -823,7 +824,7 @@ function or(...args) {
|
|
|
823
824
|
await runCheck(gate, ctx);
|
|
824
825
|
return;
|
|
825
826
|
} catch (error) {
|
|
826
|
-
if (error instanceof
|
|
827
|
+
if (error instanceof _seedcord_core.Notice && !error.report) {
|
|
827
828
|
rollbackCommits(ctx, mark);
|
|
828
829
|
if (error.summary === void 0) everyArmHasSummary = false;
|
|
829
830
|
else summaries.push(error.summary);
|
|
@@ -1032,7 +1033,7 @@ function Cooldown(duration, options) {
|
|
|
1032
1033
|
* ```
|
|
1033
1034
|
*/
|
|
1034
1035
|
const IgnoreBots = defineGate("IgnoreBots", (ctx) => {
|
|
1035
|
-
if (ctx.user?.bot) throw new
|
|
1036
|
+
if (ctx.user?.bot) throw new _seedcord_core.Silence("actor is a bot");
|
|
1036
1037
|
});
|
|
1037
1038
|
|
|
1038
1039
|
//#endregion
|
|
@@ -1310,7 +1311,7 @@ var CommandMentionInjector = class {
|
|
|
1310
1311
|
allSlashBuilders() {
|
|
1311
1312
|
const registry = this.core.bot.commands;
|
|
1312
1313
|
if (!registry) return [];
|
|
1313
|
-
const slash = [...registry.globalCommands, ...registry.guildCommands.values()].flat().filter((command) => command instanceof
|
|
1314
|
+
const slash = [...registry.globalCommands, ...registry.guildCommands.values()].flat().filter((command) => command instanceof _discordjs_builders.SlashCommandBuilder);
|
|
1314
1315
|
return [...new Set(slash)];
|
|
1315
1316
|
}
|
|
1316
1317
|
indexByName(collection) {
|
|
@@ -1715,7 +1716,7 @@ const RESERVED_CONFIRM_PREFIX = "__seedcord_confirm";
|
|
|
1715
1716
|
*
|
|
1716
1717
|
* @internal
|
|
1717
1718
|
*/
|
|
1718
|
-
const CONFIRM_DEF = new
|
|
1719
|
+
const CONFIRM_DEF = new _seedcord_core.CustomId(RESERVED_CONFIRM_PREFIX).oneOf("choice", ["confirm", "cancel"]);
|
|
1719
1720
|
|
|
1720
1721
|
//#endregion
|
|
1721
1722
|
//#region src/bot/confirm/getConfirmation.ts
|
|
@@ -1724,16 +1725,16 @@ const CONFIRM_IDS = {
|
|
|
1724
1725
|
confirm: CONFIRM_DEF.encode({ choice: "confirm" }),
|
|
1725
1726
|
cancel: CONFIRM_DEF.encode({ choice: "cancel" })
|
|
1726
1727
|
};
|
|
1727
|
-
var ConfirmButtons = class extends
|
|
1728
|
+
var ConfirmButtons = class extends _seedcord_core.RowComponent {
|
|
1728
1729
|
constructor(options) {
|
|
1729
1730
|
super("button");
|
|
1730
|
-
this.instance.addComponents(new
|
|
1731
|
+
this.instance.addComponents(new _discordjs_builders.ButtonBuilder().setCustomId(CONFIRM_IDS.confirm).setLabel(options?.confirmLabel ?? "Confirm").setStyle(options?.confirmStyle ?? discord_js.ButtonStyle.Danger), new _discordjs_builders.ButtonBuilder().setCustomId(CONFIRM_IDS.cancel).setLabel(options?.cancelLabel ?? "Cancel").setStyle(discord_js.ButtonStyle.Secondary));
|
|
1731
1732
|
}
|
|
1732
1733
|
};
|
|
1733
|
-
var ConfirmPromptCard = class extends
|
|
1734
|
+
var ConfirmPromptCard = class extends _seedcord_core.BuilderComponent {
|
|
1734
1735
|
constructor(text, options) {
|
|
1735
1736
|
super("container");
|
|
1736
|
-
this.instance.addTextDisplayComponents(new
|
|
1737
|
+
this.instance.addTextDisplayComponents(new _discordjs_builders.TextDisplayBuilder().setContent(text)).addActionRowComponents(new ConfirmButtons(options).component);
|
|
1737
1738
|
}
|
|
1738
1739
|
};
|
|
1739
1740
|
function defaultPrompt(text, options) {
|
|
@@ -2170,14 +2171,14 @@ var AutocompleteHandler = class extends BaseHandler {
|
|
|
2170
2171
|
*/
|
|
2171
2172
|
var ComponentHandler = class extends InteractionHandler {
|
|
2172
2173
|
get registeredDefs() {
|
|
2173
|
-
const defs = Reflect.getMetadata(
|
|
2174
|
+
const defs = Reflect.getMetadata(_seedcord_core_internal.ComponentDefsKey, this.constructor);
|
|
2174
2175
|
if (!defs) throw new _seedcord_errors_internal.SeedcordError(_seedcord_errors.SeedcordErrorCode.CustomIdHandlerRouteMissing, [this.constructor.name]);
|
|
2175
2176
|
return defs;
|
|
2176
2177
|
}
|
|
2177
2178
|
decoded;
|
|
2178
2179
|
get route() {
|
|
2179
2180
|
if (this.decoded) return this.decoded;
|
|
2180
|
-
const decoded = (0,
|
|
2181
|
+
const decoded = (0, _seedcord_core_internal.decodeFor)(this.registeredDefs, this.event.customId);
|
|
2181
2182
|
this.decoded = decoded;
|
|
2182
2183
|
return decoded;
|
|
2183
2184
|
}
|
|
@@ -2424,8 +2425,8 @@ var Controls = class {
|
|
|
2424
2425
|
const { target, disabled } = this.navState(key);
|
|
2425
2426
|
const defaultLabel = key === "indicator" ? this.indicatorText() : DEFAULT_LABEL[key];
|
|
2426
2427
|
const label = cosmetics?.label ?? (key === "indicator" || !cosmetics?.emoji ? defaultLabel : void 0);
|
|
2427
|
-
const button = new
|
|
2428
|
-
page: Math.min(Math.max(0, target),
|
|
2428
|
+
const button = new _discordjs_builders.ButtonBuilder().setCustomId(this.cursor.encode({
|
|
2429
|
+
page: Math.min(Math.max(0, target), _seedcord_core_internal.PAGE_MAX),
|
|
2429
2430
|
slot: CONTROL_SLOT[key]
|
|
2430
2431
|
})).setStyle(cosmetics?.style ?? discord_js.ButtonStyle.Secondary).setDisabled(disabled);
|
|
2431
2432
|
if (label !== void 0) button.setLabel(label);
|
|
@@ -2447,8 +2448,8 @@ var Controls = class {
|
|
|
2447
2448
|
first: !hasPrev,
|
|
2448
2449
|
prev: !hasPrev,
|
|
2449
2450
|
indicator: true,
|
|
2450
|
-
next: !hasNext || page + 1 >
|
|
2451
|
-
last: !hasNext || !knownTotal || totalPages - 1 >
|
|
2451
|
+
next: !hasNext || page + 1 > _seedcord_core_internal.PAGE_MAX,
|
|
2452
|
+
last: !hasNext || !knownTotal || totalPages - 1 > _seedcord_core_internal.PAGE_MAX
|
|
2452
2453
|
}[key]
|
|
2453
2454
|
};
|
|
2454
2455
|
}
|
|
@@ -2460,7 +2461,7 @@ var Controls = class {
|
|
|
2460
2461
|
if (seen.has(key)) throw new _seedcord_errors_internal.SeedcordTypeError(_seedcord_errors.SeedcordErrorCode.PaginationDuplicateControls, [key]);
|
|
2461
2462
|
seen.add(key);
|
|
2462
2463
|
}
|
|
2463
|
-
return new
|
|
2464
|
+
return new _discordjs_builders.ActionRowBuilder().addComponents(keys.map((key) => this.button(key)));
|
|
2464
2465
|
}
|
|
2465
2466
|
indicatorText() {
|
|
2466
2467
|
const { page, totalPages } = this.view;
|
|
@@ -2470,14 +2471,14 @@ var Controls = class {
|
|
|
2470
2471
|
|
|
2471
2472
|
//#endregion
|
|
2472
2473
|
//#region src/pagination/render.ts
|
|
2473
|
-
var PageContainer = class extends
|
|
2474
|
+
var PageContainer = class extends _seedcord_core.BuilderComponent {
|
|
2474
2475
|
constructor(view, renderItem, controlRow) {
|
|
2475
2476
|
super("container");
|
|
2476
2477
|
const base = view.page * view.perPage;
|
|
2477
2478
|
let lines = [];
|
|
2478
2479
|
const flush = () => {
|
|
2479
2480
|
if (lines.length === 0) return;
|
|
2480
|
-
this.instance.addTextDisplayComponents(new
|
|
2481
|
+
this.instance.addTextDisplayComponents(new _discordjs_builders.TextDisplayBuilder().setContent(lines.join("\n")));
|
|
2481
2482
|
lines = [];
|
|
2482
2483
|
};
|
|
2483
2484
|
view.items.forEach((item, offset) => {
|
|
@@ -2494,7 +2495,7 @@ var PageContainer = class extends _seedcord_kit.BuilderComponent {
|
|
|
2494
2495
|
}
|
|
2495
2496
|
};
|
|
2496
2497
|
function toReplyResponse(renderable) {
|
|
2497
|
-
if (typeof renderable === "string") return { components: [new
|
|
2498
|
+
if (typeof renderable === "string") return { components: [new _discordjs_builders.TextDisplayBuilder().setContent(renderable)] };
|
|
2498
2499
|
if (Array.isArray(renderable)) return { components: renderable };
|
|
2499
2500
|
return renderable;
|
|
2500
2501
|
}
|
|
@@ -2556,7 +2557,7 @@ var Paginator = class {
|
|
|
2556
2557
|
Handler;
|
|
2557
2558
|
config;
|
|
2558
2559
|
constructor(config) {
|
|
2559
|
-
this.cursor = (0,
|
|
2560
|
+
this.cursor = (0, _seedcord_core_internal.pageCursor)(config.prefix);
|
|
2560
2561
|
this.config = config;
|
|
2561
2562
|
const loadPage = (ctx, n) => this.page(ctx, n);
|
|
2562
2563
|
this.Handler = class Nav extends ButtonHandler {
|
|
@@ -2597,7 +2598,7 @@ var ArraySource = class {
|
|
|
2597
2598
|
if (!Number.isSafeInteger(this.perPage) || this.perPage <= 0) throw new _seedcord_errors_internal.SeedcordRangeError(_seedcord_errors.SeedcordErrorCode.PaginationInvalidPerPage, [this.perPage]);
|
|
2598
2599
|
}
|
|
2599
2600
|
async page(ctx, n) {
|
|
2600
|
-
return (0,
|
|
2601
|
+
return (0, _seedcord_core.paginate)(await this.load(ctx), n, this.perPage);
|
|
2601
2602
|
}
|
|
2602
2603
|
};
|
|
2603
2604
|
/**
|
|
@@ -2889,7 +2890,7 @@ function contextMenuLeaves(commands) {
|
|
|
2889
2890
|
const user = /* @__PURE__ */ new Set();
|
|
2890
2891
|
const message = /* @__PURE__ */ new Set();
|
|
2891
2892
|
for (const command of commands) {
|
|
2892
|
-
if (!(command instanceof
|
|
2893
|
+
if (!(command instanceof _discordjs_builders.ContextMenuCommandBuilder)) continue;
|
|
2893
2894
|
if (command.type === discord_js.ApplicationCommandType.User) user.add(command.name);
|
|
2894
2895
|
else message.add(command.name);
|
|
2895
2896
|
}
|
|
@@ -2912,7 +2913,7 @@ function contextMenuLeaves(commands) {
|
|
|
2912
2913
|
function slashRouteLeaves(commands) {
|
|
2913
2914
|
const leaves = /* @__PURE__ */ new Set();
|
|
2914
2915
|
for (const command of commands) {
|
|
2915
|
-
if (!(command instanceof
|
|
2916
|
+
if (!(command instanceof _discordjs_builders.SlashCommandBuilder)) continue;
|
|
2916
2917
|
for (const leaf of (0, _seedcord_utils_internal.routeLeavesOf)(command.toJSON())) leaves.add(leaf.route);
|
|
2917
2918
|
}
|
|
2918
2919
|
return leaves;
|
|
@@ -3002,13 +3003,13 @@ var CommandRegistry = class {
|
|
|
3002
3003
|
}
|
|
3003
3004
|
isCommandClass(obj) {
|
|
3004
3005
|
if (typeof obj !== "function") return false;
|
|
3005
|
-
return obj.prototype instanceof
|
|
3006
|
+
return obj.prototype instanceof _seedcord_core.BuilderComponent && Reflect.hasMetadata(CommandMetadataKey, obj);
|
|
3006
3007
|
}
|
|
3007
3008
|
registerCommand(ctor, rel) {
|
|
3008
3009
|
const meta = Reflect.getMetadata(CommandMetadataKey, ctor);
|
|
3009
3010
|
if (!meta) return;
|
|
3010
3011
|
const comp = new ctor().component;
|
|
3011
|
-
const commandType = comp instanceof
|
|
3012
|
+
const commandType = comp instanceof _discordjs_builders.SlashCommandBuilder ? "slash command" : "context menu command";
|
|
3012
3013
|
if (meta.scope === "global") {
|
|
3013
3014
|
this.globalCommands.push(comp);
|
|
3014
3015
|
this.logger.utils.registration(ctor.name, rel);
|
|
@@ -3141,7 +3142,7 @@ function extractErrorResponse(error, core, origin) {
|
|
|
3141
3142
|
uuid,
|
|
3142
3143
|
developerUsername
|
|
3143
3144
|
};
|
|
3144
|
-
if (error instanceof
|
|
3145
|
+
if (error instanceof _seedcord_core.Notice) {
|
|
3145
3146
|
if (error.report) reportFault(error, core, origin, uuid);
|
|
3146
3147
|
return {
|
|
3147
3148
|
uuid,
|
|
@@ -3152,7 +3153,7 @@ function extractErrorResponse(error, core, origin) {
|
|
|
3152
3153
|
const override = core.config.errors?.defaultError;
|
|
3153
3154
|
return {
|
|
3154
3155
|
uuid,
|
|
3155
|
-
response: override ? new override(uuid).render(ctx) : new
|
|
3156
|
+
response: override ? new override(uuid).render(ctx) : new _seedcord_core.Fault().render(ctx)
|
|
3156
3157
|
};
|
|
3157
3158
|
}
|
|
3158
3159
|
function withThrottle(origin, error, publish) {
|
|
@@ -3219,7 +3220,7 @@ function buildEventSource(event, origin) {
|
|
|
3219
3220
|
};
|
|
3220
3221
|
}
|
|
3221
3222
|
function faultKey(origin, error) {
|
|
3222
|
-
const name = error instanceof
|
|
3223
|
+
const name = error instanceof _seedcord_core.Notice ? error.name : error instanceof discord_js.DiscordAPIError ? String(error.code) : error.constructor.name;
|
|
3223
3224
|
if (origin.event) return `${origin.event.name}:${origin.event.handler}:${name}`;
|
|
3224
3225
|
if (origin.interaction) return `${interactionRoute(origin.interaction)}:${name}`;
|
|
3225
3226
|
if (origin.route) return `autocomplete:${origin.route}:${name}`;
|
|
@@ -3228,7 +3229,7 @@ function faultKey(origin, error) {
|
|
|
3228
3229
|
function interactionRoute(interaction) {
|
|
3229
3230
|
if (interaction.isChatInputCommand()) return slashRouteOf(interaction);
|
|
3230
3231
|
if (interaction.isContextMenuCommand()) return interaction.commandName;
|
|
3231
|
-
if (interaction.isButton() || interaction.isAnySelectMenu() || interaction.isModalSubmit()) return (0,
|
|
3232
|
+
if (interaction.isButton() || interaction.isAnySelectMenu() || interaction.isModalSubmit()) return (0, _seedcord_core_internal.prefixOf)(interaction.customId) || interaction.customId;
|
|
3232
3233
|
return "interaction";
|
|
3233
3234
|
}
|
|
3234
3235
|
function buildInteractionSource(interaction) {
|
|
@@ -3265,7 +3266,7 @@ const logger$1 = new _seedcord_services.Logger("EventBoundary");
|
|
|
3265
3266
|
* @internal
|
|
3266
3267
|
*/
|
|
3267
3268
|
function handleEventFault(caught, eventName, handlerName, args, core) {
|
|
3268
|
-
if (caught instanceof
|
|
3269
|
+
if (caught instanceof _seedcord_core.Silence) {
|
|
3269
3270
|
if (caught.reason !== void 0) logger$1.debug(`Silence: ${caught.reason}`);
|
|
3270
3271
|
return;
|
|
3271
3272
|
}
|
|
@@ -3275,7 +3276,7 @@ function handleEventFault(caught, eventName, handlerName, args, core) {
|
|
|
3275
3276
|
logger$1.debug(`swallowed api code ${caught.code}`);
|
|
3276
3277
|
return;
|
|
3277
3278
|
}
|
|
3278
|
-
if (caught instanceof
|
|
3279
|
+
if (caught instanceof _seedcord_core.Notice && !caught.report) return;
|
|
3279
3280
|
const actor = deriveEventActor(args);
|
|
3280
3281
|
extractErrorResponse(caught, core, {
|
|
3281
3282
|
event: {
|
|
@@ -3303,7 +3304,7 @@ var EventDispatcher = class {
|
|
|
3303
3304
|
logger = new _seedcord_services.Logger("Events");
|
|
3304
3305
|
isInitialized = false;
|
|
3305
3306
|
name = "Events";
|
|
3306
|
-
eventMap = new
|
|
3307
|
+
eventMap = /* @__PURE__ */ new Map();
|
|
3307
3308
|
middlewares = [];
|
|
3308
3309
|
executedOnceHandlers = /* @__PURE__ */ new Set();
|
|
3309
3310
|
attachedEvents = /* @__PURE__ */ new Set();
|
|
@@ -3514,7 +3515,7 @@ const logger = new _seedcord_services.Logger("InteractionBoundary");
|
|
|
3514
3515
|
* @internal
|
|
3515
3516
|
*/
|
|
3516
3517
|
async function handleInteractionFault(caught, interaction, core) {
|
|
3517
|
-
if (caught instanceof
|
|
3518
|
+
if (caught instanceof _seedcord_core.Silence) {
|
|
3518
3519
|
if (caught.reason !== void 0) logger.debug(`Silence: ${caught.reason}`);
|
|
3519
3520
|
return;
|
|
3520
3521
|
}
|
|
@@ -3539,7 +3540,7 @@ async function handleInteractionFault(caught, interaction, core) {
|
|
|
3539
3540
|
user: interaction.user,
|
|
3540
3541
|
metadata: interaction
|
|
3541
3542
|
});
|
|
3542
|
-
await new ReplySender(interaction).send(response, caught instanceof
|
|
3543
|
+
await new ReplySender(interaction).send(response, caught instanceof _seedcord_core.Notice ? caught.ephemeral : true);
|
|
3543
3544
|
}
|
|
3544
3545
|
|
|
3545
3546
|
//#endregion
|
|
@@ -3555,17 +3556,17 @@ var InteractionDispatcher = class {
|
|
|
3555
3556
|
logger = new _seedcord_services.Logger("Interactions");
|
|
3556
3557
|
isInitialized = false;
|
|
3557
3558
|
name = "Interactions";
|
|
3558
|
-
slashMap = new
|
|
3559
|
-
buttonMap = new
|
|
3560
|
-
modalMap = new
|
|
3561
|
-
stringSelectMap = new
|
|
3562
|
-
userSelectMap = new
|
|
3563
|
-
roleSelectMap = new
|
|
3564
|
-
channelSelectMap = new
|
|
3565
|
-
mentionableSelectMap = new
|
|
3566
|
-
messageContextMenuMap = new
|
|
3567
|
-
userContextMenuMap = new
|
|
3568
|
-
autocompleteMap = new
|
|
3559
|
+
slashMap = /* @__PURE__ */ new Map();
|
|
3560
|
+
buttonMap = /* @__PURE__ */ new Map();
|
|
3561
|
+
modalMap = /* @__PURE__ */ new Map();
|
|
3562
|
+
stringSelectMap = /* @__PURE__ */ new Map();
|
|
3563
|
+
userSelectMap = /* @__PURE__ */ new Map();
|
|
3564
|
+
roleSelectMap = /* @__PURE__ */ new Map();
|
|
3565
|
+
channelSelectMap = /* @__PURE__ */ new Map();
|
|
3566
|
+
mentionableSelectMap = /* @__PURE__ */ new Map();
|
|
3567
|
+
messageContextMenuMap = /* @__PURE__ */ new Map();
|
|
3568
|
+
userContextMenuMap = /* @__PURE__ */ new Map();
|
|
3569
|
+
autocompleteMap = /* @__PURE__ */ new Map();
|
|
3569
3570
|
keysToIgnore = /* @__PURE__ */ new Set();
|
|
3570
3571
|
middlewares = [];
|
|
3571
3572
|
hmrHandler;
|
|
@@ -3751,7 +3752,7 @@ var InteractionDispatcher = class {
|
|
|
3751
3752
|
}
|
|
3752
3753
|
async handleCustomIdInteraction(interaction, getMap, interactionType) {
|
|
3753
3754
|
if ([...this.keysToIgnore].some((matcher) => matcher.owns(interaction.customId))) return;
|
|
3754
|
-
const prefix = (0,
|
|
3755
|
+
const prefix = (0, _seedcord_core_internal.prefixOf)(interaction.customId);
|
|
3755
3756
|
if (!prefix) return this.logger.warn(`${interactionType} has invalid customId: ${interaction.customId}`);
|
|
3756
3757
|
await this.processInteraction(interaction, () => prefix, (key) => getMap().get(key));
|
|
3757
3758
|
}
|
|
@@ -4027,7 +4028,7 @@ function jsonAttachment(name, description, data) {
|
|
|
4027
4028
|
*
|
|
4028
4029
|
* @internal
|
|
4029
4030
|
*/
|
|
4030
|
-
var WebhookSeparator = class extends
|
|
4031
|
+
var WebhookSeparator = class extends _seedcord_core.BuilderComponent {
|
|
4031
4032
|
constructor() {
|
|
4032
4033
|
super("separator");
|
|
4033
4034
|
this.instance.setSpacing(discord_js.SeparatorSpacingSize.Small).setDivider(true);
|
|
@@ -4066,7 +4067,7 @@ let HandledException = class HandledException extends WebhookLog {
|
|
|
4066
4067
|
};
|
|
4067
4068
|
__decorate([(0, envapt.Envapt)("HANDLED_EXCEPTION_WEBHOOK_URL", { converter: (raw) => webhookUrlValidator$1(raw) }), __decorateMetadata("design:type", String)], HandledException, "handledExceptionWebhookUrl", void 0);
|
|
4068
4069
|
HandledException = _HandledException = __decorate([Subscribe("handledException")], HandledException);
|
|
4069
|
-
var HandledExceptionContainer = class extends
|
|
4070
|
+
var HandledExceptionContainer = class extends _seedcord_core.BuilderComponent {
|
|
4070
4071
|
constructor(data) {
|
|
4071
4072
|
super("container");
|
|
4072
4073
|
const { denial, uuid, source } = data;
|
|
@@ -4136,7 +4137,7 @@ let UnknownException = class UnknownException extends WebhookLog {
|
|
|
4136
4137
|
};
|
|
4137
4138
|
__decorate([(0, envapt.Envapt)("UNKNOWN_EXCEPTION_WEBHOOK_URL", { converter: (raw) => webhookUrlValidator(raw) }), __decorateMetadata("design:type", String)], UnknownException, "unknownExceptionWebhookUrl", void 0);
|
|
4138
4139
|
UnknownException = _UnknownException = __decorate([Subscribe("unknownException")], UnknownException);
|
|
4139
|
-
var UnhandledErrorContainer = class extends
|
|
4140
|
+
var UnhandledErrorContainer = class extends _seedcord_core.BuilderComponent {
|
|
4140
4141
|
constructor(data) {
|
|
4141
4142
|
super("container");
|
|
4142
4143
|
const { uuid, error, guild, user, metadata } = data;
|
|
@@ -4177,7 +4178,7 @@ var Bus = class extends Plugin {
|
|
|
4177
4178
|
/** @internal */
|
|
4178
4179
|
name = "Subscribers";
|
|
4179
4180
|
isInitialized = false;
|
|
4180
|
-
subscribersMap = new
|
|
4181
|
+
subscribersMap = /* @__PURE__ */ new Map();
|
|
4181
4182
|
executedOnceHandlers = /* @__PURE__ */ new Set();
|
|
4182
4183
|
hmrHandler;
|
|
4183
4184
|
constructor(core) {
|
|
@@ -4330,7 +4331,7 @@ var Seedcord = class Seedcord extends Pluggable {
|
|
|
4330
4331
|
const startup = new _seedcord_services.CoordinatedStartup();
|
|
4331
4332
|
super(shutdown, startup);
|
|
4332
4333
|
this.config = config;
|
|
4333
|
-
(0,
|
|
4334
|
+
(0, _seedcord_core_internal.setBotColor)(config.botColor);
|
|
4334
4335
|
this.shutdown = shutdown;
|
|
4335
4336
|
this.startup = startup;
|
|
4336
4337
|
this.hmrManager = new HmrManager();
|
|
@@ -4392,7 +4393,7 @@ var Seedcord = class Seedcord extends Pluggable {
|
|
|
4392
4393
|
//#endregion
|
|
4393
4394
|
//#region src/index.ts
|
|
4394
4395
|
/** Package version */
|
|
4395
|
-
const version = "0.16.0-next.
|
|
4396
|
+
const version = "0.16.0-next.3";
|
|
4396
4397
|
|
|
4397
4398
|
//#endregion
|
|
4398
4399
|
exports.ArraySource = ArraySource;
|
|
@@ -4456,17 +4457,17 @@ exports.hasPermsToAssign = hasPermsToAssign;
|
|
|
4456
4457
|
exports.or = or;
|
|
4457
4458
|
exports.updateMemberRoles = updateMemberRoles;
|
|
4458
4459
|
exports.version = version;
|
|
4459
|
-
Object.keys(
|
|
4460
|
+
Object.keys(_seedcord_core).forEach(function (k) {
|
|
4460
4461
|
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
4461
4462
|
enumerable: true,
|
|
4462
|
-
get: function () { return
|
|
4463
|
+
get: function () { return _seedcord_core[k]; }
|
|
4463
4464
|
});
|
|
4464
4465
|
});
|
|
4465
4466
|
|
|
4466
|
-
Object.keys(
|
|
4467
|
+
Object.keys(_seedcord_errors).forEach(function (k) {
|
|
4467
4468
|
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
4468
4469
|
enumerable: true,
|
|
4469
|
-
get: function () { return
|
|
4470
|
+
get: function () { return _seedcord_errors[k]; }
|
|
4470
4471
|
});
|
|
4471
4472
|
});
|
|
4472
4473
|
|