@azurioh/discord-kernel 0.1.0 → 1.0.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/README.md +318 -1
- package/dist/authz/require-level-guard.d.ts +1 -1
- package/dist/authz/require-level-guard.d.ts.map +1 -1
- package/dist/color.d.ts +42 -0
- package/dist/color.d.ts.map +1 -0
- package/dist/color.js +130 -0
- package/dist/color.js.map +1 -0
- package/dist/discord/command/all-required.d.ts +8 -0
- package/dist/discord/command/all-required.d.ts.map +1 -0
- package/dist/discord/command/all-required.js +12 -0
- package/dist/discord/command/all-required.js.map +1 -0
- package/dist/discord/command/autocomplete-dispatcher.d.ts.map +1 -1
- package/dist/discord/command/autocomplete-dispatcher.js +2 -1
- package/dist/discord/command/autocomplete-dispatcher.js.map +1 -1
- package/dist/discord/command/autocomplete-limits.d.ts +3 -0
- package/dist/discord/command/autocomplete-limits.d.ts.map +1 -0
- package/dist/discord/command/autocomplete-limits.js +6 -0
- package/dist/discord/command/autocomplete-limits.js.map +1 -0
- package/dist/discord/command/autocomplete.d.ts +6 -1
- package/dist/discord/command/autocomplete.d.ts.map +1 -1
- package/dist/discord/command/autocomplete.js +6 -6
- package/dist/discord/command/autocomplete.js.map +1 -1
- package/dist/discord/command/command-responders.d.ts +26 -0
- package/dist/discord/command/command-responders.d.ts.map +1 -0
- package/dist/discord/command/command-responders.js +16 -0
- package/dist/discord/command/command-responders.js.map +1 -0
- package/dist/discord/command/context.d.ts +8 -17
- package/dist/discord/command/context.d.ts.map +1 -1
- package/dist/discord/command/context.js +8 -37
- package/dist/discord/command/context.js.map +1 -1
- package/dist/discord/command/cooldown-guard.d.ts +1 -1
- package/dist/discord/command/cooldown-guard.d.ts.map +1 -1
- package/dist/discord/command/create-command.d.ts +1 -8
- package/dist/discord/command/create-command.d.ts.map +1 -1
- package/dist/discord/command/create-command.js +17 -65
- package/dist/discord/command/create-command.js.map +1 -1
- package/dist/discord/command/create-context-menu-command.d.ts +3 -9
- package/dist/discord/command/create-context-menu-command.d.ts.map +1 -1
- package/dist/discord/command/create-context-menu-command.js +14 -65
- package/dist/discord/command/create-context-menu-command.js.map +1 -1
- package/dist/discord/command/errors.d.ts +1 -1
- package/dist/discord/command/errors.d.ts.map +1 -1
- package/dist/discord/command/errors.js +2 -2
- package/dist/discord/command/errors.js.map +1 -1
- package/dist/discord/command/guard.d.ts +15 -8
- package/dist/discord/command/guard.d.ts.map +1 -1
- package/dist/discord/command/guard.js +4 -4
- package/dist/discord/command/guard.js.map +1 -1
- package/dist/discord/command/options.d.ts +1 -10
- package/dist/discord/command/options.d.ts.map +1 -1
- package/dist/discord/command/options.js +127 -320
- package/dist/discord/command/options.js.map +1 -1
- package/dist/discord/command/passes-guard.d.ts +14 -0
- package/dist/discord/command/passes-guard.d.ts.map +1 -0
- package/dist/discord/command/passes-guard.js +27 -0
- package/dist/discord/command/passes-guard.js.map +1 -0
- package/dist/discord/command/permission-guard.d.ts +1 -1
- package/dist/discord/command/permission-guard.d.ts.map +1 -1
- package/dist/discord/command/render-command-failure.d.ts +23 -0
- package/dist/discord/command/render-command-failure.d.ts.map +1 -0
- package/dist/discord/command/render-command-failure.js +40 -0
- package/dist/discord/command/render-command-failure.js.map +1 -0
- package/dist/discord/command/route-key.d.ts +8 -0
- package/dist/discord/command/route-key.d.ts.map +1 -0
- package/dist/discord/command/route-key.js +13 -0
- package/dist/discord/command/route-key.js.map +1 -0
- package/dist/discord/command/router.d.ts +32 -7
- package/dist/discord/command/router.d.ts.map +1 -1
- package/dist/discord/command/router.js +48 -10
- package/dist/discord/command/router.js.map +1 -1
- package/dist/discord/command/send-embed.d.ts +14 -0
- package/dist/discord/command/send-embed.d.ts.map +1 -0
- package/dist/discord/command/send-embed.js +37 -0
- package/dist/discord/command/send-embed.js.map +1 -0
- package/dist/discord/command/types.d.ts +7 -1
- package/dist/discord/command/types.d.ts.map +1 -1
- package/dist/discord/components/component-access.d.ts +12 -0
- package/dist/discord/components/component-access.d.ts.map +1 -0
- package/dist/discord/components/component-access.js +21 -0
- package/dist/discord/components/component-access.js.map +1 -0
- package/dist/discord/components/component-router.d.ts +37 -15
- package/dist/discord/components/component-router.d.ts.map +1 -1
- package/dist/discord/components/component-router.js +44 -32
- package/dist/discord/components/component-router.js.map +1 -1
- package/dist/discord/components/interactive-message/index.d.ts +3 -1
- package/dist/discord/components/interactive-message/index.d.ts.map +1 -1
- package/dist/discord/components/interactive-message/index.js +5 -3
- package/dist/discord/components/interactive-message/index.js.map +1 -1
- package/dist/discord/components/interactive-message/interactive-message-collector.d.ts +3 -28
- package/dist/discord/components/interactive-message/interactive-message-collector.d.ts.map +1 -1
- package/dist/discord/components/interactive-message/interactive-message-collector.js +6 -53
- package/dist/discord/components/interactive-message/interactive-message-collector.js.map +1 -1
- package/dist/discord/components/interactive-message/message-edit-options.d.ts +18 -0
- package/dist/discord/components/interactive-message/message-edit-options.d.ts.map +1 -0
- package/dist/discord/components/interactive-message/message-edit-options.js +40 -0
- package/dist/discord/components/interactive-message/message-edit-options.js.map +1 -0
- package/dist/discord/components/interactive-message/mount-interactive-message.d.ts +2 -1
- package/dist/discord/components/interactive-message/mount-interactive-message.d.ts.map +1 -1
- package/dist/discord/components/interactive-message/mount-interactive-message.js +4 -2
- package/dist/discord/components/interactive-message/mount-interactive-message.js.map +1 -1
- package/dist/discord/components/interactive-message/state-store.d.ts +12 -0
- package/dist/discord/components/interactive-message/state-store.d.ts.map +1 -0
- package/dist/discord/components/interactive-message/state-store.js +14 -0
- package/dist/discord/components/interactive-message/state-store.js.map +1 -0
- package/dist/discord/components/paginator/mount-paginator.js +7 -5
- package/dist/discord/components/paginator/mount-paginator.js.map +1 -1
- package/dist/discord/components/paginator/paginator-view.d.ts +1 -1
- package/dist/discord/components/paginator/paginator-view.d.ts.map +1 -1
- package/dist/discord/components/persistent-paginator.d.ts +1 -1
- package/dist/discord/components/persistent-paginator.d.ts.map +1 -1
- package/dist/discord/components/persistent-paginator.js +6 -6
- package/dist/discord/components/persistent-paginator.js.map +1 -1
- package/dist/discord/components/settings-editor/from-declaration-controls.d.ts +67 -0
- package/dist/discord/components/settings-editor/from-declaration-controls.d.ts.map +1 -0
- package/dist/discord/components/settings-editor/from-declaration-controls.js +245 -0
- package/dist/discord/components/settings-editor/from-declaration-controls.js.map +1 -0
- package/dist/discord/components/settings-editor/from-declaration-display.d.ts +23 -0
- package/dist/discord/components/settings-editor/from-declaration-display.d.ts.map +1 -0
- package/dist/discord/components/settings-editor/from-declaration-display.js +114 -0
- package/dist/discord/components/settings-editor/from-declaration-display.js.map +1 -0
- package/dist/discord/components/settings-editor/from-declaration-layout.d.ts +33 -0
- package/dist/discord/components/settings-editor/from-declaration-layout.d.ts.map +1 -0
- package/dist/discord/components/settings-editor/from-declaration-layout.js +178 -0
- package/dist/discord/components/settings-editor/from-declaration-layout.js.map +1 -0
- package/dist/discord/components/settings-editor/from-declaration-search.d.ts +27 -0
- package/dist/discord/components/settings-editor/from-declaration-search.d.ts.map +1 -0
- package/dist/discord/components/settings-editor/from-declaration-search.js +58 -0
- package/dist/discord/components/settings-editor/from-declaration-search.js.map +1 -0
- package/dist/discord/components/settings-editor/from-declaration-stored.d.ts +21 -0
- package/dist/discord/components/settings-editor/from-declaration-stored.d.ts.map +1 -0
- package/dist/discord/components/settings-editor/from-declaration-stored.js +37 -0
- package/dist/discord/components/settings-editor/from-declaration-stored.js.map +1 -0
- package/dist/discord/components/settings-editor/from-declaration-subject.d.ts +32 -0
- package/dist/discord/components/settings-editor/from-declaration-subject.d.ts.map +1 -0
- package/dist/discord/components/settings-editor/from-declaration-subject.js +65 -0
- package/dist/discord/components/settings-editor/from-declaration-subject.js.map +1 -0
- package/dist/discord/components/settings-editor/from-declaration-values.d.ts +57 -0
- package/dist/discord/components/settings-editor/from-declaration-values.d.ts.map +1 -0
- package/dist/discord/components/settings-editor/from-declaration-values.js +187 -0
- package/dist/discord/components/settings-editor/from-declaration-values.js.map +1 -0
- package/dist/discord/components/settings-editor/from-declaration.d.ts +39 -0
- package/dist/discord/components/settings-editor/from-declaration.d.ts.map +1 -0
- package/dist/discord/components/settings-editor/from-declaration.js +132 -0
- package/dist/discord/components/settings-editor/from-declaration.js.map +1 -0
- package/dist/discord/components/settings-editor/index.d.ts +3 -1
- package/dist/discord/components/settings-editor/index.d.ts.map +1 -1
- package/dist/discord/components/settings-editor/index.js +6 -3
- package/dist/discord/components/settings-editor/index.js.map +1 -1
- package/dist/discord/components/settings-editor/mount-settings-editor.d.ts +16 -2
- package/dist/discord/components/settings-editor/mount-settings-editor.d.ts.map +1 -1
- package/dist/discord/components/settings-editor/mount-settings-editor.js +14 -10
- package/dist/discord/components/settings-editor/mount-settings-editor.js.map +1 -1
- package/dist/discord/components/settings-editor/navigation.d.ts +20 -0
- package/dist/discord/components/settings-editor/navigation.d.ts.map +1 -1
- package/dist/discord/components/settings-editor/navigation.js +22 -0
- package/dist/discord/components/settings-editor/navigation.js.map +1 -1
- package/dist/discord/components/settings-editor/settings-editor-card.view.d.ts +4 -3
- package/dist/discord/components/settings-editor/settings-editor-card.view.d.ts.map +1 -1
- package/dist/discord/components/settings-editor/settings-editor-card.view.js +60 -34
- package/dist/discord/components/settings-editor/settings-editor-card.view.js.map +1 -1
- package/dist/discord/components/settings-editor/settings-editor-field-modal.d.ts +2 -1
- package/dist/discord/components/settings-editor/settings-editor-field-modal.d.ts.map +1 -1
- package/dist/discord/components/settings-editor/settings-editor-field-modal.js +48 -72
- package/dist/discord/components/settings-editor/settings-editor-field-modal.js.map +1 -1
- package/dist/discord/components/settings-editor/settings-editor-field-values.d.ts +6 -0
- package/dist/discord/components/settings-editor/settings-editor-field-values.d.ts.map +1 -0
- package/dist/discord/components/settings-editor/settings-editor-field-values.js +13 -0
- package/dist/discord/components/settings-editor/settings-editor-field-values.js.map +1 -0
- package/dist/discord/components/settings-editor/settings-editor-fields.d.ts +6 -5
- package/dist/discord/components/settings-editor/settings-editor-fields.d.ts.map +1 -1
- package/dist/discord/components/settings-editor/settings-editor-fields.js +0 -10
- package/dist/discord/components/settings-editor/settings-editor-fields.js.map +1 -1
- package/dist/discord/components/settings-editor/settings-editor.view.d.ts +3 -2
- package/dist/discord/components/settings-editor/settings-editor.view.d.ts.map +1 -1
- package/dist/discord/components/settings-editor/settings-editor.view.js +4 -21
- package/dist/discord/components/settings-editor/settings-editor.view.js.map +1 -1
- package/dist/discord/events/event-guild-id.d.ts +10 -0
- package/dist/discord/events/event-guild-id.d.ts.map +1 -0
- package/dist/discord/events/event-guild-id.js +37 -0
- package/dist/discord/events/event-guild-id.js.map +1 -0
- package/dist/discord/events/event-router.d.ts +17 -3
- package/dist/discord/events/event-router.d.ts.map +1 -1
- package/dist/discord/events/event-router.js +33 -9
- package/dist/discord/events/event-router.js.map +1 -1
- package/dist/discord/i18n.d.ts +17 -2
- package/dist/discord/i18n.d.ts.map +1 -1
- package/dist/discord/i18n.js +43 -6
- package/dist/discord/i18n.js.map +1 -1
- package/dist/discord/interaction/interaction-locale.d.ts +14 -0
- package/dist/discord/interaction/interaction-locale.d.ts.map +1 -0
- package/dist/discord/interaction/interaction-locale.js +12 -0
- package/dist/discord/interaction/interaction-locale.js.map +1 -0
- package/dist/discord/interaction/locale-resolver.d.ts +27 -0
- package/dist/discord/interaction/locale-resolver.d.ts.map +1 -0
- package/dist/discord/interaction/locale-resolver.js +3 -0
- package/dist/discord/interaction/locale-resolver.js.map +1 -0
- package/dist/discord/interaction/modal.d.ts.map +1 -1
- package/dist/discord/interaction/modal.js +5 -40
- package/dist/discord/interaction/modal.js.map +1 -1
- package/dist/discord/interaction/reply-locale.d.ts +18 -0
- package/dist/discord/interaction/reply-locale.d.ts.map +1 -0
- package/dist/discord/interaction/reply-locale.js +25 -0
- package/dist/discord/interaction/reply-locale.js.map +1 -0
- package/dist/discord/interaction/select-bounds.d.ts +19 -0
- package/dist/discord/interaction/select-bounds.d.ts.map +1 -0
- package/dist/discord/interaction/select-bounds.js +17 -0
- package/dist/discord/interaction/select-bounds.js.map +1 -0
- package/dist/discord/interaction/select-menu.d.ts.map +1 -1
- package/dist/discord/interaction/select-menu.js +2 -9
- package/dist/discord/interaction/select-menu.js.map +1 -1
- package/dist/discord/placeholder-registry.d.ts +1 -1
- package/dist/discord/placeholder-registry.d.ts.map +1 -1
- package/dist/discord/presenter.d.ts +1 -1
- package/dist/discord/presenter.d.ts.map +1 -1
- package/dist/discord/settings/discord-guild-directory.d.ts +28 -0
- package/dist/discord/settings/discord-guild-directory.d.ts.map +1 -0
- package/dist/discord/settings/discord-guild-directory.js +171 -0
- package/dist/discord/settings/discord-guild-directory.js.map +1 -0
- package/dist/discord/settings/guild-locale-resolver.d.ts +25 -0
- package/dist/discord/settings/guild-locale-resolver.d.ts.map +1 -0
- package/dist/discord/settings/guild-locale-resolver.js +33 -0
- package/dist/discord/settings/guild-locale-resolver.js.map +1 -0
- package/dist/discord/settings/is-module-disabled.d.ts +16 -0
- package/dist/discord/settings/is-module-disabled.d.ts.map +1 -0
- package/dist/discord/settings/is-module-disabled.js +20 -0
- package/dist/discord/settings/is-module-disabled.js.map +1 -0
- package/dist/discord/settings/module-disabled-embed.d.ts +13 -0
- package/dist/discord/settings/module-disabled-embed.d.ts.map +1 -0
- package/dist/discord/settings/module-disabled-embed.js +16 -0
- package/dist/discord/settings/module-disabled-embed.js.map +1 -0
- package/dist/discord/settings/require-configured.d.ts +26 -0
- package/dist/discord/settings/require-configured.d.ts.map +1 -0
- package/dist/discord/settings/require-configured.js +62 -0
- package/dist/discord/settings/require-configured.js.map +1 -0
- package/dist/discord/ui/color-aliases.d.ts +31 -0
- package/dist/discord/ui/color-aliases.d.ts.map +1 -0
- package/dist/discord/ui/color-aliases.js +66 -0
- package/dist/discord/ui/color-aliases.js.map +1 -0
- package/dist/discord/ui/color-input.d.ts +5 -32
- package/dist/discord/ui/color-input.d.ts.map +1 -1
- package/dist/discord/ui/color-input.js +8 -157
- package/dist/discord/ui/color-input.js.map +1 -1
- package/dist/discord/ui/colors.d.ts +0 -2
- package/dist/discord/ui/colors.d.ts.map +1 -1
- package/dist/discord/ui/colors.js +4 -5
- package/dist/discord/ui/colors.js.map +1 -1
- package/dist/discord/ui/embed.d.ts.map +1 -1
- package/dist/discord/ui/embed.js +3 -8
- package/dist/discord/ui/embed.js.map +1 -1
- package/dist/discord/ui/truncate-text.d.ts +11 -0
- package/dist/discord/ui/truncate-text.d.ts.map +1 -0
- package/dist/discord/ui/truncate-text.js +19 -0
- package/dist/discord/ui/truncate-text.js.map +1 -0
- package/dist/errors/error-message.d.ts +9 -0
- package/dist/errors/error-message.d.ts.map +1 -0
- package/dist/errors/error-message.js +14 -0
- package/dist/errors/error-message.js.map +1 -0
- package/dist/i18n/business-message.d.ts +1 -1
- package/dist/i18n/business-message.d.ts.map +1 -1
- package/dist/i18n/catalog.d.ts +9 -0
- package/dist/i18n/catalog.d.ts.map +1 -1
- package/dist/i18n/catalog.js +4 -0
- package/dist/i18n/catalog.js.map +1 -1
- package/dist/i18n/locale.d.ts +2 -0
- package/dist/i18n/locale.d.ts.map +1 -1
- package/dist/i18n/locale.js +3 -1
- package/dist/i18n/locale.js.map +1 -1
- package/dist/i18n/translator.d.ts +2 -0
- package/dist/i18n/translator.d.ts.map +1 -1
- package/dist/i18n/translator.js.map +1 -1
- package/dist/module/module.d.ts +15 -1
- package/dist/module/module.d.ts.map +1 -1
- package/dist/resilience/retry.js +2 -2
- package/dist/resilience/retry.js.map +1 -1
- package/dist/scheduler/scheduler.d.ts.map +1 -1
- package/dist/scheduler/scheduler.js +2 -4
- package/dist/scheduler/scheduler.js.map +1 -1
- package/dist/settings/cache.d.ts +29 -0
- package/dist/settings/cache.d.ts.map +1 -0
- package/dist/settings/cache.js +47 -0
- package/dist/settings/cache.js.map +1 -0
- package/dist/settings/choice.d.ts +10 -0
- package/dist/settings/choice.d.ts.map +1 -0
- package/dist/settings/choice.js +3 -0
- package/dist/settings/choice.js.map +1 -0
- package/dist/settings/decode-stored.d.ts +20 -0
- package/dist/settings/decode-stored.d.ts.map +1 -0
- package/dist/settings/decode-stored.js +35 -0
- package/dist/settings/decode-stored.js.map +1 -0
- package/dist/settings/define-settings.d.ts +52 -0
- package/dist/settings/define-settings.d.ts.map +1 -0
- package/dist/settings/define-settings.js +141 -0
- package/dist/settings/define-settings.js.map +1 -0
- package/dist/settings/describe-field.d.ts +19 -0
- package/dist/settings/describe-field.d.ts.map +1 -0
- package/dist/settings/describe-field.js +131 -0
- package/dist/settings/describe-field.js.map +1 -0
- package/dist/settings/describe.d.ts +27 -0
- package/dist/settings/describe.d.ts.map +1 -0
- package/dist/settings/describe.js +62 -0
- package/dist/settings/describe.js.map +1 -0
- package/dist/settings/duration.d.ts +16 -0
- package/dist/settings/duration.d.ts.map +1 -0
- package/dist/settings/duration.js +56 -0
- package/dist/settings/duration.js.map +1 -0
- package/dist/settings/field-order.d.ts +37 -0
- package/dist/settings/field-order.d.ts.map +1 -0
- package/dist/settings/field-order.js +100 -0
- package/dist/settings/field-order.js.map +1 -0
- package/dist/settings/field-search.d.ts +10 -0
- package/dist/settings/field-search.d.ts.map +1 -0
- package/dist/settings/field-search.js +18 -0
- package/dist/settings/field-search.js.map +1 -0
- package/dist/settings/fields/builders.d.ts +41 -0
- package/dist/settings/fields/builders.d.ts.map +1 -0
- package/dist/settings/fields/builders.js +83 -0
- package/dist/settings/fields/builders.js.map +1 -0
- package/dist/settings/fields/field.d.ts +199 -0
- package/dist/settings/fields/field.d.ts.map +1 -0
- package/dist/settings/fields/field.js +33 -0
- package/dist/settings/fields/field.js.map +1 -0
- package/dist/settings/fields/zod-schema.d.ts +67 -0
- package/dist/settings/fields/zod-schema.d.ts.map +1 -0
- package/dist/settings/fields/zod-schema.js +281 -0
- package/dist/settings/fields/zod-schema.js.map +1 -0
- package/dist/settings/in-memory/in-memory-guild-directory.d.ts +24 -0
- package/dist/settings/in-memory/in-memory-guild-directory.d.ts.map +1 -0
- package/dist/settings/in-memory/in-memory-guild-directory.js +42 -0
- package/dist/settings/in-memory/in-memory-guild-directory.js.map +1 -0
- package/dist/settings/in-memory/in-memory-settings-store.d.ts +8 -0
- package/dist/settings/in-memory/in-memory-settings-store.d.ts.map +1 -0
- package/dist/settings/in-memory/in-memory-settings-store.js +43 -0
- package/dist/settings/in-memory/in-memory-settings-store.js.map +1 -0
- package/dist/settings/in-memory/in-process-notifier.d.ts +9 -0
- package/dist/settings/in-memory/in-process-notifier.d.ts.map +1 -0
- package/dist/settings/in-memory/in-process-notifier.js +32 -0
- package/dist/settings/in-memory/in-process-notifier.js.map +1 -0
- package/dist/settings/index.d.ts +22 -0
- package/dist/settings/index.d.ts.map +1 -0
- package/dist/settings/index.js +31 -0
- package/dist/settings/index.js.map +1 -0
- package/dist/settings/is-plain-object.d.ts +6 -0
- package/dist/settings/is-plain-object.d.ts.map +1 -0
- package/dist/settings/is-plain-object.js +15 -0
- package/dist/settings/is-plain-object.js.map +1 -0
- package/dist/settings/messages.d.ts +61 -0
- package/dist/settings/messages.d.ts.map +1 -0
- package/dist/settings/messages.js +155 -0
- package/dist/settings/messages.js.map +1 -0
- package/dist/settings/migrate.d.ts +35 -0
- package/dist/settings/migrate.d.ts.map +1 -0
- package/dist/settings/migrate.js +42 -0
- package/dist/settings/migrate.js.map +1 -0
- package/dist/settings/ports/guild-directory.d.ts +61 -0
- package/dist/settings/ports/guild-directory.d.ts.map +1 -0
- package/dist/settings/ports/guild-directory.js +3 -0
- package/dist/settings/ports/guild-directory.js.map +1 -0
- package/dist/settings/ports/settings-changed-notifier.d.ts +20 -0
- package/dist/settings/ports/settings-changed-notifier.d.ts.map +1 -0
- package/dist/settings/ports/settings-changed-notifier.js +3 -0
- package/dist/settings/ports/settings-changed-notifier.js.map +1 -0
- package/dist/settings/ports/settings-store.d.ts +76 -0
- package/dist/settings/ports/settings-store.d.ts.map +1 -0
- package/dist/settings/ports/settings-store.js +3 -0
- package/dist/settings/ports/settings-store.js.map +1 -0
- package/dist/settings/registry.d.ts +31 -0
- package/dist/settings/registry.d.ts.map +1 -0
- package/dist/settings/registry.js +102 -0
- package/dist/settings/registry.js.map +1 -0
- package/dist/settings/settings-declaration-error.d.ts +13 -0
- package/dist/settings/settings-declaration-error.d.ts.map +1 -0
- package/dist/settings/settings-declaration-error.js +22 -0
- package/dist/settings/settings-declaration-error.js.map +1 -0
- package/dist/settings/settings-service.d.ts +148 -0
- package/dist/settings/settings-service.d.ts.map +1 -0
- package/dist/settings/settings-service.js +279 -0
- package/dist/settings/settings-service.js.map +1 -0
- package/dist/settings/settings-validation-error.d.ts +23 -0
- package/dist/settings/settings-validation-error.d.ts.map +1 -0
- package/dist/settings/settings-validation-error.js +17 -0
- package/dist/settings/settings-validation-error.js.map +1 -0
- package/dist/settings/status.d.ts +16 -0
- package/dist/settings/status.d.ts.map +1 -0
- package/dist/settings/status.js +18 -0
- package/dist/settings/status.js.map +1 -0
- package/dist/settings/suggest.d.ts +77 -0
- package/dist/settings/suggest.d.ts.map +1 -0
- package/dist/settings/suggest.js +192 -0
- package/dist/settings/suggest.js.map +1 -0
- package/dist/settings/system/kernel-settings.d.ts +43 -0
- package/dist/settings/system/kernel-settings.d.ts.map +1 -0
- package/dist/settings/system/kernel-settings.js +53 -0
- package/dist/settings/system/kernel-settings.js.map +1 -0
- package/dist/settings/system/module-gate.d.ts +31 -0
- package/dist/settings/system/module-gate.d.ts.map +1 -0
- package/dist/settings/system/module-gate.js +34 -0
- package/dist/settings/system/module-gate.js.map +1 -0
- package/dist/settings/testing/index.d.ts +2 -0
- package/dist/settings/testing/index.d.ts.map +1 -0
- package/dist/settings/testing/index.js +6 -0
- package/dist/settings/testing/index.js.map +1 -0
- package/dist/settings/testing/settings-store-contract.d.ts +29 -0
- package/dist/settings/testing/settings-store-contract.d.ts.map +1 -0
- package/dist/settings/testing/settings-store-contract.js +192 -0
- package/dist/settings/testing/settings-store-contract.js.map +1 -0
- package/dist/settings/timed-search.d.ts +26 -0
- package/dist/settings/timed-search.d.ts.map +1 -0
- package/dist/settings/timed-search.js +48 -0
- package/dist/settings/timed-search.js.map +1 -0
- package/dist/settings/types.d.ts +37 -0
- package/dist/settings/types.d.ts.map +1 -0
- package/dist/settings/types.js +3 -0
- package/dist/settings/types.js.map +1 -0
- package/dist/settings/validate.d.ts +55 -0
- package/dist/settings/validate.d.ts.map +1 -0
- package/dist/settings/validate.js +196 -0
- package/dist/settings/validate.js.map +1 -0
- package/package.json +463 -88
- package/src/authz/require-level-guard.ts +1 -1
- package/src/color.ts +134 -0
- package/src/discord/command/all-required.ts +12 -0
- package/src/discord/command/autocomplete-dispatcher.ts +2 -1
- package/src/discord/command/autocomplete-limits.ts +2 -0
- package/src/discord/command/autocomplete.ts +8 -7
- package/src/discord/command/command-responders.ts +39 -0
- package/src/discord/command/context.ts +14 -54
- package/src/discord/command/cooldown-guard.ts +1 -1
- package/src/discord/command/create-command.ts +19 -94
- package/src/discord/command/create-context-menu-command.ts +19 -97
- package/src/discord/command/errors.ts +1 -1
- package/src/discord/command/guard.ts +24 -12
- package/src/discord/command/options.ts +202 -412
- package/src/discord/command/passes-guard.ts +37 -0
- package/src/discord/command/permission-guard.ts +1 -1
- package/src/discord/command/render-command-failure.ts +71 -0
- package/src/discord/command/route-key.ts +9 -0
- package/src/discord/command/router.ts +73 -12
- package/src/discord/command/send-embed.ts +42 -0
- package/src/discord/command/types.ts +7 -1
- package/src/discord/components/component-access.ts +20 -0
- package/src/discord/components/component-router.ts +73 -36
- package/src/discord/components/interactive-message/index.ts +5 -3
- package/src/discord/components/interactive-message/interactive-message-collector.ts +4 -68
- package/src/discord/components/interactive-message/message-edit-options.ts +47 -0
- package/src/discord/components/interactive-message/mount-interactive-message.ts +5 -3
- package/src/discord/components/interactive-message/state-store.ts +20 -0
- package/src/discord/components/paginator/mount-paginator.ts +3 -3
- package/src/discord/components/paginator/paginator-view.ts +1 -1
- package/src/discord/components/persistent-paginator.ts +8 -9
- package/src/discord/components/settings-editor/from-declaration-controls.ts +371 -0
- package/src/discord/components/settings-editor/from-declaration-display.ts +155 -0
- package/src/discord/components/settings-editor/from-declaration-layout.ts +247 -0
- package/src/discord/components/settings-editor/from-declaration-search.ts +77 -0
- package/src/discord/components/settings-editor/from-declaration-stored.ts +39 -0
- package/src/discord/components/settings-editor/from-declaration-subject.ts +110 -0
- package/src/discord/components/settings-editor/from-declaration-values.ts +240 -0
- package/src/discord/components/settings-editor/from-declaration.ts +218 -0
- package/src/discord/components/settings-editor/index.ts +5 -2
- package/src/discord/components/settings-editor/mount-settings-editor.ts +28 -10
- package/src/discord/components/settings-editor/navigation.ts +41 -0
- package/src/discord/components/settings-editor/settings-editor-card.view.ts +79 -36
- package/src/discord/components/settings-editor/settings-editor-field-modal.ts +76 -68
- package/src/discord/components/settings-editor/settings-editor-field-values.ts +11 -0
- package/src/discord/components/settings-editor/settings-editor-fields.ts +6 -11
- package/src/discord/components/settings-editor/settings-editor.view.ts +11 -24
- package/src/discord/events/event-guild-id.ts +35 -0
- package/src/discord/events/event-router.ts +46 -13
- package/src/discord/i18n.ts +47 -8
- package/src/discord/interaction/interaction-locale.ts +19 -0
- package/src/discord/interaction/locale-resolver.ts +28 -0
- package/src/discord/interaction/modal.ts +5 -40
- package/src/discord/interaction/reply-locale.ts +35 -0
- package/src/discord/interaction/select-bounds.ts +33 -0
- package/src/discord/interaction/select-menu.ts +2 -9
- package/src/discord/placeholder-registry.ts +1 -1
- package/src/discord/presenter.ts +1 -1
- package/src/discord/settings/discord-guild-directory.ts +214 -0
- package/src/discord/settings/guild-locale-resolver.ts +38 -0
- package/src/discord/settings/is-module-disabled.ts +22 -0
- package/src/discord/settings/module-disabled-embed.ts +19 -0
- package/src/discord/settings/require-configured.ts +68 -0
- package/src/discord/ui/color-aliases.ts +70 -0
- package/src/discord/ui/color-input.ts +8 -173
- package/src/discord/ui/colors.ts +2 -3
- package/src/discord/ui/embed.ts +3 -9
- package/src/discord/ui/truncate-text.ts +15 -0
- package/src/errors/error-message.ts +10 -0
- package/src/i18n/business-message.ts +1 -1
- package/src/i18n/catalog.ts +14 -0
- package/src/i18n/locale.ts +3 -0
- package/src/i18n/translator.ts +3 -0
- package/src/module/module.ts +15 -1
- package/src/resilience/retry.ts +1 -1
- package/src/scheduler/scheduler.ts +2 -5
- package/src/settings/cache.ts +70 -0
- package/src/settings/choice.ts +9 -0
- package/src/settings/decode-stored.ts +40 -0
- package/src/settings/define-settings.ts +214 -0
- package/src/settings/describe-field.ts +155 -0
- package/src/settings/describe.ts +90 -0
- package/src/settings/duration.ts +54 -0
- package/src/settings/field-order.ts +128 -0
- package/src/settings/field-search.ts +16 -0
- package/src/settings/fields/builders.ts +161 -0
- package/src/settings/fields/field.ts +205 -0
- package/src/settings/fields/zod-schema.ts +300 -0
- package/src/settings/in-memory/in-memory-guild-directory.ts +69 -0
- package/src/settings/in-memory/in-memory-settings-store.ts +46 -0
- package/src/settings/in-memory/in-process-notifier.ts +40 -0
- package/src/settings/index.ts +72 -0
- package/src/settings/is-plain-object.ts +11 -0
- package/src/settings/messages.ts +161 -0
- package/src/settings/migrate.ts +58 -0
- package/src/settings/ports/guild-directory.ts +48 -0
- package/src/settings/ports/settings-changed-notifier.ts +20 -0
- package/src/settings/ports/settings-store.ts +74 -0
- package/src/settings/registry.ts +137 -0
- package/src/settings/settings-declaration-error.ts +16 -0
- package/src/settings/settings-service.ts +535 -0
- package/src/settings/settings-validation-error.ts +41 -0
- package/src/settings/status.ts +25 -0
- package/src/settings/suggest.ts +267 -0
- package/src/settings/system/kernel-settings.ts +74 -0
- package/src/settings/system/module-gate.ts +49 -0
- package/src/settings/testing/index.ts +7 -0
- package/src/settings/testing/settings-store-contract.ts +278 -0
- package/src/settings/timed-search.ts +56 -0
- package/src/settings/types.ts +42 -0
- package/src/settings/validate.ts +298 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"discord-guild-directory.js","sourceRoot":"","sources":["../../../src/discord/settings/discord-guild-directory.ts"],"names":[],"mappings":";;;AAuIA,kEA8EC;AArND,2CAAkE;AAClE,qDAA0E;AAC1E,+EAAiF;AAMjF;;;;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AAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,IAAI,CAAC,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;QAChE,CAAC;QAED,KAAK,CAAC,aAAa,CAAC,OAAO,EAAE,KAAK;YACjC,MAAM,KAAK,GAAG,MAAM,SAAS,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC;YACnD,IAAI,CAAC,KAAK,EAAE,CAAC;gBACZ,OAAO,EAAE,CAAC;YACX,CAAC;YACD,MAAM,IAAI,GAAG,CAAC,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAChE,cAAc,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,WAAW,EAAE,KAAK,EAAE,CAAC,CACnD,CAAC;YACF,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBACrB,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;YAClD,CAAC;YACD,MAAM,KAAK,GAAG,MAAM,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,CAAC,CAAC;YACzE,OAAO,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QAC1C,CAAC;KACD,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { LocaleResolver } from "../../discord/interaction/locale-resolver";
|
|
2
|
+
import type { Translator } from "../../i18n/translator";
|
|
3
|
+
import type { SettingsRegistry } from "../../settings/registry";
|
|
4
|
+
import type { SettingsService } from "../../settings/settings-service";
|
|
5
|
+
/**
|
|
6
|
+
* The default {@link LocaleResolver} of a bot with settings (FR-038): the
|
|
7
|
+
* member's locale if supported, then the guild's language setting
|
|
8
|
+
* (`registry.kernel`, read through the service's cache), then the guild's
|
|
9
|
+
* Discord locale if supported, then the translator's default.
|
|
10
|
+
*
|
|
11
|
+
* The setting is read only when the member's locale is not supported, and
|
|
12
|
+
* never outside a guild. A failed read rejects: the kernel's
|
|
13
|
+
* reply paths log it and fall back to the interaction's own locales.
|
|
14
|
+
*
|
|
15
|
+
* @param deps.service - reads the guild's kernel settings.
|
|
16
|
+
* @param deps.registry - holds the kernel declaration.
|
|
17
|
+
* @param deps.translator - gives the bot's default language.
|
|
18
|
+
* @returns the resolver to hand to the command and component routers.
|
|
19
|
+
*/
|
|
20
|
+
export declare function createGuildLocaleResolver(deps: {
|
|
21
|
+
service: SettingsService;
|
|
22
|
+
registry: SettingsRegistry;
|
|
23
|
+
translator: Translator;
|
|
24
|
+
}): LocaleResolver;
|
|
25
|
+
//# sourceMappingURL=guild-locale-resolver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"guild-locale-resolver.d.ts","sourceRoot":"","sources":["../../../src/discord/settings/guild-locale-resolver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AAE5E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAEnE;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE;IAC/C,OAAO,EAAE,eAAe,CAAC;IACzB,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,UAAU,EAAE,UAAU,CAAC;CACvB,GAAG,cAAc,CAYjB"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createGuildLocaleResolver = createGuildLocaleResolver;
|
|
4
|
+
const locale_1 = require("../../i18n/locale");
|
|
5
|
+
/**
|
|
6
|
+
* The default {@link LocaleResolver} of a bot with settings (FR-038): the
|
|
7
|
+
* member's locale if supported, then the guild's language setting
|
|
8
|
+
* (`registry.kernel`, read through the service's cache), then the guild's
|
|
9
|
+
* Discord locale if supported, then the translator's default.
|
|
10
|
+
*
|
|
11
|
+
* The setting is read only when the member's locale is not supported, and
|
|
12
|
+
* never outside a guild. A failed read rejects: the kernel's
|
|
13
|
+
* reply paths log it and fall back to the interaction's own locales.
|
|
14
|
+
*
|
|
15
|
+
* @param deps.service - reads the guild's kernel settings.
|
|
16
|
+
* @param deps.registry - holds the kernel declaration.
|
|
17
|
+
* @param deps.translator - gives the bot's default language.
|
|
18
|
+
* @returns the resolver to hand to the command and component routers.
|
|
19
|
+
*/
|
|
20
|
+
function createGuildLocaleResolver(deps) {
|
|
21
|
+
const { service, registry, translator } = deps;
|
|
22
|
+
return {
|
|
23
|
+
async resolve({ locale, guildLocale, guildId }) {
|
|
24
|
+
const member = (0, locale_1.normalizeLocale)(locale);
|
|
25
|
+
if (member !== undefined || !guildId) {
|
|
26
|
+
return (0, locale_1.resolveLocale)([member, guildLocale], translator.defaultLocale);
|
|
27
|
+
}
|
|
28
|
+
const setting = (await service.get(registry.kernel, guildId)).locale;
|
|
29
|
+
return (0, locale_1.resolveLocale)([setting, guildLocale], translator.defaultLocale);
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=guild-locale-resolver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"guild-locale-resolver.js","sourceRoot":"","sources":["../../../src/discord/settings/guild-locale-resolver.ts"],"names":[],"mappings":";;AAqBA,8DAgBC;AApCD,0CAA+D;AAK/D;;;;;;;;;;;;;;GAcG;AACH,SAAgB,yBAAyB,CAAC,IAIzC;IACA,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,GAAG,IAAI,CAAC;IAC/C,OAAO;QACN,KAAK,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE;YAC7C,MAAM,MAAM,GAAG,IAAA,wBAAe,EAAC,MAAM,CAAC,CAAC;YACvC,IAAI,MAAM,KAAK,SAAS,IAAI,CAAC,OAAO,EAAE,CAAC;gBACtC,OAAO,IAAA,sBAAa,EAAC,CAAC,MAAM,EAAE,WAAW,CAAC,EAAE,UAAU,CAAC,aAAa,CAAC,CAAC;YACvE,CAAC;YACD,MAAM,OAAO,GAAG,CAAC,MAAM,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC;YACrE,OAAO,IAAA,sBAAa,EAAC,CAAC,OAAO,EAAE,WAAW,CAAC,EAAE,UAAU,CAAC,aAAa,CAAC,CAAC;QACxE,CAAC;KACD,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ModuleGate } from "../../settings/system/module-gate";
|
|
2
|
+
/**
|
|
3
|
+
* Whether a router must skip a handler because its module is disabled on the
|
|
4
|
+
* guild it runs for. Nothing is gated without a gate, for a handler registered
|
|
5
|
+
* without a module, or outside a guild (FR-036).
|
|
6
|
+
*
|
|
7
|
+
* @param params.gate - the bot's module gate, if the router was given one.
|
|
8
|
+
* @param params.moduleName - the module that registered the handler.
|
|
9
|
+
* @param params.guildId - the guild the handler would run for, `null` outside one.
|
|
10
|
+
*/
|
|
11
|
+
export declare function isModuleDisabled(params: {
|
|
12
|
+
gate: ModuleGate | undefined;
|
|
13
|
+
moduleName: string | undefined;
|
|
14
|
+
guildId: string | null | undefined;
|
|
15
|
+
}): Promise<boolean>;
|
|
16
|
+
//# sourceMappingURL=is-module-disabled.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-module-disabled.d.ts","sourceRoot":"","sources":["../../../src/discord/settings/is-module-disabled.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAEhE;;;;;;;;GAQG;AACH,wBAAsB,gBAAgB,CAAC,MAAM,EAAE;IAC9C,IAAI,EAAE,UAAU,GAAG,SAAS,CAAC;IAC7B,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,OAAO,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;CACnC,GAAG,OAAO,CAAC,OAAO,CAAC,CAMnB"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isModuleDisabled = isModuleDisabled;
|
|
4
|
+
/**
|
|
5
|
+
* Whether a router must skip a handler because its module is disabled on the
|
|
6
|
+
* guild it runs for. Nothing is gated without a gate, for a handler registered
|
|
7
|
+
* without a module, or outside a guild (FR-036).
|
|
8
|
+
*
|
|
9
|
+
* @param params.gate - the bot's module gate, if the router was given one.
|
|
10
|
+
* @param params.moduleName - the module that registered the handler.
|
|
11
|
+
* @param params.guildId - the guild the handler would run for, `null` outside one.
|
|
12
|
+
*/
|
|
13
|
+
async function isModuleDisabled(params) {
|
|
14
|
+
const { gate, moduleName, guildId } = params;
|
|
15
|
+
if (gate === undefined || moduleName === undefined || !guildId) {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
return !(await gate.isEnabled(moduleName, guildId));
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=is-module-disabled.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-module-disabled.js","sourceRoot":"","sources":["../../../src/discord/settings/is-module-disabled.ts"],"names":[],"mappings":";;AAWA,4CAUC;AAnBD;;;;;;;;GAQG;AACI,KAAK,UAAU,gBAAgB,CAAC,MAItC;IACA,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC;IAC7C,IAAI,IAAI,KAAK,SAAS,IAAI,UAAU,KAAK,SAAS,IAAI,CAAC,OAAO,EAAE,CAAC;QAChE,OAAO,KAAK,CAAC;IACd,CAAC;IACD,OAAO,CAAC,CAAC,MAAM,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC,CAAC;AACrD,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { EmbedBuilder } from "discord.js";
|
|
2
|
+
import type { LocaleSubject } from "../../discord/interaction/locale-resolver";
|
|
3
|
+
import { type ReplyLocaleDeps } from "../../discord/interaction/reply-locale";
|
|
4
|
+
import type { Presenter } from "../../discord/presenter";
|
|
5
|
+
/**
|
|
6
|
+
* The answer to an interaction with a module disabled on its guild: the
|
|
7
|
+
* translated "disabled on this server" message, as a denial in the reply
|
|
8
|
+
* language the router's `LocaleResolver` gives (or the interaction's own).
|
|
9
|
+
*/
|
|
10
|
+
export declare function moduleDisabledEmbed(interaction: LocaleSubject, deps: ReplyLocaleDeps & {
|
|
11
|
+
readonly presenter: Presenter;
|
|
12
|
+
}): Promise<EmbedBuilder>;
|
|
13
|
+
//# sourceMappingURL=module-disabled-embed.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module-disabled-embed.d.ts","sourceRoot":"","sources":["../../../src/discord/settings/module-disabled-embed.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uCAAuC,CAAC;AAC3E,OAAO,EAAE,KAAK,eAAe,EAAe,MAAM,oCAAoC,CAAC;AACvF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAGrD;;;;GAIG;AACH,wBAAsB,mBAAmB,CACxC,WAAW,EAAE,aAAa,EAC1B,IAAI,EAAE,eAAe,GAAG;IAAE,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAA;CAAE,GACvD,OAAO,CAAC,YAAY,CAAC,CAIvB"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.moduleDisabledEmbed = moduleDisabledEmbed;
|
|
4
|
+
const reply_locale_1 = require("../../discord/interaction/reply-locale");
|
|
5
|
+
const messages_1 = require("../../settings/messages");
|
|
6
|
+
/**
|
|
7
|
+
* The answer to an interaction with a module disabled on its guild: the
|
|
8
|
+
* translated "disabled on this server" message, as a denial in the reply
|
|
9
|
+
* language the router's `LocaleResolver` gives (or the interaction's own).
|
|
10
|
+
*/
|
|
11
|
+
async function moduleDisabledEmbed(interaction, deps) {
|
|
12
|
+
const locale = await (0, reply_locale_1.replyLocale)(interaction, deps);
|
|
13
|
+
const message = deps.translator.translate(locale, messages_1.SETTINGS_MESSAGES.moduleDisabled);
|
|
14
|
+
return deps.presenter.denial(message, locale);
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=module-disabled-embed.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module-disabled-embed.js","sourceRoot":"","sources":["../../../src/discord/settings/module-disabled-embed.ts"],"names":[],"mappings":";;AAWA,kDAOC;AAhBD,qEAAuF;AAEvF,kDAAwD;AAExD;;;;GAIG;AACI,KAAK,UAAU,mBAAmB,CACxC,WAA0B,EAC1B,IAAyD;IAEzD,MAAM,MAAM,GAAG,MAAM,IAAA,0BAAW,EAAC,WAAW,EAAE,IAAI,CAAC,CAAC;IACpD,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,MAAM,EAAE,4BAAiB,CAAC,cAAc,CAAC,CAAC;IACpF,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;AAC/C,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type BaseInteraction } from "discord.js";
|
|
2
|
+
import type { Guard } from "../../discord/command/guard";
|
|
3
|
+
import type { SettingsDeclaration } from "../../settings/define-settings";
|
|
4
|
+
import type { SettingsService } from "../../settings/settings-service";
|
|
5
|
+
/**
|
|
6
|
+
* Block a command or a component until its module is configured on the guild
|
|
7
|
+
* (FR-041): until `service.status` lists no missing field, the member gets the
|
|
8
|
+
* translated "not configured" message instead of the handler.
|
|
9
|
+
*
|
|
10
|
+
* - Members allowed to configure the bot (the `ManageGuild` permission, until
|
|
11
|
+
* the permissions feature exists) also read which settings are missing, by
|
|
12
|
+
* their translated labels, in the reply language (the pipeline's
|
|
13
|
+
* `LocaleResolver`). Other members never see them.
|
|
14
|
+
* - The status is read through the service's cache, which every write
|
|
15
|
+
* invalidates: the guard passes as soon as the value is set, no restart.
|
|
16
|
+
* - Outside a guild there is nothing to configure for: denied like
|
|
17
|
+
* `guildOnlyGuard`, without reading any setting.
|
|
18
|
+
*
|
|
19
|
+
* Typed over `BaseInteraction`, so the same guard is a command's `guard` and a
|
|
20
|
+
* component handler's `guard`.
|
|
21
|
+
*
|
|
22
|
+
* @param declaration - the module's settings declaration.
|
|
23
|
+
* @param service - reads the guild's configuration status.
|
|
24
|
+
*/
|
|
25
|
+
export declare function requireConfigured(declaration: SettingsDeclaration, service: SettingsService): Guard<BaseInteraction>;
|
|
26
|
+
//# sourceMappingURL=require-configured.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"require-configured.d.ts","sourceRoot":"","sources":["../../../src/discord/settings/require-configured.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,eAAe,EAAuB,MAAM,YAAY,CAAC;AACvE,OAAO,KAAK,EAAE,KAAK,EAAe,MAAM,yBAAyB,CAAC;AAGlE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAEtE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AASnE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,iBAAiB,CAChC,WAAW,EAAE,mBAAmB,EAChC,OAAO,EAAE,eAAe,GACtB,KAAK,CAAC,eAAe,CAAC,CA6BxB"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.requireConfigured = requireConfigured;
|
|
4
|
+
const discord_js_1 = require("discord.js");
|
|
5
|
+
const i18n_1 = require("../../discord/i18n");
|
|
6
|
+
const reply_locale_1 = require("../../discord/interaction/reply-locale");
|
|
7
|
+
const messages_1 = require("../../settings/messages");
|
|
8
|
+
const ALLOW = { ok: true };
|
|
9
|
+
const NOT_CONFIGURED = {
|
|
10
|
+
ok: false,
|
|
11
|
+
message: { key: messages_1.SETTINGS_MESSAGES.moduleNotConfigured },
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Block a command or a component until its module is configured on the guild
|
|
15
|
+
* (FR-041): until `service.status` lists no missing field, the member gets the
|
|
16
|
+
* translated "not configured" message instead of the handler.
|
|
17
|
+
*
|
|
18
|
+
* - Members allowed to configure the bot (the `ManageGuild` permission, until
|
|
19
|
+
* the permissions feature exists) also read which settings are missing, by
|
|
20
|
+
* their translated labels, in the reply language (the pipeline's
|
|
21
|
+
* `LocaleResolver`). Other members never see them.
|
|
22
|
+
* - The status is read through the service's cache, which every write
|
|
23
|
+
* invalidates: the guard passes as soon as the value is set, no restart.
|
|
24
|
+
* - Outside a guild there is nothing to configure for: denied like
|
|
25
|
+
* `guildOnlyGuard`, without reading any setting.
|
|
26
|
+
*
|
|
27
|
+
* Typed over `BaseInteraction`, so the same guard is a command's `guard` and a
|
|
28
|
+
* component handler's `guard`.
|
|
29
|
+
*
|
|
30
|
+
* @param declaration - the module's settings declaration.
|
|
31
|
+
* @param service - reads the guild's configuration status.
|
|
32
|
+
*/
|
|
33
|
+
function requireConfigured(declaration, service) {
|
|
34
|
+
return {
|
|
35
|
+
async check(interaction, runtime) {
|
|
36
|
+
if (!interaction.guildId) {
|
|
37
|
+
return { ok: false, message: { key: i18n_1.CORE_MESSAGES.guardGuildOnly } };
|
|
38
|
+
}
|
|
39
|
+
const { missing } = await service.status(declaration, interaction.guildId);
|
|
40
|
+
if (missing.length === 0) {
|
|
41
|
+
return ALLOW;
|
|
42
|
+
}
|
|
43
|
+
const canConfigure = interaction.memberPermissions?.has(discord_js_1.PermissionFlagsBits.ManageGuild) ?? false;
|
|
44
|
+
if (!canConfigure || runtime === undefined) {
|
|
45
|
+
return NOT_CONFIGURED;
|
|
46
|
+
}
|
|
47
|
+
const { translator } = runtime;
|
|
48
|
+
const locale = await (0, reply_locale_1.replyLocale)(interaction, runtime);
|
|
49
|
+
const fields = missing
|
|
50
|
+
.map((key) => translator.translate(locale, declaration.fields[key]?.label ?? key))
|
|
51
|
+
.join(", ");
|
|
52
|
+
return {
|
|
53
|
+
ok: false,
|
|
54
|
+
message: [
|
|
55
|
+
translator.translate(locale, messages_1.SETTINGS_MESSAGES.moduleNotConfigured),
|
|
56
|
+
translator.translate(locale, messages_1.SETTINGS_MESSAGES.moduleNotConfiguredMissing, { fields }),
|
|
57
|
+
].join(" "),
|
|
58
|
+
};
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=require-configured.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"require-configured.js","sourceRoot":"","sources":["../../../src/discord/settings/require-configured.ts"],"names":[],"mappings":";;AAmCA,8CAgCC;AAnED,2CAAuE;AAEvE,yCAA+C;AAC/C,qEAAiE;AAEjE,kDAAwD;AAGxD,MAAM,KAAK,GAAgB,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC;AAExC,MAAM,cAAc,GAAgB;IACnC,EAAE,EAAE,KAAK;IACT,OAAO,EAAE,EAAE,GAAG,EAAE,4BAAiB,CAAC,mBAAmB,EAAE;CACvD,CAAC;AAEF;;;;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AAiB,CAAC,0BAA0B,EAAE,EAAE,MAAM,EAAE,CAAC;iBACtF,CAAC,IAAI,CAAC,GAAG,CAAC;aACX,CAAC;QACH,CAAC;KACD,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Every name a lookup answers to: the kernel's own, plus whatever the bot
|
|
3
|
+
* registered. Exposed for inspection — a screen listing the colours it accepts
|
|
4
|
+
* reads this — never for mutation, which goes through
|
|
5
|
+
* {@link registerColorAliases} so the length check cannot be skipped.
|
|
6
|
+
*/
|
|
7
|
+
export declare const COLOR_ALIASES: Readonly<Record<string, string>>;
|
|
8
|
+
/** The `#rrggbb` a recognised colour name stands for, `null` for anything else. */
|
|
9
|
+
export declare function resolveNamedColor(raw: string): string | null;
|
|
10
|
+
/**
|
|
11
|
+
* What a colour input field may hold.
|
|
12
|
+
*
|
|
13
|
+
* Derived from the built-in table rather than written down, so adding a longer
|
|
14
|
+
* name here cannot leave the field silently truncating it at the client — and
|
|
15
|
+
* fixed rather than recomputed on registration, because field definitions read
|
|
16
|
+
* it once at module load, long before a bot registers anything.
|
|
17
|
+
*/
|
|
18
|
+
export declare const MAX_COLOR_INPUT_LENGTH: number;
|
|
19
|
+
/**
|
|
20
|
+
* Teach the parser the colours this bot calls by name — its brand gold, its
|
|
21
|
+
* team colours — from the composition root, before any module is constructed.
|
|
22
|
+
*
|
|
23
|
+
* A name over {@link MAX_COLOR_INPUT_LENGTH} is refused rather than accepted:
|
|
24
|
+
* the input field is already sized, so registering a longer name would let an
|
|
25
|
+
* administrator type a colour the client cuts short, which then reads as the
|
|
26
|
+
* parser rejecting a name it actually knows.
|
|
27
|
+
*
|
|
28
|
+
* @throws ColorAliasTooLongError when a name cannot fit the input field.
|
|
29
|
+
*/
|
|
30
|
+
export declare function registerColorAliases(aliases: Readonly<Record<string, string>>): void;
|
|
31
|
+
//# sourceMappingURL=color-aliases.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"color-aliases.d.ts","sourceRoot":"","sources":["../../../src/discord/ui/color-aliases.ts"],"names":[],"mappings":"AAcA;;;;;GAKG;AACH,eAAO,MAAM,aAAa,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAE1D,CAAC;AAIF,mFAAmF;AACnF,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAE5D;AAKD;;;;;;;GAOG;AACH,eAAO,MAAM,sBAAsB,QAGlC,CAAC;AAEF;;;;;;;;;;GAUG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GAAG,IAAI,CAWpF"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MAX_COLOR_INPUT_LENGTH = exports.COLOR_ALIASES = void 0;
|
|
4
|
+
exports.resolveNamedColor = resolveNamedColor;
|
|
5
|
+
exports.registerColorAliases = registerColorAliases;
|
|
6
|
+
const color_1 = require("../../color");
|
|
7
|
+
const color_input_errors_1 = require("../../discord/ui/color-input-errors");
|
|
8
|
+
/**
|
|
9
|
+
* The names the kernel ships: the vendor-neutral base colours, `blurple` included.
|
|
10
|
+
*
|
|
11
|
+
* A bot adds its own — the colour it calls by its brand's name — through
|
|
12
|
+
* {@link registerColorAliases}, which is also why this table is not the one
|
|
13
|
+
* lookups read: {@link COLOR_ALIASES} is.
|
|
14
|
+
*/
|
|
15
|
+
const BUILT_IN_COLOR_ALIASES = {
|
|
16
|
+
...color_1.BASE_COLOR_NAMES,
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Every name a lookup answers to: the kernel's own, plus whatever the bot
|
|
20
|
+
* registered. Exposed for inspection — a screen listing the colours it accepts
|
|
21
|
+
* reads this — never for mutation, which goes through
|
|
22
|
+
* {@link registerColorAliases} so the length check cannot be skipped.
|
|
23
|
+
*/
|
|
24
|
+
exports.COLOR_ALIASES = {
|
|
25
|
+
...BUILT_IN_COLOR_ALIASES,
|
|
26
|
+
};
|
|
27
|
+
const COLORS_BY_NORMALIZED_NAME = (0, color_1.indexColorNames)(exports.COLOR_ALIASES);
|
|
28
|
+
/** The `#rrggbb` a recognised colour name stands for, `null` for anything else. */
|
|
29
|
+
function resolveNamedColor(raw) {
|
|
30
|
+
return COLORS_BY_NORMALIZED_NAME.get((0, color_1.normalizeColorName)(raw)) ?? null;
|
|
31
|
+
}
|
|
32
|
+
/** `#RRGGBB` — the longest hexadecimal form the parser accepts. */
|
|
33
|
+
const HEX_INPUT_LENGTH = 7;
|
|
34
|
+
/**
|
|
35
|
+
* What a colour input field may hold.
|
|
36
|
+
*
|
|
37
|
+
* Derived from the built-in table rather than written down, so adding a longer
|
|
38
|
+
* name here cannot leave the field silently truncating it at the client — and
|
|
39
|
+
* fixed rather than recomputed on registration, because field definitions read
|
|
40
|
+
* it once at module load, long before a bot registers anything.
|
|
41
|
+
*/
|
|
42
|
+
exports.MAX_COLOR_INPUT_LENGTH = Math.max(HEX_INPUT_LENGTH, ...Object.keys(BUILT_IN_COLOR_ALIASES).map((name) => name.length));
|
|
43
|
+
/**
|
|
44
|
+
* Teach the parser the colours this bot calls by name — its brand gold, its
|
|
45
|
+
* team colours — from the composition root, before any module is constructed.
|
|
46
|
+
*
|
|
47
|
+
* A name over {@link MAX_COLOR_INPUT_LENGTH} is refused rather than accepted:
|
|
48
|
+
* the input field is already sized, so registering a longer name would let an
|
|
49
|
+
* administrator type a colour the client cuts short, which then reads as the
|
|
50
|
+
* parser rejecting a name it actually knows.
|
|
51
|
+
*
|
|
52
|
+
* @throws ColorAliasTooLongError when a name cannot fit the input field.
|
|
53
|
+
*/
|
|
54
|
+
function registerColorAliases(aliases) {
|
|
55
|
+
for (const [name, hex] of Object.entries(aliases)) {
|
|
56
|
+
if (name.length > exports.MAX_COLOR_INPUT_LENGTH) {
|
|
57
|
+
throw new color_input_errors_1.ColorAliasTooLongError(name, exports.MAX_COLOR_INPUT_LENGTH);
|
|
58
|
+
}
|
|
59
|
+
// Both views are written: the table is what a screen lists, the map is what
|
|
60
|
+
// a lookup reads, and a name present in one but not the other would be a
|
|
61
|
+
// colour the bot advertises and refuses.
|
|
62
|
+
exports.COLOR_ALIASES[name] = hex;
|
|
63
|
+
COLORS_BY_NORMALIZED_NAME.set((0, color_1.normalizeColorName)(name), hex);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=color-aliases.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"color-aliases.js","sourceRoot":"","sources":["../../../src/discord/ui/color-aliases.ts"],"names":[],"mappings":";;;AA2BA,8CAEC;AA6BD,oDAWC;AArED,mCAAgF;AAChF,wEAAyE;AAEzE;;;;;;GAMG;AACH,MAAM,sBAAsB,GAAqC;IAChE,GAAG,wBAAgB;CACnB,CAAC;AAEF;;;;;GAKG;AACU,QAAA,aAAa,GAAqC;IAC9D,GAAG,sBAAsB;CACzB,CAAC;AAEF,MAAM,yBAAyB,GAAG,IAAA,uBAAe,EAAC,qBAAa,CAAC,CAAC;AAEjE,mFAAmF;AACnF,SAAgB,iBAAiB,CAAC,GAAW;IAC5C,OAAO,yBAAyB,CAAC,GAAG,CAAC,IAAA,0BAAkB,EAAC,GAAG,CAAC,CAAC,IAAI,IAAI,CAAC;AACvE,CAAC;AAED,mEAAmE;AACnE,MAAM,gBAAgB,GAAG,CAAC,CAAC;AAE3B;;;;;;;GAOG;AACU,QAAA,sBAAsB,GAAG,IAAI,CAAC,GAAG,CAC7C,gBAAgB,EAChB,GAAG,MAAM,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,CACjE,CAAC;AAEF;;;;;;;;;;GAUG;AACH,SAAgB,oBAAoB,CAAC,OAAyC;IAC7E,KAAK,MAAM,CAAC,IAAI,EAAE,GAAG,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;QACnD,IAAI,IAAI,CAAC,MAAM,GAAG,8BAAsB,EAAE,CAAC;YAC1C,MAAM,IAAI,2CAAsB,CAAC,IAAI,EAAE,8BAAsB,CAAC,CAAC;QAChE,CAAC;QACD,4EAA4E;QAC5E,yEAAyE;QACzE,yCAAyC;QACxC,qBAAwC,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC;QACtD,yBAAyB,CAAC,GAAG,CAAC,IAAA,0BAAkB,EAAC,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC;IAC9D,CAAC;AACF,CAAC"}
|
|
@@ -1,37 +1,10 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Every name a lookup answers to: the kernel's own, plus whatever the bot
|
|
3
|
-
* registered. Exposed for inspection — a screen listing the colours it accepts
|
|
4
|
-
* reads this — never for mutation, which goes through
|
|
5
|
-
* {@link registerColorAliases} so the length check cannot be skipped.
|
|
6
|
-
*/
|
|
7
|
-
export declare const COLOR_ALIASES: Readonly<Record<string, string>>;
|
|
8
|
-
/**
|
|
9
|
-
* What a colour input field may hold.
|
|
10
|
-
*
|
|
11
|
-
* Derived from the built-in table rather than written down, so adding a longer
|
|
12
|
-
* name here cannot leave the field silently truncating it at the client — and
|
|
13
|
-
* fixed rather than recomputed on registration, because field definitions read
|
|
14
|
-
* it once at module load, long before a bot registers anything.
|
|
15
|
-
*/
|
|
16
|
-
export declare const MAX_COLOR_INPUT_LENGTH: number;
|
|
17
|
-
/**
|
|
18
|
-
* Teach the parser the colours this bot calls by name — its brand gold, its
|
|
19
|
-
* team colours — from the composition root, before any module is constructed.
|
|
20
|
-
*
|
|
21
|
-
* A name over {@link MAX_COLOR_INPUT_LENGTH} is refused rather than accepted:
|
|
22
|
-
* the input field is already sized, so registering a longer name would let an
|
|
23
|
-
* administrator type a colour the client cuts short, which then reads as the
|
|
24
|
-
* parser rejecting a name it actually knows.
|
|
25
|
-
*
|
|
26
|
-
* @throws ColorAliasTooLongError when a name cannot fit the input field.
|
|
27
|
-
*/
|
|
28
|
-
export declare function registerColorAliases(aliases: Readonly<Record<string, string>>): void;
|
|
29
1
|
/**
|
|
30
2
|
* Normalize a colour input to `#RRGGBB`, from a hexadecimal code or from one of
|
|
31
|
-
* the names in {@link COLOR_ALIASES} — an
|
|
32
|
-
* not have to look a hex code up. `null`
|
|
33
|
-
* refusal an administrator reads belongs to
|
|
34
|
-
* reports that it could not read the value and
|
|
3
|
+
* the names in {@link import("../../discord/ui/color-aliases").COLOR_ALIASES} — an
|
|
4
|
+
* administrator picking a colour should not have to look a hex code up. `null`
|
|
5
|
+
* for anything that is neither: the refusal an administrator reads belongs to
|
|
6
|
+
* whichever screen asked, so core reports that it could not read the value and
|
|
7
|
+
* leaves the wording to the caller.
|
|
35
8
|
*/
|
|
36
9
|
export declare function parseColorInput(raw: string): string | null;
|
|
37
10
|
//# sourceMappingURL=color-input.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"color-input.d.ts","sourceRoot":"","sources":["../../../src/discord/ui/color-input.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"color-input.d.ts","sourceRoot":"","sources":["../../../src/discord/ui/color-input.ts"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAE1D"}
|
|
@@ -1,166 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MAX_COLOR_INPUT_LENGTH = exports.COLOR_ALIASES = void 0;
|
|
4
|
-
exports.registerColorAliases = registerColorAliases;
|
|
5
3
|
exports.parseColorInput = parseColorInput;
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
/**
|
|
9
|
-
* The generic web colours, at the value the name carries everywhere else — an
|
|
10
|
-
* administrator typing `orange` gets the orange they would get in CSS, not a
|
|
11
|
-
* shade this module invented.
|
|
12
|
-
*/
|
|
13
|
-
const RED = "#ff0000";
|
|
14
|
-
const BLUE = "#0000ff";
|
|
15
|
-
const GREEN = "#008000";
|
|
16
|
-
const YELLOW = "#ffff00";
|
|
17
|
-
const ORANGE = "#ffa500";
|
|
18
|
-
const PURPLE = "#800080";
|
|
19
|
-
const PINK = "#ffc0cb";
|
|
20
|
-
const WHITE = "#ffffff";
|
|
21
|
-
/**
|
|
22
|
-
* Not `#000000`: Discord reads a zero colour as "no colour set" and renders the
|
|
23
|
-
* default grey bar instead, so pure black is the one value an administrator
|
|
24
|
-
* could ask for and never see. One step off zero reads as black.
|
|
25
|
-
*/
|
|
26
|
-
const BLACK = "#010101";
|
|
27
|
-
const GREY = "#808080";
|
|
28
|
-
const CYAN = "#00ffff";
|
|
29
|
-
const BROWN = "#a52a2a";
|
|
30
|
-
const SILVER = "#c0c0c0";
|
|
31
|
-
const TURQUOISE = "#40e0d0";
|
|
32
|
-
const MAGENTA = "#ff00ff";
|
|
33
|
-
const NAVY = "#000080";
|
|
34
|
-
/**
|
|
35
|
-
* Colour names an administrator may type instead of a hex code, French and
|
|
36
|
-
* English side by side.
|
|
37
|
-
*
|
|
38
|
-
* This table is **input vocabulary, not display text**. Nothing in it is ever
|
|
39
|
-
* shown to anyone, and its keys must never be translated at runtime: a catalog
|
|
40
|
-
* lookup resolves against the reply locale, which would make `rouge` stop
|
|
41
|
-
* working the moment an admin's Discord is set to English — the opposite of the
|
|
42
|
-
* point. Both spellings are accepted from everyone, always, which only a flat
|
|
43
|
-
* table can promise.
|
|
44
|
-
*
|
|
45
|
-
* These are the names the kernel ships. A bot adds its own — the colour it
|
|
46
|
-
* calls by its brand's name — through {@link registerColorAliases}, which is
|
|
47
|
-
* also why this table is not the one lookups read: {@link COLOR_ALIASES} is.
|
|
48
|
-
*/
|
|
49
|
-
const BUILT_IN_COLOR_ALIASES = {
|
|
50
|
-
red: RED,
|
|
51
|
-
rouge: RED,
|
|
52
|
-
blue: BLUE,
|
|
53
|
-
bleu: BLUE,
|
|
54
|
-
green: GREEN,
|
|
55
|
-
vert: GREEN,
|
|
56
|
-
yellow: YELLOW,
|
|
57
|
-
jaune: YELLOW,
|
|
58
|
-
orange: ORANGE,
|
|
59
|
-
purple: PURPLE,
|
|
60
|
-
// French for purple, not the CSS `violet` (a pale pink): an admin typing it
|
|
61
|
-
// here is asking for the colour the word means in their own language.
|
|
62
|
-
violet: PURPLE,
|
|
63
|
-
pink: PINK,
|
|
64
|
-
rose: PINK,
|
|
65
|
-
white: WHITE,
|
|
66
|
-
blanc: WHITE,
|
|
67
|
-
black: BLACK,
|
|
68
|
-
noir: BLACK,
|
|
69
|
-
grey: GREY,
|
|
70
|
-
gray: GREY,
|
|
71
|
-
gris: GREY,
|
|
72
|
-
cyan: CYAN,
|
|
73
|
-
brown: BROWN,
|
|
74
|
-
marron: BROWN,
|
|
75
|
-
silver: SILVER,
|
|
76
|
-
argent: SILVER,
|
|
77
|
-
argenté: SILVER,
|
|
78
|
-
turquoise: TURQUOISE,
|
|
79
|
-
magenta: MAGENTA,
|
|
80
|
-
navy: NAVY,
|
|
81
|
-
marine: NAVY,
|
|
82
|
-
blurple: colors_1.DISCORD_BLURPLE,
|
|
83
|
-
};
|
|
84
|
-
/**
|
|
85
|
-
* Accents must not be a trap: `dore` and `doré` are the same request, and an
|
|
86
|
-
* administrator has no way of knowing which one this file happened to spell.
|
|
87
|
-
* Case and surrounding whitespace are folded for the same reason.
|
|
88
|
-
*/
|
|
89
|
-
function normalizeColorName(raw) {
|
|
90
|
-
return raw
|
|
91
|
-
.trim()
|
|
92
|
-
.toLowerCase()
|
|
93
|
-
.normalize("NFD")
|
|
94
|
-
.replace(/\p{Diacritic}/gu, "");
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* Every name a lookup answers to: the kernel's own, plus whatever the bot
|
|
98
|
-
* registered. Exposed for inspection — a screen listing the colours it accepts
|
|
99
|
-
* reads this — never for mutation, which goes through
|
|
100
|
-
* {@link registerColorAliases} so the length check cannot be skipped.
|
|
101
|
-
*/
|
|
102
|
-
exports.COLOR_ALIASES = {
|
|
103
|
-
...BUILT_IN_COLOR_ALIASES,
|
|
104
|
-
};
|
|
105
|
-
const COLORS_BY_NORMALIZED_NAME = new Map(Object.entries(exports.COLOR_ALIASES).map(([name, hex]) => [normalizeColorName(name), hex]));
|
|
106
|
-
/** The `#rrggbb` a recognised colour name stands for, `null` for anything else. */
|
|
107
|
-
function resolveNamedColor(raw) {
|
|
108
|
-
return COLORS_BY_NORMALIZED_NAME.get(normalizeColorName(raw)) ?? null;
|
|
109
|
-
}
|
|
110
|
-
/** `#RRGGBB` — the longest hexadecimal form the parser accepts. */
|
|
111
|
-
const HEX_INPUT_LENGTH = 7;
|
|
112
|
-
/**
|
|
113
|
-
* What a colour input field may hold.
|
|
114
|
-
*
|
|
115
|
-
* Derived from the built-in table rather than written down, so adding a longer
|
|
116
|
-
* name here cannot leave the field silently truncating it at the client — and
|
|
117
|
-
* fixed rather than recomputed on registration, because field definitions read
|
|
118
|
-
* it once at module load, long before a bot registers anything.
|
|
119
|
-
*/
|
|
120
|
-
exports.MAX_COLOR_INPUT_LENGTH = Math.max(HEX_INPUT_LENGTH, ...Object.keys(BUILT_IN_COLOR_ALIASES).map((name) => name.length));
|
|
121
|
-
/**
|
|
122
|
-
* Teach the parser the colours this bot calls by name — its brand gold, its
|
|
123
|
-
* team colours — from the composition root, before any module is constructed.
|
|
124
|
-
*
|
|
125
|
-
* A name over {@link MAX_COLOR_INPUT_LENGTH} is refused rather than accepted:
|
|
126
|
-
* the input field is already sized, so registering a longer name would let an
|
|
127
|
-
* administrator type a colour the client cuts short, which then reads as the
|
|
128
|
-
* parser rejecting a name it actually knows.
|
|
129
|
-
*
|
|
130
|
-
* @throws ColorAliasTooLongError when a name cannot fit the input field.
|
|
131
|
-
*/
|
|
132
|
-
function registerColorAliases(aliases) {
|
|
133
|
-
for (const [name, hex] of Object.entries(aliases)) {
|
|
134
|
-
if (name.length > exports.MAX_COLOR_INPUT_LENGTH) {
|
|
135
|
-
throw new color_input_errors_1.ColorAliasTooLongError(name, exports.MAX_COLOR_INPUT_LENGTH);
|
|
136
|
-
}
|
|
137
|
-
// Both views are written: the table is what a screen lists, the map is what
|
|
138
|
-
// a lookup reads, and a name present in one but not the other would be a
|
|
139
|
-
// colour the bot advertises and refuses.
|
|
140
|
-
exports.COLOR_ALIASES[name] = hex;
|
|
141
|
-
COLORS_BY_NORMALIZED_NAME.set(normalizeColorName(name), hex);
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
/** Discord accepts `#RGB` and `#RRGGBB`, with or without the leading hash. */
|
|
145
|
-
const HEX_COLOR_PATTERN = /^#?(?:[0-9a-f]{3}|[0-9a-f]{6})$/i;
|
|
4
|
+
const color_1 = require("../../color");
|
|
5
|
+
const color_aliases_1 = require("../../discord/ui/color-aliases");
|
|
146
6
|
/**
|
|
147
7
|
* Normalize a colour input to `#RRGGBB`, from a hexadecimal code or from one of
|
|
148
|
-
* the names in {@link COLOR_ALIASES} — an
|
|
149
|
-
* not have to look a hex code up. `null`
|
|
150
|
-
* refusal an administrator reads belongs to
|
|
151
|
-
* reports that it could not read the value and
|
|
8
|
+
* the names in {@link import("../../discord/ui/color-aliases").COLOR_ALIASES} — an
|
|
9
|
+
* administrator picking a colour should not have to look a hex code up. `null`
|
|
10
|
+
* for anything that is neither: the refusal an administrator reads belongs to
|
|
11
|
+
* whichever screen asked, so core reports that it could not read the value and
|
|
12
|
+
* leaves the wording to the caller.
|
|
152
13
|
*/
|
|
153
14
|
function parseColorInput(raw) {
|
|
154
|
-
|
|
155
|
-
const named = resolveNamedColor(value);
|
|
156
|
-
if (named !== null) {
|
|
157
|
-
return named;
|
|
158
|
-
}
|
|
159
|
-
if (!HEX_COLOR_PATTERN.test(value)) {
|
|
160
|
-
return null;
|
|
161
|
-
}
|
|
162
|
-
const digits = value.replace("#", "").toLowerCase();
|
|
163
|
-
const expanded = digits.length === 3 ? [...digits].map((digit) => `${digit}${digit}`).join("") : digits;
|
|
164
|
-
return `#${expanded}`;
|
|
15
|
+
return (0, color_aliases_1.resolveNamedColor)(raw) ?? (0, color_1.parseHexColor)(raw);
|
|
165
16
|
}
|
|
166
17
|
//# sourceMappingURL=color-input.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"color-input.js","sourceRoot":"","sources":["../../../src/discord/ui/color-input.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"color-input.js","sourceRoot":"","sources":["../../../src/discord/ui/color-input.ts"],"names":[],"mappings":";;AAWA,0CAEC;AAbD,mCAAwC;AACxC,8DAA+D;AAE/D;;;;;;;GAOG;AACH,SAAgB,eAAe,CAAC,GAAW;IAC1C,OAAO,IAAA,iCAAiB,EAAC,GAAG,CAAC,IAAI,IAAA,qBAAa,EAAC,GAAG,CAAC,CAAC;AACrD,CAAC"}
|
|
@@ -14,8 +14,6 @@ export interface EmbedColors {
|
|
|
14
14
|
}
|
|
15
15
|
/** Convert a `#rrggbb` string to the integer discord.js wants for `setColor`. */
|
|
16
16
|
export declare function toDiscordColor(hex: string): number;
|
|
17
|
-
/** Discord's own brand colour, the fallback for a bot that declares no palette. */
|
|
18
|
-
export declare const DISCORD_BLURPLE = "#5865f2";
|
|
19
17
|
/**
|
|
20
18
|
* What every embed renders as until the composition root says otherwise. Kept
|
|
21
19
|
* deliberately unbranded: a kernel that shipped one bot's colours would make
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"colors.d.ts","sourceRoot":"","sources":["../../../src/discord/ui/colors.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"colors.d.ts","sourceRoot":"","sources":["../../../src/discord/ui/colors.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,WAAW,WAAW;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,4EAA4E;IAC5E,KAAK,EAAE,MAAM,CAAC;IACd,iEAAiE;IACjE,OAAO,EAAE,MAAM,CAAC;CAChB;AAED,iFAAiF;AACjF,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAElD;AAED;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CAMtD,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,YAAY,EAAE,WAAyC,CAAC;AAErE;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,OAAO,CAAC,WAAW,CAAC,GAAG,IAAI,CAE1E"}
|