@seedcord/gateway 0.1.1 → 0.1.2

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 CHANGED
@@ -284,12 +284,6 @@ const emojiStorage = (0, _seedcord_core_internal.accessorStore)();
284
284
  * A read before that throws.
285
285
  */
286
286
  const Emojis = (0, _seedcord_core_internal.guardedAccessor)("Emojis", emojiStorage);
287
- /**
288
- * Loads and injects emojis based on bot configuration. A guild emoji requires the Guilds intent in the client
289
- * options.
290
- *
291
- * @internal
292
- */
293
287
  var EmojiInjector = class {
294
288
  core;
295
289
  logger = new _seedcord_logger.Logger("Emojis", { channel: "bot" });
@@ -453,12 +447,6 @@ function hasPermsToAssign(roleOrOptions) {
453
447
  //#endregion
454
448
  //#region src/bot/confirm/reserved.ts
455
449
  const RESERVED_CONFIRM_PREFIX = "__seedcord_confirm";
456
- /**
457
- * The reserved confirm/cancel codec. It has no route, so the dispatcher ignores its clicks and only the
458
- * in-process collector reads them. Do not mint a real component from it.
459
- *
460
- * @internal
461
- */
462
450
  const CONFIRM_DEF = new _seedcord_core.CustomId(RESERVED_CONFIRM_PREFIX).oneOf("choice", ["confirm", "cancel"]);
463
451
 
464
452
  //#endregion
@@ -525,7 +513,6 @@ async function getConfirmation(handler, prompt, options) {
525
513
  * gate hook.
526
514
  */
527
515
  var BaseHandler = class extends _seedcord_core.BaseHandler {
528
- /** @internal */
529
516
  getEvent() {
530
517
  return this.event;
531
518
  }
@@ -567,10 +554,7 @@ function seedState(interaction) {
567
554
  if (interaction.deferred) return "deferred-reply";
568
555
  return "unacked";
569
556
  }
570
- /**
571
- * Writes interaction responses through the discord.js interaction. Construction is internal to the repliable
572
- * handler bases and the dispatcher.
573
- */
557
+ /** Writes interaction responses through discord.js. The repliable handler bases and the dispatcher construct it. */
574
558
  var ReplySender = class extends _seedcord_core_internal.BaseReplySender {
575
559
  interaction;
576
560
  constructor(interaction, routeId, bus) {
@@ -716,13 +700,6 @@ var InteractionHandler = class extends RepliableHandler {
716
700
 
717
701
  //#endregion
718
702
  //#region src/bot/utilities/miscellaneous/slashRouteOf.ts
719
- /**
720
- * Computes the dispatch route for a chat-input or autocomplete interaction. The controller and
721
- * `seedcord codegen` both assemble route keys through the same {@link buildSlashRoute}, so a dispatched
722
- * interaction and a generated registry key always match.
723
- *
724
- * @internal
725
- */
726
703
  function slashRouteOf(interaction) {
727
704
  const group = interaction.options.getSubcommandGroup(false) ?? void 0;
728
705
  const subcommand = interaction.options.getSubcommand(false) ?? void 0;
@@ -874,8 +851,8 @@ var AutocompleteHandler = class extends BaseHandler {
874
851
  return focused;
875
852
  }
876
853
  /**
877
- * Run the arm for the focused field. An autocomplete always dispatches by which field is focused, so
878
- * match is how you read it. There is no single-field shortcut the way slash/component handlers have one.
854
+ * Run the arm for the focused field. Because an autocomplete always dispatches by which field is
855
+ * focused, match is how you read it. There is no single-field shortcut the way slash/component handlers have one.
879
856
  *
880
857
  * Provide one arm per autocompletable field across the registered commands, keyed by field name. Each
881
858
  * arm receives the focused partial value and a `respond` typed to that field's choice value. The
@@ -958,7 +935,7 @@ var ComponentHandler = class extends InteractionHandler {
958
935
  * Reading this decodes `this.event.customId` once (cached after the first read) and throws
959
936
  * `StaleCustomId` or `InvalidCustomId` when the wire no longer matches the current shape, which the
960
937
  * controller boundary turns into a reply. On a handler registered for several routes this is
961
- * `never`, so use {@link match} instead.
938
+ * `never`. Use {@link match} instead.
962
939
  */
963
940
  get params() {
964
941
  return this.route.params;
@@ -966,7 +943,7 @@ var ComponentHandler = class extends InteractionHandler {
966
943
  /**
967
944
  * Run the arm for whichever route the component was minted from. Use this only when the handler is
968
945
  * registered for several routes. A single-route handler reads `this.params` directly. On a multi-route
969
- * handler `this.params` is `never`, so match is the only way to read the decoded params.
946
+ * handler `this.params` is `never`, leaving match as the only way to read the decoded params.
970
947
  *
971
948
  * Provide one arm per registered route, keyed by its prefix, and each arm receives that route's own
972
949
  * decoded params. The arms cover every registered route prefix, checked at compile time, and a prefix
@@ -1370,14 +1347,6 @@ function eventGateContext(eventName, args, core) {
1370
1347
  //#endregion
1371
1348
  //#region src/miscellaneous/extractErrorResponse.ts
1372
1349
  const logger$2 = new _seedcord_logger.Logger("ErrorsHandling", { channel: "errors" });
1373
- /**
1374
- * Processes an error into a user-facing reply and routes its report.
1375
- *
1376
- * A {@link Notice} always renders its own reply. A reporting denial (`report: true`) additionally
1377
- * publishes `handledException` on the interaction path. A raw, non-denial throw publishes
1378
- * `unknownException` and renders the configured `defaultError` (or a generic {@link Fault}). One uuid is
1379
- * threaded into both the reply and the bus payload.
1380
- */
1381
1350
  function extractErrorResponse(error, core, origin) {
1382
1351
  const uuid = node_crypto.randomUUID();
1383
1352
  const developerUsername = core.config.notifications?.developerUsername;
@@ -1518,13 +1487,6 @@ function interactionKind(interaction) {
1518
1487
  //#endregion
1519
1488
  //#region src/bot/handleEventFault.ts
1520
1489
  const logger$1 = new _seedcord_logger.Logger("Faults", { channel: "errors" });
1521
- /**
1522
- * The event controller boundary. Reports a throw from an event handler and never replies, since a
1523
- * generic event has no reply target. A {@link Silence} or a non-reporting {@link Notice} stops quietly, a
1524
- * reporting denial or a raw error publishes a fault with a best-effort actor derived from the args.
1525
- *
1526
- * @internal
1527
- */
1528
1490
  function handleEventFault(caught, eventName, handlerName, args, core) {
1529
1491
  if (caught instanceof _seedcord_core.Silence) {
1530
1492
  if (caught.reason !== void 0 && (core.config.errors?.logSilences ?? true)) logger$1.debug(`Silence: ${caught.reason}`);
@@ -1553,9 +1515,7 @@ function handleEventFault(caught, eventName, handlerName, args, core) {
1553
1515
  //#endregion
1554
1516
  //#region src/bot/controllers/EventDispatcher.ts
1555
1517
  /**
1556
- * Scans event handler directories, attaches one client listener per registered event, and runs the
1557
- * handlers for each fire. Interactions route through InteractionDispatcher. Multiple handlers can
1558
- * point to one event.
1518
+ * Interactions route through InteractionDispatcher.
1559
1519
  *
1560
1520
  * @internal
1561
1521
  */
@@ -1643,7 +1603,7 @@ var EventDispatcher = class {
1643
1603
  }
1644
1604
  });
1645
1605
  }
1646
- /** @internal For use in dev mode */
1606
+ /** @internal */
1647
1607
  async onHmr(event) {
1648
1608
  await this.hmrHandler?.handle(event);
1649
1609
  }
@@ -1781,9 +1741,6 @@ var EventDispatcher = class {
1781
1741
 
1782
1742
  //#endregion
1783
1743
  //#region src/bot/defaults/UnhandledRepliable.ts
1784
- /**
1785
- * @internal Default handler for unhandled repliable interactions.
1786
- */
1787
1744
  var UnhandledRepliable = class extends InteractionHandler {
1788
1745
  async execute() {
1789
1746
  await this.reply("Feature not implemented yet.");
@@ -1792,9 +1749,6 @@ var UnhandledRepliable = class extends InteractionHandler {
1792
1749
 
1793
1750
  //#endregion
1794
1751
  //#region src/bot/defaults/UnhandledAutocomplete.ts
1795
- /**
1796
- * @internal Default handler for an autocomplete with no registered handler.
1797
- */
1798
1752
  var UnhandledAutocomplete = class extends AutocompleteHandler {
1799
1753
  async execute() {
1800
1754
  await this.respond([]);
@@ -1818,14 +1772,6 @@ const HARMLESS_API_CODES = /* @__PURE__ */ new Set([
1818
1772
  //#endregion
1819
1773
  //#region src/bot/handleInteractionFault.ts
1820
1774
  const logger = new _seedcord_logger.Logger("Faults", { channel: "errors" });
1821
- /**
1822
- * The interaction controller boundary. Sorts a throw from any handler-lifecycle phase into the right
1823
- * user reply plus the right bus event. When a handler is built its sender is passed in, so the boundary
1824
- * sends from the current ack state. A middleware or pre-construction throw arrives with no sender, so the
1825
- * boundary builds one from the interaction flags.
1826
- *
1827
- * @internal
1828
- */
1829
1775
  async function handleInteractionFault(caught, interaction, core, routeId, sender) {
1830
1776
  if (caught instanceof _seedcord_core.Silence) {
1831
1777
  if (caught.reason !== void 0 && (core.config.errors?.logSilences ?? true)) logger.debug(`Silence: ${caught.reason}`);
@@ -1880,12 +1826,6 @@ async function sendGuarded(sender, response, ephemeral) {
1880
1826
 
1881
1827
  //#endregion
1882
1828
  //#region src/bot/controllers/InteractionDispatcher.ts
1883
- /**
1884
- * Scans handler directories, routes each interaction to its registered handler, and runs the handler.
1885
- * One handler per interaction.
1886
- *
1887
- * @internal
1888
- */
1889
1829
  var InteractionDispatcher = class {
1890
1830
  core;
1891
1831
  logger = new _seedcord_logger.Logger("Interactions", { channel: "interactions" });
@@ -2066,7 +2006,6 @@ var InteractionDispatcher = class {
2066
2006
  from
2067
2007
  });
2068
2008
  }
2069
- /** @internal For use in dev mode */
2070
2009
  async onHmr(event) {
2071
2010
  await this.hmrHandler?.handle(event);
2072
2011
  }
@@ -2370,7 +2309,7 @@ __decorate([(0, envapt_legacy.Envapt)("DISCORD_BOT_TOKEN", { converter: (raw) =>
2370
2309
  //#endregion
2371
2310
  //#region src/version.ts
2372
2311
  /** Package version */
2373
- const version = "0.1.1";
2312
+ const version = "0.1.2";
2374
2313
 
2375
2314
  //#endregion
2376
2315
  //#region src/Seedcord.ts
@@ -2471,6 +2410,7 @@ var Seedcord = class Seedcord extends _seedcord_core_node_internal.Pluggable {
2471
2410
  //#endregion
2472
2411
  exports.ArraySource = ArraySource;
2473
2412
  exports.AutocompleteHandler = AutocompleteHandler;
2413
+ exports.BaseHandler = BaseHandler;
2474
2414
  exports.ButtonHandler = ButtonHandler;
2475
2415
  exports.ContextMenuHandler = ContextMenuHandler;
2476
2416
  exports.CursorSource = CursorSource;