@neontechspace/fluxerly 1000.0.0-nightly.12
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/CHANGELOG.md +833 -0
- package/LICENSE +201 -0
- package/README.md +129 -0
- package/agents/AGENTS.md +195 -0
- package/dist/api/default/application.d.ts +34 -0
- package/dist/api/default/application.d.ts.map +1 -0
- package/dist/api/default/application.js +2 -0
- package/dist/api/default/application.js.map +1 -0
- package/dist/api/default/attachments.d.ts +89 -0
- package/dist/api/default/attachments.d.ts.map +1 -0
- package/dist/api/default/attachments.js +2 -0
- package/dist/api/default/attachments.js.map +1 -0
- package/dist/api/default/audit-logs.d.ts +48 -0
- package/dist/api/default/audit-logs.d.ts.map +1 -0
- package/dist/api/default/audit-logs.js +2 -0
- package/dist/api/default/audit-logs.js.map +1 -0
- package/dist/api/default/bot.d.ts +200 -0
- package/dist/api/default/bot.d.ts.map +1 -0
- package/dist/api/default/bot.js +309 -0
- package/dist/api/default/bot.js.map +1 -0
- package/dist/api/default/cache.d.ts +105 -0
- package/dist/api/default/cache.d.ts.map +1 -0
- package/dist/api/default/cache.js +2 -0
- package/dist/api/default/cache.js.map +1 -0
- package/dist/api/default/channels.d.ts +249 -0
- package/dist/api/default/channels.d.ts.map +1 -0
- package/dist/api/default/channels.js +2 -0
- package/dist/api/default/channels.js.map +1 -0
- package/dist/api/default/client.d.ts +528 -0
- package/dist/api/default/client.d.ts.map +1 -0
- package/dist/api/default/client.js +301 -0
- package/dist/api/default/client.js.map +1 -0
- package/dist/api/default/collectors.d.ts +76 -0
- package/dist/api/default/collectors.d.ts.map +1 -0
- package/dist/api/default/collectors.js +2 -0
- package/dist/api/default/collectors.js.map +1 -0
- package/dist/api/default/commands.d.ts +91 -0
- package/dist/api/default/commands.d.ts.map +1 -0
- package/dist/api/default/commands.js +92 -0
- package/dist/api/default/commands.js.map +1 -0
- package/dist/api/default/direct-messages.d.ts +111 -0
- package/dist/api/default/direct-messages.d.ts.map +1 -0
- package/dist/api/default/direct-messages.js +2 -0
- package/dist/api/default/direct-messages.js.map +1 -0
- package/dist/api/default/discovery.d.ts +76 -0
- package/dist/api/default/discovery.d.ts.map +1 -0
- package/dist/api/default/discovery.js +2 -0
- package/dist/api/default/discovery.js.map +1 -0
- package/dist/api/default/emojis.d.ts +88 -0
- package/dist/api/default/emojis.d.ts.map +1 -0
- package/dist/api/default/emojis.js +2 -0
- package/dist/api/default/emojis.js.map +1 -0
- package/dist/api/default/events.d.ts +127 -0
- package/dist/api/default/events.d.ts.map +1 -0
- package/dist/api/default/events.js +2 -0
- package/dist/api/default/events.js.map +1 -0
- package/dist/api/default/gateway.d.ts +62 -0
- package/dist/api/default/gateway.d.ts.map +1 -0
- package/dist/api/default/gateway.js +2 -0
- package/dist/api/default/gateway.js.map +1 -0
- package/dist/api/default/guards.d.ts +87 -0
- package/dist/api/default/guards.d.ts.map +1 -0
- package/dist/api/default/guards.js +78 -0
- package/dist/api/default/guards.js.map +1 -0
- package/dist/api/default/guilds.d.ts +230 -0
- package/dist/api/default/guilds.d.ts.map +1 -0
- package/dist/api/default/guilds.js +2 -0
- package/dist/api/default/guilds.js.map +1 -0
- package/dist/api/default/helpers.d.ts +79 -0
- package/dist/api/default/helpers.d.ts.map +1 -0
- package/dist/api/default/helpers.js +79 -0
- package/dist/api/default/helpers.js.map +1 -0
- package/dist/api/default/instance.d.ts +47 -0
- package/dist/api/default/instance.d.ts.map +1 -0
- package/dist/api/default/instance.js +2 -0
- package/dist/api/default/instance.js.map +1 -0
- package/dist/api/default/invites.d.ts +57 -0
- package/dist/api/default/invites.d.ts.map +1 -0
- package/dist/api/default/invites.js +2 -0
- package/dist/api/default/invites.js.map +1 -0
- package/dist/api/default/logging.d.ts +37 -0
- package/dist/api/default/logging.d.ts.map +1 -0
- package/dist/api/default/logging.js +2 -0
- package/dist/api/default/logging.js.map +1 -0
- package/dist/api/default/members.d.ts +442 -0
- package/dist/api/default/members.d.ts.map +1 -0
- package/dist/api/default/members.js +2 -0
- package/dist/api/default/members.js.map +1 -0
- package/dist/api/default/messages.d.ts +898 -0
- package/dist/api/default/messages.d.ts.map +1 -0
- package/dist/api/default/messages.js +2 -0
- package/dist/api/default/messages.js.map +1 -0
- package/dist/api/default/oauth.d.ts +168 -0
- package/dist/api/default/oauth.d.ts.map +1 -0
- package/dist/api/default/oauth.js +84 -0
- package/dist/api/default/oauth.js.map +1 -0
- package/dist/api/default/permissions.d.ts +44 -0
- package/dist/api/default/permissions.d.ts.map +1 -0
- package/dist/api/default/permissions.js +2 -0
- package/dist/api/default/permissions.js.map +1 -0
- package/dist/api/default/presence.d.ts +88 -0
- package/dist/api/default/presence.d.ts.map +1 -0
- package/dist/api/default/presence.js +2 -0
- package/dist/api/default/presence.js.map +1 -0
- package/dist/api/default/rest.d.ts +28 -0
- package/dist/api/default/rest.d.ts.map +1 -0
- package/dist/api/default/rest.js +2 -0
- package/dist/api/default/rest.js.map +1 -0
- package/dist/api/default/results.d.ts +31 -0
- package/dist/api/default/results.d.ts.map +1 -0
- package/dist/api/default/results.js +14 -0
- package/dist/api/default/results.js.map +1 -0
- package/dist/api/default/roles.d.ts +119 -0
- package/dist/api/default/roles.d.ts.map +1 -0
- package/dist/api/default/roles.js +2 -0
- package/dist/api/default/roles.js.map +1 -0
- package/dist/api/default/stickers.d.ts +92 -0
- package/dist/api/default/stickers.d.ts.map +1 -0
- package/dist/api/default/stickers.js +2 -0
- package/dist/api/default/stickers.js.map +1 -0
- package/dist/api/default/supervisor.d.ts +51 -0
- package/dist/api/default/supervisor.d.ts.map +1 -0
- package/dist/api/default/supervisor.js +53 -0
- package/dist/api/default/supervisor.js.map +1 -0
- package/dist/api/default/threads.d.ts +158 -0
- package/dist/api/default/threads.d.ts.map +1 -0
- package/dist/api/default/threads.js +2 -0
- package/dist/api/default/threads.js.map +1 -0
- package/dist/api/default/users.d.ts +73 -0
- package/dist/api/default/users.d.ts.map +1 -0
- package/dist/api/default/users.js +2 -0
- package/dist/api/default/users.js.map +1 -0
- package/dist/api/default/webhook-client.d.ts +149 -0
- package/dist/api/default/webhook-client.d.ts.map +1 -0
- package/dist/api/default/webhook-client.js +69 -0
- package/dist/api/default/webhook-client.js.map +1 -0
- package/dist/api/default/webhooks.d.ts +62 -0
- package/dist/api/default/webhooks.d.ts.map +1 -0
- package/dist/api/default/webhooks.js +2 -0
- package/dist/api/default/webhooks.js.map +1 -0
- package/dist/api/effect/application.d.ts +29 -0
- package/dist/api/effect/application.d.ts.map +1 -0
- package/dist/api/effect/application.js +2 -0
- package/dist/api/effect/application.js.map +1 -0
- package/dist/api/effect/attachments.d.ts +84 -0
- package/dist/api/effect/attachments.d.ts.map +1 -0
- package/dist/api/effect/attachments.js +2 -0
- package/dist/api/effect/attachments.js.map +1 -0
- package/dist/api/effect/audit-logs.d.ts +42 -0
- package/dist/api/effect/audit-logs.d.ts.map +1 -0
- package/dist/api/effect/audit-logs.js +2 -0
- package/dist/api/effect/audit-logs.js.map +1 -0
- package/dist/api/effect/bot.d.ts +233 -0
- package/dist/api/effect/bot.d.ts.map +1 -0
- package/dist/api/effect/bot.js +230 -0
- package/dist/api/effect/bot.js.map +1 -0
- package/dist/api/effect/cache.d.ts +103 -0
- package/dist/api/effect/cache.d.ts.map +1 -0
- package/dist/api/effect/cache.js +2 -0
- package/dist/api/effect/cache.js.map +1 -0
- package/dist/api/effect/channels.d.ts +231 -0
- package/dist/api/effect/channels.d.ts.map +1 -0
- package/dist/api/effect/channels.js +2 -0
- package/dist/api/effect/channels.js.map +1 -0
- package/dist/api/effect/client.d.ts +622 -0
- package/dist/api/effect/client.d.ts.map +1 -0
- package/dist/api/effect/client.js +191 -0
- package/dist/api/effect/client.js.map +1 -0
- package/dist/api/effect/collectors.d.ts +90 -0
- package/dist/api/effect/collectors.d.ts.map +1 -0
- package/dist/api/effect/collectors.js +2 -0
- package/dist/api/effect/collectors.js.map +1 -0
- package/dist/api/effect/commands.d.ts +86 -0
- package/dist/api/effect/commands.d.ts.map +1 -0
- package/dist/api/effect/commands.js +87 -0
- package/dist/api/effect/commands.js.map +1 -0
- package/dist/api/effect/direct-messages.d.ts +102 -0
- package/dist/api/effect/direct-messages.d.ts.map +1 -0
- package/dist/api/effect/direct-messages.js +2 -0
- package/dist/api/effect/direct-messages.js.map +1 -0
- package/dist/api/effect/discovery.d.ts +68 -0
- package/dist/api/effect/discovery.d.ts.map +1 -0
- package/dist/api/effect/discovery.js +2 -0
- package/dist/api/effect/discovery.js.map +1 -0
- package/dist/api/effect/emojis.d.ts +77 -0
- package/dist/api/effect/emojis.d.ts.map +1 -0
- package/dist/api/effect/emojis.js +2 -0
- package/dist/api/effect/emojis.js.map +1 -0
- package/dist/api/effect/events.d.ts +78 -0
- package/dist/api/effect/events.d.ts.map +1 -0
- package/dist/api/effect/events.js +12 -0
- package/dist/api/effect/events.js.map +1 -0
- package/dist/api/effect/failures.d.ts +14 -0
- package/dist/api/effect/failures.d.ts.map +1 -0
- package/dist/api/effect/failures.js +2 -0
- package/dist/api/effect/failures.js.map +1 -0
- package/dist/api/effect/gateway.d.ts +63 -0
- package/dist/api/effect/gateway.d.ts.map +1 -0
- package/dist/api/effect/gateway.js +2 -0
- package/dist/api/effect/gateway.js.map +1 -0
- package/dist/api/effect/guards.d.ts +91 -0
- package/dist/api/effect/guards.d.ts.map +1 -0
- package/dist/api/effect/guards.js +94 -0
- package/dist/api/effect/guards.js.map +1 -0
- package/dist/api/effect/guilds.d.ts +221 -0
- package/dist/api/effect/guilds.d.ts.map +1 -0
- package/dist/api/effect/guilds.js +2 -0
- package/dist/api/effect/guilds.js.map +1 -0
- package/dist/api/effect/helpers.d.ts +300 -0
- package/dist/api/effect/helpers.d.ts.map +1 -0
- package/dist/api/effect/helpers.js +156 -0
- package/dist/api/effect/helpers.js.map +1 -0
- package/dist/api/effect/hierarchy.d.ts +26 -0
- package/dist/api/effect/hierarchy.d.ts.map +1 -0
- package/dist/api/effect/hierarchy.js +26 -0
- package/dist/api/effect/hierarchy.js.map +1 -0
- package/dist/api/effect/instance.d.ts +46 -0
- package/dist/api/effect/instance.d.ts.map +1 -0
- package/dist/api/effect/instance.js +8 -0
- package/dist/api/effect/instance.js.map +1 -0
- package/dist/api/effect/invites.d.ts +49 -0
- package/dist/api/effect/invites.d.ts.map +1 -0
- package/dist/api/effect/invites.js +2 -0
- package/dist/api/effect/invites.js.map +1 -0
- package/dist/api/effect/logging.d.ts +37 -0
- package/dist/api/effect/logging.d.ts.map +1 -0
- package/dist/api/effect/logging.js +2 -0
- package/dist/api/effect/logging.js.map +1 -0
- package/dist/api/effect/members.d.ts +433 -0
- package/dist/api/effect/members.d.ts.map +1 -0
- package/dist/api/effect/members.js +2 -0
- package/dist/api/effect/members.js.map +1 -0
- package/dist/api/effect/messages.d.ts +877 -0
- package/dist/api/effect/messages.d.ts.map +1 -0
- package/dist/api/effect/messages.js +2 -0
- package/dist/api/effect/messages.js.map +1 -0
- package/dist/api/effect/oauth.d.ts +148 -0
- package/dist/api/effect/oauth.d.ts.map +1 -0
- package/dist/api/effect/oauth.js +51 -0
- package/dist/api/effect/oauth.js.map +1 -0
- package/dist/api/effect/permissions.d.ts +41 -0
- package/dist/api/effect/permissions.d.ts.map +1 -0
- package/dist/api/effect/permissions.js +2 -0
- package/dist/api/effect/permissions.js.map +1 -0
- package/dist/api/effect/presence.d.ts +83 -0
- package/dist/api/effect/presence.d.ts.map +1 -0
- package/dist/api/effect/presence.js +2 -0
- package/dist/api/effect/presence.js.map +1 -0
- package/dist/api/effect/rest.d.ts +27 -0
- package/dist/api/effect/rest.d.ts.map +1 -0
- package/dist/api/effect/rest.js +2 -0
- package/dist/api/effect/rest.js.map +1 -0
- package/dist/api/effect/roles.d.ts +104 -0
- package/dist/api/effect/roles.d.ts.map +1 -0
- package/dist/api/effect/roles.js +2 -0
- package/dist/api/effect/roles.js.map +1 -0
- package/dist/api/effect/service.d.ts +76 -0
- package/dist/api/effect/service.d.ts.map +1 -0
- package/dist/api/effect/service.js +79 -0
- package/dist/api/effect/service.js.map +1 -0
- package/dist/api/effect/stickers.d.ts +81 -0
- package/dist/api/effect/stickers.d.ts.map +1 -0
- package/dist/api/effect/stickers.js +2 -0
- package/dist/api/effect/stickers.js.map +1 -0
- package/dist/api/effect/supervisor.d.ts +56 -0
- package/dist/api/effect/supervisor.d.ts.map +1 -0
- package/dist/api/effect/supervisor.js +58 -0
- package/dist/api/effect/supervisor.js.map +1 -0
- package/dist/api/effect/threads.d.ts +154 -0
- package/dist/api/effect/threads.d.ts.map +1 -0
- package/dist/api/effect/threads.js +2 -0
- package/dist/api/effect/threads.js.map +1 -0
- package/dist/api/effect/users.d.ts +62 -0
- package/dist/api/effect/users.d.ts.map +1 -0
- package/dist/api/effect/users.js +2 -0
- package/dist/api/effect/users.js.map +1 -0
- package/dist/api/effect/webhook-client.d.ts +140 -0
- package/dist/api/effect/webhook-client.d.ts.map +1 -0
- package/dist/api/effect/webhook-client.js +50 -0
- package/dist/api/effect/webhook-client.js.map +1 -0
- package/dist/api/effect/webhooks.d.ts +54 -0
- package/dist/api/effect/webhooks.d.ts.map +1 -0
- package/dist/api/effect/webhooks.js +2 -0
- package/dist/api/effect/webhooks.js.map +1 -0
- package/dist/api-errors.d.ts +609 -0
- package/dist/api-errors.d.ts.map +1 -0
- package/dist/api-errors.js +589 -0
- package/dist/api-errors.js.map +1 -0
- package/dist/application.d.ts +85 -0
- package/dist/application.d.ts.map +1 -0
- package/dist/application.js +44 -0
- package/dist/application.js.map +1 -0
- package/dist/assets.d.ts +197 -0
- package/dist/assets.d.ts.map +1 -0
- package/dist/assets.js +419 -0
- package/dist/assets.js.map +1 -0
- package/dist/attachments.d.ts +400 -0
- package/dist/attachments.d.ts.map +1 -0
- package/dist/attachments.js +88 -0
- package/dist/attachments.js.map +1 -0
- package/dist/audit-logs.d.ts +292 -0
- package/dist/audit-logs.d.ts.map +1 -0
- package/dist/audit-logs.js +46 -0
- package/dist/audit-logs.js.map +1 -0
- package/dist/bot-runner.d.ts +69 -0
- package/dist/bot-runner.d.ts.map +1 -0
- package/dist/bot-runner.js +41 -0
- package/dist/bot-runner.js.map +1 -0
- package/dist/builders.d.ts +153 -0
- package/dist/builders.d.ts.map +1 -0
- package/dist/builders.js +326 -0
- package/dist/builders.js.map +1 -0
- package/dist/cache.d.ts +187 -0
- package/dist/cache.d.ts.map +1 -0
- package/dist/cache.js +2 -0
- package/dist/cache.js.map +1 -0
- package/dist/channels.d.ts +903 -0
- package/dist/channels.d.ts.map +1 -0
- package/dist/channels.js +125 -0
- package/dist/channels.js.map +1 -0
- package/dist/cli.d.ts +9 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +65 -0
- package/dist/cli.js.map +1 -0
- package/dist/client.d.ts +645 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +2 -0
- package/dist/client.js.map +1 -0
- package/dist/collectors.d.ts +205 -0
- package/dist/collectors.d.ts.map +1 -0
- package/dist/collectors.js +71 -0
- package/dist/collectors.js.map +1 -0
- package/dist/colors.d.ts +55 -0
- package/dist/colors.d.ts.map +1 -0
- package/dist/colors.js +40 -0
- package/dist/colors.js.map +1 -0
- package/dist/command-arguments.d.ts +353 -0
- package/dist/command-arguments.d.ts.map +1 -0
- package/dist/command-arguments.js +2 -0
- package/dist/command-arguments.js.map +1 -0
- package/dist/command-help.d.ts +54 -0
- package/dist/command-help.d.ts.map +1 -0
- package/dist/command-help.js +2 -0
- package/dist/command-help.js.map +1 -0
- package/dist/commands.d.ts +328 -0
- package/dist/commands.d.ts.map +1 -0
- package/dist/commands.js +62 -0
- package/dist/commands.js.map +1 -0
- package/dist/counts.d.ts +124 -0
- package/dist/counts.d.ts.map +1 -0
- package/dist/counts.js +52 -0
- package/dist/counts.js.map +1 -0
- package/dist/default-commands.d.ts +400 -0
- package/dist/default-commands.d.ts.map +1 -0
- package/dist/default-commands.js +488 -0
- package/dist/default-commands.js.map +1 -0
- package/dist/default-supervisor.d.ts +111 -0
- package/dist/default-supervisor.d.ts.map +1 -0
- package/dist/default-supervisor.js +277 -0
- package/dist/default-supervisor.js.map +1 -0
- package/dist/discovery.d.ts +223 -0
- package/dist/discovery.d.ts.map +1 -0
- package/dist/discovery.js +18 -0
- package/dist/discovery.js.map +1 -0
- package/dist/effect-testing.d.ts +388 -0
- package/dist/effect-testing.d.ts.map +1 -0
- package/dist/effect-testing.js +261 -0
- package/dist/effect-testing.js.map +1 -0
- package/dist/effect.d.ts +220 -0
- package/dist/effect.d.ts.map +1 -0
- package/dist/effect.js +101 -0
- package/dist/effect.js.map +1 -0
- package/dist/embeds.d.ts +243 -0
- package/dist/embeds.d.ts.map +1 -0
- package/dist/embeds.js +2 -0
- package/dist/embeds.js.map +1 -0
- package/dist/error-tools.d.ts +101 -0
- package/dist/error-tools.d.ts.map +1 -0
- package/dist/error-tools.js +125 -0
- package/dist/error-tools.js.map +1 -0
- package/dist/errors.d.ts +386 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +440 -0
- package/dist/errors.js.map +1 -0
- package/dist/events.d.ts +798 -0
- package/dist/events.d.ts.map +1 -0
- package/dist/events.js +2 -0
- package/dist/events.js.map +1 -0
- package/dist/expressions.d.ts +188 -0
- package/dist/expressions.d.ts.map +1 -0
- package/dist/expressions.js +2 -0
- package/dist/expressions.js.map +1 -0
- package/dist/failures.d.ts +53 -0
- package/dist/failures.d.ts.map +1 -0
- package/dist/failures.js +2 -0
- package/dist/failures.js.map +1 -0
- package/dist/gateway.d.ts +48 -0
- package/dist/gateway.d.ts.map +1 -0
- package/dist/gateway.js +60 -0
- package/dist/gateway.js.map +1 -0
- package/dist/guilds.d.ts +923 -0
- package/dist/guilds.d.ts.map +1 -0
- package/dist/guilds.js +204 -0
- package/dist/guilds.js.map +1 -0
- package/dist/helpers.d.ts +423 -0
- package/dist/helpers.d.ts.map +1 -0
- package/dist/helpers.js +434 -0
- package/dist/helpers.js.map +1 -0
- package/dist/index.d.ts +228 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +109 -0
- package/dist/index.js.map +1 -0
- package/dist/input-validation.d.ts +51 -0
- package/dist/input-validation.d.ts.map +1 -0
- package/dist/input-validation.js +34 -0
- package/dist/input-validation.js.map +1 -0
- package/dist/instance.d.ts +101 -0
- package/dist/instance.d.ts.map +1 -0
- package/dist/instance.js +2 -0
- package/dist/instance.js.map +1 -0
- package/dist/internal/agents-section.d.ts +22 -0
- package/dist/internal/agents-section.d.ts.map +1 -0
- package/dist/internal/agents-section.js +101 -0
- package/dist/internal/agents-section.js.map +1 -0
- package/dist/internal/application.d.ts +16 -0
- package/dist/internal/application.d.ts.map +1 -0
- package/dist/internal/application.js +33 -0
- package/dist/internal/application.js.map +1 -0
- package/dist/internal/attachment-refresh.d.ts +18 -0
- package/dist/internal/attachment-refresh.d.ts.map +1 -0
- package/dist/internal/attachment-refresh.js +39 -0
- package/dist/internal/attachment-refresh.js.map +1 -0
- package/dist/internal/attachments.d.ts +45 -0
- package/dist/internal/attachments.d.ts.map +1 -0
- package/dist/internal/attachments.js +230 -0
- package/dist/internal/attachments.js.map +1 -0
- package/dist/internal/audit-logs.d.ts +13 -0
- package/dist/internal/audit-logs.d.ts.map +1 -0
- package/dist/internal/audit-logs.js +295 -0
- package/dist/internal/audit-logs.js.map +1 -0
- package/dist/internal/audit.d.ts +12 -0
- package/dist/internal/audit.d.ts.map +1 -0
- package/dist/internal/audit.js +22 -0
- package/dist/internal/audit.js.map +1 -0
- package/dist/internal/binding/default-adapters.d.ts +22 -0
- package/dist/internal/binding/default-adapters.d.ts.map +1 -0
- package/dist/internal/binding/default-adapters.js +304 -0
- package/dist/internal/binding/default-adapters.js.map +1 -0
- package/dist/internal/binding/default.d.ts +45 -0
- package/dist/internal/binding/default.d.ts.map +1 -0
- package/dist/internal/binding/default.js +86 -0
- package/dist/internal/binding/default.js.map +1 -0
- package/dist/internal/binding/execute.d.ts +51 -0
- package/dist/internal/binding/execute.d.ts.map +1 -0
- package/dist/internal/binding/execute.js +123 -0
- package/dist/internal/binding/execute.js.map +1 -0
- package/dist/internal/binding/native-adapters.d.ts +23 -0
- package/dist/internal/binding/native-adapters.d.ts.map +1 -0
- package/dist/internal/binding/native-adapters.js +90 -0
- package/dist/internal/binding/native-adapters.js.map +1 -0
- package/dist/internal/binding/native.d.ts +41 -0
- package/dist/internal/binding/native.d.ts.map +1 -0
- package/dist/internal/binding/native.js +34 -0
- package/dist/internal/binding/native.js.map +1 -0
- package/dist/internal/binding/operations.d.ts +361 -0
- package/dist/internal/binding/operations.d.ts.map +1 -0
- package/dist/internal/binding/operations.js +272 -0
- package/dist/internal/binding/operations.js.map +1 -0
- package/dist/internal/bot-runner.d.ts +65 -0
- package/dist/internal/bot-runner.d.ts.map +1 -0
- package/dist/internal/bot-runner.js +363 -0
- package/dist/internal/bot-runner.js.map +1 -0
- package/dist/internal/cache-changes.d.ts +43 -0
- package/dist/internal/cache-changes.d.ts.map +1 -0
- package/dist/internal/cache-changes.js +320 -0
- package/dist/internal/cache-changes.js.map +1 -0
- package/dist/internal/cache.d.ts +57 -0
- package/dist/internal/cache.d.ts.map +1 -0
- package/dist/internal/cache.js +318 -0
- package/dist/internal/cache.js.map +1 -0
- package/dist/internal/calls.d.ts +16 -0
- package/dist/internal/calls.d.ts.map +1 -0
- package/dist/internal/calls.js +108 -0
- package/dist/internal/calls.js.map +1 -0
- package/dist/internal/channel-cache.d.ts +69 -0
- package/dist/internal/channel-cache.d.ts.map +1 -0
- package/dist/internal/channel-cache.js +413 -0
- package/dist/internal/channel-cache.js.map +1 -0
- package/dist/internal/channel-decode.d.ts +44 -0
- package/dist/internal/channel-decode.d.ts.map +1 -0
- package/dist/internal/channel-decode.js +377 -0
- package/dist/internal/channel-decode.js.map +1 -0
- package/dist/internal/channels.d.ts +60 -0
- package/dist/internal/channels.d.ts.map +1 -0
- package/dist/internal/channels.js +605 -0
- package/dist/internal/channels.js.map +1 -0
- package/dist/internal/client/backoff.d.ts +42 -0
- package/dist/internal/client/backoff.d.ts.map +1 -0
- package/dist/internal/client/backoff.js +36 -0
- package/dist/internal/client/backoff.js.map +1 -0
- package/dist/internal/client/configuration-fields.d.ts +14 -0
- package/dist/internal/client/configuration-fields.d.ts.map +1 -0
- package/dist/internal/client/configuration-fields.js +11 -0
- package/dist/internal/client/configuration-fields.js.map +1 -0
- package/dist/internal/client/drain.d.ts +33 -0
- package/dist/internal/client/drain.d.ts.map +1 -0
- package/dist/internal/client/drain.js +109 -0
- package/dist/internal/client/drain.js.map +1 -0
- package/dist/internal/client/intake.d.ts +27 -0
- package/dist/internal/client/intake.d.ts.map +1 -0
- package/dist/internal/client/intake.js +198 -0
- package/dist/internal/client/intake.js.map +1 -0
- package/dist/internal/client/lifetime.d.ts +35 -0
- package/dist/internal/client/lifetime.d.ts.map +1 -0
- package/dist/internal/client/lifetime.js +109 -0
- package/dist/internal/client/lifetime.js.map +1 -0
- package/dist/internal/client/shard-loop.d.ts +93 -0
- package/dist/internal/client/shard-loop.d.ts.map +1 -0
- package/dist/internal/client/shard-loop.js +452 -0
- package/dist/internal/client/shard-loop.js.map +1 -0
- package/dist/internal/client-registry.d.ts +26 -0
- package/dist/internal/client-registry.d.ts.map +1 -0
- package/dist/internal/client-registry.js +11 -0
- package/dist/internal/client-registry.js.map +1 -0
- package/dist/internal/client.d.ts +189 -0
- package/dist/internal/client.d.ts.map +1 -0
- package/dist/internal/client.js +1935 -0
- package/dist/internal/client.js.map +1 -0
- package/dist/internal/clock.d.ts +9 -0
- package/dist/internal/clock.d.ts.map +1 -0
- package/dist/internal/clock.js +5 -0
- package/dist/internal/clock.js.map +1 -0
- package/dist/internal/code-catalogue.d.ts +712 -0
- package/dist/internal/code-catalogue.d.ts.map +1 -0
- package/dist/internal/code-catalogue.js +655 -0
- package/dist/internal/code-catalogue.js.map +1 -0
- package/dist/internal/collector.d.ts +34 -0
- package/dist/internal/collector.d.ts.map +1 -0
- package/dist/internal/collector.js +400 -0
- package/dist/internal/collector.js.map +1 -0
- package/dist/internal/command-arguments.d.ts +29 -0
- package/dist/internal/command-arguments.d.ts.map +1 -0
- package/dist/internal/command-arguments.js +484 -0
- package/dist/internal/command-arguments.js.map +1 -0
- package/dist/internal/command-guards.d.ts +57 -0
- package/dist/internal/command-guards.d.ts.map +1 -0
- package/dist/internal/command-guards.js +81 -0
- package/dist/internal/command-guards.js.map +1 -0
- package/dist/internal/command-help.d.ts +15 -0
- package/dist/internal/command-help.d.ts.map +1 -0
- package/dist/internal/command-help.js +121 -0
- package/dist/internal/command-help.js.map +1 -0
- package/dist/internal/commands.d.ts +212 -0
- package/dist/internal/commands.d.ts.map +1 -0
- package/dist/internal/commands.js +1004 -0
- package/dist/internal/commands.js.map +1 -0
- package/dist/internal/configuration.d.ts +86 -0
- package/dist/internal/configuration.d.ts.map +1 -0
- package/dist/internal/configuration.js +401 -0
- package/dist/internal/configuration.js.map +1 -0
- package/dist/internal/counts.d.ts +33 -0
- package/dist/internal/counts.d.ts.map +1 -0
- package/dist/internal/counts.js +348 -0
- package/dist/internal/counts.js.map +1 -0
- package/dist/internal/decode/primitives.d.ts +30 -0
- package/dist/internal/decode/primitives.d.ts.map +1 -0
- package/dist/internal/decode/primitives.js +56 -0
- package/dist/internal/decode/primitives.js.map +1 -0
- package/dist/internal/decode/timestamp.d.ts +13 -0
- package/dist/internal/decode/timestamp.d.ts.map +1 -0
- package/dist/internal/decode/timestamp.js +27 -0
- package/dist/internal/decode/timestamp.js.map +1 -0
- package/dist/internal/decode/trace.d.ts +11 -0
- package/dist/internal/decode/trace.d.ts.map +1 -0
- package/dist/internal/decode/trace.js +69 -0
- package/dist/internal/decode/trace.js.map +1 -0
- package/dist/internal/defects.d.ts +48 -0
- package/dist/internal/defects.d.ts.map +1 -0
- package/dist/internal/defects.js +100 -0
- package/dist/internal/defects.js.map +1 -0
- package/dist/internal/effect-failures.d.ts +12 -0
- package/dist/internal/effect-failures.d.ts.map +1 -0
- package/dist/internal/effect-failures.js +45 -0
- package/dist/internal/effect-failures.js.map +1 -0
- package/dist/internal/embeds.d.ts +12 -0
- package/dist/internal/embeds.d.ts.map +1 -0
- package/dist/internal/embeds.js +308 -0
- package/dist/internal/embeds.js.map +1 -0
- package/dist/internal/events.d.ts +156 -0
- package/dist/internal/events.d.ts.map +1 -0
- package/dist/internal/events.js +1071 -0
- package/dist/internal/events.js.map +1 -0
- package/dist/internal/expiry-queue.d.ts +42 -0
- package/dist/internal/expiry-queue.d.ts.map +1 -0
- package/dist/internal/expiry-queue.js +138 -0
- package/dist/internal/expiry-queue.js.map +1 -0
- package/dist/internal/expressions.d.ts +35 -0
- package/dist/internal/expressions.d.ts.map +1 -0
- package/dist/internal/expressions.js +311 -0
- package/dist/internal/expressions.js.map +1 -0
- package/dist/internal/failures.d.ts +107 -0
- package/dist/internal/failures.d.ts.map +1 -0
- package/dist/internal/failures.js +416 -0
- package/dist/internal/failures.js.map +1 -0
- package/dist/internal/field-text.d.ts +10 -0
- package/dist/internal/field-text.d.ts.map +1 -0
- package/dist/internal/field-text.js +37 -0
- package/dist/internal/field-text.js.map +1 -0
- package/dist/internal/gateway/commands.d.ts +92 -0
- package/dist/internal/gateway/commands.d.ts.map +1 -0
- package/dist/internal/gateway/commands.js +223 -0
- package/dist/internal/gateway/commands.js.map +1 -0
- package/dist/internal/gateway/dispatch-table.d.ts +42 -0
- package/dist/internal/gateway/dispatch-table.d.ts.map +1 -0
- package/dist/internal/gateway/dispatch-table.js +288 -0
- package/dist/internal/gateway/dispatch-table.js.map +1 -0
- package/dist/internal/gateway/event-dispatches.d.ts +97 -0
- package/dist/internal/gateway/event-dispatches.d.ts.map +1 -0
- package/dist/internal/gateway/event-dispatches.js +172 -0
- package/dist/internal/gateway/event-dispatches.js.map +1 -0
- package/dist/internal/gateway/frames.d.ts +45 -0
- package/dist/internal/gateway/frames.d.ts.map +1 -0
- package/dist/internal/gateway/frames.js +121 -0
- package/dist/internal/gateway/frames.js.map +1 -0
- package/dist/internal/gateway/options.d.ts +24 -0
- package/dist/internal/gateway/options.d.ts.map +1 -0
- package/dist/internal/gateway/options.js +103 -0
- package/dist/internal/gateway/options.js.map +1 -0
- package/dist/internal/gateway/session.d.ts +104 -0
- package/dist/internal/gateway/session.d.ts.map +1 -0
- package/dist/internal/gateway/session.js +420 -0
- package/dist/internal/gateway/session.js.map +1 -0
- package/dist/internal/gateway-requests.d.ts +10 -0
- package/dist/internal/gateway-requests.d.ts.map +1 -0
- package/dist/internal/gateway-requests.js +26 -0
- package/dist/internal/gateway-requests.js.map +1 -0
- package/dist/internal/gateway.d.ts +19 -0
- package/dist/internal/gateway.d.ts.map +1 -0
- package/dist/internal/gateway.js +11 -0
- package/dist/internal/gateway.js.map +1 -0
- package/dist/internal/guild-cache.d.ts +69 -0
- package/dist/internal/guild-cache.d.ts.map +1 -0
- package/dist/internal/guild-cache.js +402 -0
- package/dist/internal/guild-cache.js.map +1 -0
- package/dist/internal/guild-discovery.d.ts +15 -0
- package/dist/internal/guild-discovery.d.ts.map +1 -0
- package/dist/internal/guild-discovery.js +258 -0
- package/dist/internal/guild-discovery.js.map +1 -0
- package/dist/internal/guild-lifecycle.d.ts +18 -0
- package/dist/internal/guild-lifecycle.d.ts.map +1 -0
- package/dist/internal/guild-lifecycle.js +119 -0
- package/dist/internal/guild-lifecycle.js.map +1 -0
- package/dist/internal/guild-settings.d.ts +11 -0
- package/dist/internal/guild-settings.d.ts.map +1 -0
- package/dist/internal/guild-settings.js +150 -0
- package/dist/internal/guild-settings.js.map +1 -0
- package/dist/internal/guilds.d.ts +94 -0
- package/dist/internal/guilds.d.ts.map +1 -0
- package/dist/internal/guilds.js +785 -0
- package/dist/internal/guilds.js.map +1 -0
- package/dist/internal/init-command.d.ts +54 -0
- package/dist/internal/init-command.d.ts.map +1 -0
- package/dist/internal/init-command.js +248 -0
- package/dist/internal/init-command.js.map +1 -0
- package/dist/internal/instance.d.ts +69 -0
- package/dist/internal/instance.d.ts.map +1 -0
- package/dist/internal/instance.js +455 -0
- package/dist/internal/instance.js.map +1 -0
- package/dist/internal/invalid-callback-return.d.ts +3 -0
- package/dist/internal/invalid-callback-return.d.ts.map +1 -0
- package/dist/internal/invalid-callback-return.js +26 -0
- package/dist/internal/invalid-callback-return.js.map +1 -0
- package/dist/internal/invites.d.ts +19 -0
- package/dist/internal/invites.d.ts.map +1 -0
- package/dist/internal/invites.js +182 -0
- package/dist/internal/invites.js.map +1 -0
- package/dist/internal/logging.d.ts +129 -0
- package/dist/internal/logging.d.ts.map +1 -0
- package/dist/internal/logging.js +868 -0
- package/dist/internal/logging.js.map +1 -0
- package/dist/internal/logical-scheduler.d.ts +27 -0
- package/dist/internal/logical-scheduler.d.ts.map +1 -0
- package/dist/internal/logical-scheduler.js +102 -0
- package/dist/internal/logical-scheduler.js.map +1 -0
- package/dist/internal/masking.d.ts +13 -0
- package/dist/internal/masking.d.ts.map +1 -0
- package/dist/internal/masking.js +235 -0
- package/dist/internal/masking.js.map +1 -0
- package/dist/internal/member-chunks.d.ts +96 -0
- package/dist/internal/member-chunks.d.ts.map +1 -0
- package/dist/internal/member-chunks.js +557 -0
- package/dist/internal/member-chunks.js.map +1 -0
- package/dist/internal/member-search-workflow.d.ts +19 -0
- package/dist/internal/member-search-workflow.d.ts.map +1 -0
- package/dist/internal/member-search-workflow.js +143 -0
- package/dist/internal/member-search-workflow.js.map +1 -0
- package/dist/internal/member-search.d.ts +20 -0
- package/dist/internal/member-search.d.ts.map +1 -0
- package/dist/internal/member-search.js +201 -0
- package/dist/internal/member-search.js.map +1 -0
- package/dist/internal/message-cleanup.d.ts +9 -0
- package/dist/internal/message-cleanup.d.ts.map +1 -0
- package/dist/internal/message-cleanup.js +368 -0
- package/dist/internal/message-cleanup.js.map +1 -0
- package/dist/internal/message-fields.d.ts +9 -0
- package/dist/internal/message-fields.d.ts.map +1 -0
- package/dist/internal/message-fields.js +55 -0
- package/dist/internal/message-fields.js.map +1 -0
- package/dist/internal/message-search-workflow.d.ts +14 -0
- package/dist/internal/message-search-workflow.d.ts.map +1 -0
- package/dist/internal/message-search-workflow.js +101 -0
- package/dist/internal/message-search-workflow.js.map +1 -0
- package/dist/internal/message-search.d.ts +19 -0
- package/dist/internal/message-search.d.ts.map +1 -0
- package/dist/internal/message-search.js +317 -0
- package/dist/internal/message-search.js.map +1 -0
- package/dist/internal/message.d.ts +34 -0
- package/dist/internal/message.d.ts.map +1 -0
- package/dist/internal/message.js +723 -0
- package/dist/internal/message.js.map +1 -0
- package/dist/internal/metrics.d.ts +16 -0
- package/dist/internal/metrics.d.ts.map +1 -0
- package/dist/internal/metrics.js +49 -0
- package/dist/internal/metrics.js.map +1 -0
- package/dist/internal/moderation.d.ts +20 -0
- package/dist/internal/moderation.d.ts.map +1 -0
- package/dist/internal/moderation.js +219 -0
- package/dist/internal/moderation.js.map +1 -0
- package/dist/internal/multipart.d.ts +10 -0
- package/dist/internal/multipart.d.ts.map +1 -0
- package/dist/internal/multipart.js +156 -0
- package/dist/internal/multipart.js.map +1 -0
- package/dist/internal/node-version.d.ts +10 -0
- package/dist/internal/node-version.d.ts.map +1 -0
- package/dist/internal/node-version.js +21 -0
- package/dist/internal/node-version.js.map +1 -0
- package/dist/internal/oauth.d.ts +29 -0
- package/dist/internal/oauth.d.ts.map +1 -0
- package/dist/internal/oauth.js +721 -0
- package/dist/internal/oauth.js.map +1 -0
- package/dist/internal/observer.d.ts +21 -0
- package/dist/internal/observer.d.ts.map +1 -0
- package/dist/internal/observer.js +48 -0
- package/dist/internal/observer.js.map +1 -0
- package/dist/internal/operation-signal.d.ts +9 -0
- package/dist/internal/operation-signal.d.ts.map +1 -0
- package/dist/internal/operation-signal.js +19 -0
- package/dist/internal/operation-signal.js.map +1 -0
- package/dist/internal/pagination.d.ts +67 -0
- package/dist/internal/pagination.d.ts.map +1 -0
- package/dist/internal/pagination.js +306 -0
- package/dist/internal/pagination.js.map +1 -0
- package/dist/internal/permission-requirements.d.ts +34 -0
- package/dist/internal/permission-requirements.d.ts.map +1 -0
- package/dist/internal/permission-requirements.js +204 -0
- package/dist/internal/permission-requirements.js.map +1 -0
- package/dist/internal/permissions.d.ts +28 -0
- package/dist/internal/permissions.d.ts.map +1 -0
- package/dist/internal/permissions.js +314 -0
- package/dist/internal/permissions.js.map +1 -0
- package/dist/internal/pins.d.ts +24 -0
- package/dist/internal/pins.d.ts.map +1 -0
- package/dist/internal/pins.js +83 -0
- package/dist/internal/pins.js.map +1 -0
- package/dist/internal/presence.d.ts +101 -0
- package/dist/internal/presence.d.ts.map +1 -0
- package/dist/internal/presence.js +581 -0
- package/dist/internal/presence.js.map +1 -0
- package/dist/internal/protocol/gateway.d.ts +116 -0
- package/dist/internal/protocol/gateway.d.ts.map +1 -0
- package/dist/internal/protocol/gateway.js +258 -0
- package/dist/internal/protocol/gateway.js.map +1 -0
- package/dist/internal/rate-limit-templates.d.ts +2 -0
- package/dist/internal/rate-limit-templates.d.ts.map +1 -0
- package/dist/internal/rate-limit-templates.js +132 -0
- package/dist/internal/rate-limit-templates.js.map +1 -0
- package/dist/internal/rate-limits.d.ts +32 -0
- package/dist/internal/rate-limits.d.ts.map +1 -0
- package/dist/internal/rate-limits.js +306 -0
- package/dist/internal/rate-limits.js.map +1 -0
- package/dist/internal/reaction-collector.d.ts +39 -0
- package/dist/internal/reaction-collector.d.ts.map +1 -0
- package/dist/internal/reaction-collector.js +441 -0
- package/dist/internal/reaction-collector.js.map +1 -0
- package/dist/internal/reaction-pages.d.ts +18 -0
- package/dist/internal/reaction-pages.d.ts.map +1 -0
- package/dist/internal/reaction-pages.js +213 -0
- package/dist/internal/reaction-pages.js.map +1 -0
- package/dist/internal/reactions.d.ts +30 -0
- package/dist/internal/reactions.d.ts.map +1 -0
- package/dist/internal/reactions.js +160 -0
- package/dist/internal/reactions.js.map +1 -0
- package/dist/internal/rejection-scope.d.ts +25 -0
- package/dist/internal/rejection-scope.d.ts.map +1 -0
- package/dist/internal/rejection-scope.js +103 -0
- package/dist/internal/rejection-scope.js.map +1 -0
- package/dist/internal/response-json.d.ts +12 -0
- package/dist/internal/response-json.d.ts.map +1 -0
- package/dist/internal/response-json.js +74 -0
- package/dist/internal/response-json.js.map +1 -0
- package/dist/internal/rest/admission.d.ts +77 -0
- package/dist/internal/rest/admission.d.ts.map +1 -0
- package/dist/internal/rest/admission.js +178 -0
- package/dist/internal/rest/admission.js.map +1 -0
- package/dist/internal/rest/attempt.d.ts +124 -0
- package/dist/internal/rest/attempt.d.ts.map +1 -0
- package/dist/internal/rest/attempt.js +410 -0
- package/dist/internal/rest/attempt.js.map +1 -0
- package/dist/internal/rest/classify.d.ts +93 -0
- package/dist/internal/rest/classify.d.ts.map +1 -0
- package/dist/internal/rest/classify.js +304 -0
- package/dist/internal/rest/classify.js.map +1 -0
- package/dist/internal/rest/download.d.ts +66 -0
- package/dist/internal/rest/download.d.ts.map +1 -0
- package/dist/internal/rest/download.js +552 -0
- package/dist/internal/rest/download.js.map +1 -0
- package/dist/internal/rest/options.d.ts +42 -0
- package/dist/internal/rest/options.d.ts.map +1 -0
- package/dist/internal/rest/options.js +99 -0
- package/dist/internal/rest/options.js.map +1 -0
- package/dist/internal/rest/owner.d.ts +154 -0
- package/dist/internal/rest/owner.d.ts.map +1 -0
- package/dist/internal/rest/owner.js +1292 -0
- package/dist/internal/rest/owner.js.map +1 -0
- package/dist/internal/rest/request.d.ts +31 -0
- package/dist/internal/rest/request.d.ts.map +1 -0
- package/dist/internal/rest/request.js +227 -0
- package/dist/internal/rest/request.js.map +1 -0
- package/dist/internal/rest.d.ts +10 -0
- package/dist/internal/rest.d.ts.map +1 -0
- package/dist/internal/rest.js +9 -0
- package/dist/internal/rest.js.map +1 -0
- package/dist/internal/retention-age.d.ts +11 -0
- package/dist/internal/retention-age.d.ts.map +1 -0
- package/dist/internal/retention-age.js +29 -0
- package/dist/internal/retention-age.js.map +1 -0
- package/dist/internal/role-hierarchy-workflow.d.ts +15 -0
- package/dist/internal/role-hierarchy-workflow.d.ts.map +1 -0
- package/dist/internal/role-hierarchy-workflow.js +122 -0
- package/dist/internal/role-hierarchy-workflow.js.map +1 -0
- package/dist/internal/role-hierarchy.d.ts +11 -0
- package/dist/internal/role-hierarchy.d.ts.map +1 -0
- package/dist/internal/role-hierarchy.js +87 -0
- package/dist/internal/role-hierarchy.js.map +1 -0
- package/dist/internal/scheduled-tasks.d.ts +46 -0
- package/dist/internal/scheduled-tasks.d.ts.map +1 -0
- package/dist/internal/scheduled-tasks.js +190 -0
- package/dist/internal/scheduled-tasks.js.map +1 -0
- package/dist/internal/sharding.d.ts +62 -0
- package/dist/internal/sharding.d.ts.map +1 -0
- package/dist/internal/sharding.js +205 -0
- package/dist/internal/sharding.js.map +1 -0
- package/dist/internal/starter-project.d.ts +27 -0
- package/dist/internal/starter-project.d.ts.map +1 -0
- package/dist/internal/starter-project.js +224 -0
- package/dist/internal/starter-project.js.map +1 -0
- package/dist/internal/suggest.d.ts +12 -0
- package/dist/internal/suggest.d.ts.map +1 -0
- package/dist/internal/suggest.js +51 -0
- package/dist/internal/suggest.js.map +1 -0
- package/dist/internal/supervisor.d.ts +95 -0
- package/dist/internal/supervisor.d.ts.map +1 -0
- package/dist/internal/supervisor.js +1829 -0
- package/dist/internal/supervisor.js.map +1 -0
- package/dist/internal/testing/discovery.d.ts +24 -0
- package/dist/internal/testing/discovery.d.ts.map +1 -0
- package/dist/internal/testing/discovery.js +22 -0
- package/dist/internal/testing/discovery.js.map +1 -0
- package/dist/internal/testing/errors.d.ts +43 -0
- package/dist/internal/testing/errors.d.ts.map +1 -0
- package/dist/internal/testing/errors.js +63 -0
- package/dist/internal/testing/errors.js.map +1 -0
- package/dist/internal/testing/fixtures.d.ts +477 -0
- package/dist/internal/testing/fixtures.d.ts.map +1 -0
- package/dist/internal/testing/fixtures.js +233 -0
- package/dist/internal/testing/fixtures.js.map +1 -0
- package/dist/internal/testing/gateway.d.ts +51 -0
- package/dist/internal/testing/gateway.d.ts.map +1 -0
- package/dist/internal/testing/gateway.js +265 -0
- package/dist/internal/testing/gateway.js.map +1 -0
- package/dist/internal/testing/harness.d.ts +60 -0
- package/dist/internal/testing/harness.d.ts.map +1 -0
- package/dist/internal/testing/harness.js +280 -0
- package/dist/internal/testing/harness.js.map +1 -0
- package/dist/internal/testing/http.d.ts +31 -0
- package/dist/internal/testing/http.d.ts.map +1 -0
- package/dist/internal/testing/http.js +347 -0
- package/dist/internal/testing/http.js.map +1 -0
- package/dist/internal/testing/types.d.ts +222 -0
- package/dist/internal/testing/types.d.ts.map +1 -0
- package/dist/internal/testing/types.js +2 -0
- package/dist/internal/testing/types.js.map +1 -0
- package/dist/internal/testing/wait.d.ts +16 -0
- package/dist/internal/testing/wait.d.ts.map +1 -0
- package/dist/internal/testing/wait.js +55 -0
- package/dist/internal/testing/wait.js.map +1 -0
- package/dist/internal/thread-events.d.ts +40 -0
- package/dist/internal/thread-events.d.ts.map +1 -0
- package/dist/internal/thread-events.js +121 -0
- package/dist/internal/thread-events.js.map +1 -0
- package/dist/internal/threads.d.ts +47 -0
- package/dist/internal/threads.d.ts.map +1 -0
- package/dist/internal/threads.js +587 -0
- package/dist/internal/threads.js.map +1 -0
- package/dist/internal/transfer-source.d.ts +29 -0
- package/dist/internal/transfer-source.d.ts.map +1 -0
- package/dist/internal/transfer-source.js +347 -0
- package/dist/internal/transfer-source.js.map +1 -0
- package/dist/internal/transport/http.d.ts +12 -0
- package/dist/internal/transport/http.d.ts.map +1 -0
- package/dist/internal/transport/http.js +44 -0
- package/dist/internal/transport/http.js.map +1 -0
- package/dist/internal/transport/index.d.ts +21 -0
- package/dist/internal/transport/index.d.ts.map +1 -0
- package/dist/internal/transport/index.js +15 -0
- package/dist/internal/transport/index.js.map +1 -0
- package/dist/internal/transport/socket.d.ts +51 -0
- package/dist/internal/transport/socket.d.ts.map +1 -0
- package/dist/internal/transport/socket.js +27 -0
- package/dist/internal/transport/socket.js.map +1 -0
- package/dist/internal/transport/user-agent.d.ts +7 -0
- package/dist/internal/transport/user-agent.d.ts.map +1 -0
- package/dist/internal/transport/user-agent.js +42 -0
- package/dist/internal/transport/user-agent.js.map +1 -0
- package/dist/internal/uploads.d.ts +23 -0
- package/dist/internal/uploads.d.ts.map +1 -0
- package/dist/internal/uploads.js +89 -0
- package/dist/internal/uploads.js.map +1 -0
- package/dist/internal/user-cache.d.ts +50 -0
- package/dist/internal/user-cache.d.ts.map +1 -0
- package/dist/internal/user-cache.js +273 -0
- package/dist/internal/user-cache.js.map +1 -0
- package/dist/internal/users.d.ts +41 -0
- package/dist/internal/users.d.ts.map +1 -0
- package/dist/internal/users.js +333 -0
- package/dist/internal/users.js.map +1 -0
- package/dist/internal/vanity-url.d.ts +11 -0
- package/dist/internal/vanity-url.d.ts.map +1 -0
- package/dist/internal/vanity-url.js +58 -0
- package/dist/internal/vanity-url.js.map +1 -0
- package/dist/internal/webhooks.d.ts +58 -0
- package/dist/internal/webhooks.d.ts.map +1 -0
- package/dist/internal/webhooks.js +490 -0
- package/dist/internal/webhooks.js.map +1 -0
- package/dist/invites.d.ts +86 -0
- package/dist/invites.d.ts.map +1 -0
- package/dist/invites.js +2 -0
- package/dist/invites.js.map +1 -0
- package/dist/logging.d.ts +228 -0
- package/dist/logging.d.ts.map +1 -0
- package/dist/logging.js +2 -0
- package/dist/logging.js.map +1 -0
- package/dist/member-chunks.d.ts +145 -0
- package/dist/member-chunks.d.ts.map +1 -0
- package/dist/member-chunks.js +68 -0
- package/dist/member-chunks.js.map +1 -0
- package/dist/member-search.d.ts +140 -0
- package/dist/member-search.d.ts.map +1 -0
- package/dist/member-search.js +14 -0
- package/dist/member-search.js.map +1 -0
- package/dist/message-cleanup.d.ts +227 -0
- package/dist/message-cleanup.d.ts.map +1 -0
- package/dist/message-cleanup.js +101 -0
- package/dist/message-cleanup.js.map +1 -0
- package/dist/message-errors.d.ts +172 -0
- package/dist/message-errors.d.ts.map +1 -0
- package/dist/message-errors.js +173 -0
- package/dist/message-errors.js.map +1 -0
- package/dist/message-search.d.ts +201 -0
- package/dist/message-search.d.ts.map +1 -0
- package/dist/message-search.js +2 -0
- package/dist/message-search.js.map +1 -0
- package/dist/messages.d.ts +694 -0
- package/dist/messages.d.ts.map +1 -0
- package/dist/messages.js +37 -0
- package/dist/messages.js.map +1 -0
- package/dist/native-commands.d.ts +451 -0
- package/dist/native-commands.d.ts.map +1 -0
- package/dist/native-commands.js +432 -0
- package/dist/native-commands.js.map +1 -0
- package/dist/native-supervisor.d.ts +125 -0
- package/dist/native-supervisor.d.ts.map +1 -0
- package/dist/native-supervisor.js +126 -0
- package/dist/native-supervisor.js.map +1 -0
- package/dist/oauth.d.ts +298 -0
- package/dist/oauth.d.ts.map +1 -0
- package/dist/oauth.js +128 -0
- package/dist/oauth.js.map +1 -0
- package/dist/observer.d.ts +111 -0
- package/dist/observer.d.ts.map +1 -0
- package/dist/observer.js +2 -0
- package/dist/observer.js.map +1 -0
- package/dist/pagination.d.ts +117 -0
- package/dist/pagination.d.ts.map +1 -0
- package/dist/pagination.js +61 -0
- package/dist/pagination.js.map +1 -0
- package/dist/permissions.d.ts +73 -0
- package/dist/permissions.d.ts.map +1 -0
- package/dist/permissions.js +2 -0
- package/dist/permissions.js.map +1 -0
- package/dist/pins.d.ts +62 -0
- package/dist/pins.d.ts.map +1 -0
- package/dist/pins.js +2 -0
- package/dist/pins.js.map +1 -0
- package/dist/presence.d.ts +84 -0
- package/dist/presence.d.ts.map +1 -0
- package/dist/presence.js +46 -0
- package/dist/presence.js.map +1 -0
- package/dist/reaction-pages.d.ts +99 -0
- package/dist/reaction-pages.d.ts.map +1 -0
- package/dist/reaction-pages.js +2 -0
- package/dist/reaction-pages.js.map +1 -0
- package/dist/reactions.d.ts +118 -0
- package/dist/reactions.d.ts.map +1 -0
- package/dist/reactions.js +2 -0
- package/dist/reactions.js.map +1 -0
- package/dist/rest.d.ts +260 -0
- package/dist/rest.d.ts.map +1 -0
- package/dist/rest.js +46 -0
- package/dist/rest.js.map +1 -0
- package/dist/role-hierarchy.d.ts +81 -0
- package/dist/role-hierarchy.d.ts.map +1 -0
- package/dist/role-hierarchy.js +53 -0
- package/dist/role-hierarchy.js.map +1 -0
- package/dist/sharding.d.ts +219 -0
- package/dist/sharding.d.ts.map +1 -0
- package/dist/sharding.js +86 -0
- package/dist/sharding.js.map +1 -0
- package/dist/supervisor.d.ts +392 -0
- package/dist/supervisor.d.ts.map +1 -0
- package/dist/supervisor.js +101 -0
- package/dist/supervisor.js.map +1 -0
- package/dist/testing.d.ts +258 -0
- package/dist/testing.d.ts.map +1 -0
- package/dist/testing.js +202 -0
- package/dist/testing.js.map +1 -0
- package/dist/text.d.ts +38 -0
- package/dist/text.d.ts.map +1 -0
- package/dist/text.js +46 -0
- package/dist/text.js.map +1 -0
- package/dist/threads.d.ts +258 -0
- package/dist/threads.d.ts.map +1 -0
- package/dist/threads.js +2 -0
- package/dist/threads.js.map +1 -0
- package/dist/users.d.ts +204 -0
- package/dist/users.d.ts.map +1 -0
- package/dist/users.js +44 -0
- package/dist/users.js.map +1 -0
- package/dist/webhooks.d.ts +423 -0
- package/dist/webhooks.d.ts.map +1 -0
- package/dist/webhooks.js +68 -0
- package/dist/webhooks.js.map +1 -0
- package/esm-only.cjs +3 -0
- package/examples/starter/bot-effect.ts +17 -0
- package/examples/starter/bot.js +13 -0
- package/examples/starter/bot.ts +13 -0
- package/package.json +82 -0
- package/src/api/default/application.ts +40 -0
- package/src/api/default/attachments.ts +106 -0
- package/src/api/default/audit-logs.ts +58 -0
- package/src/api/default/bot.ts +586 -0
- package/src/api/default/cache.ts +106 -0
- package/src/api/default/channels.ts +317 -0
- package/src/api/default/client.ts +829 -0
- package/src/api/default/collectors.ts +81 -0
- package/src/api/default/commands.ts +92 -0
- package/src/api/default/direct-messages.ts +143 -0
- package/src/api/default/discovery.ts +103 -0
- package/src/api/default/emojis.ts +125 -0
- package/src/api/default/events.ts +144 -0
- package/src/api/default/gateway.ts +67 -0
- package/src/api/default/guards.ts +173 -0
- package/src/api/default/guilds.ts +271 -0
- package/src/api/default/helpers.ts +97 -0
- package/src/api/default/instance.ts +49 -0
- package/src/api/default/invites.ts +73 -0
- package/src/api/default/logging.ts +37 -0
- package/src/api/default/members.ts +550 -0
- package/src/api/default/messages.ts +1053 -0
- package/src/api/default/oauth.ts +293 -0
- package/src/api/default/permissions.ts +47 -0
- package/src/api/default/presence.ts +88 -0
- package/src/api/default/rest.ts +30 -0
- package/src/api/default/results.ts +44 -0
- package/src/api/default/roles.ts +154 -0
- package/src/api/default/stickers.ts +129 -0
- package/src/api/default/supervisor.ts +53 -0
- package/src/api/default/threads.ts +233 -0
- package/src/api/default/users.ts +82 -0
- package/src/api/default/webhook-client.ts +266 -0
- package/src/api/default/webhooks.ts +89 -0
- package/src/api/effect/application.ts +29 -0
- package/src/api/effect/attachments.ts +100 -0
- package/src/api/effect/audit-logs.ts +50 -0
- package/src/api/effect/bot.ts +546 -0
- package/src/api/effect/cache.ts +110 -0
- package/src/api/effect/channels.ts +293 -0
- package/src/api/effect/client.ts +792 -0
- package/src/api/effect/collectors.ts +103 -0
- package/src/api/effect/commands.ts +87 -0
- package/src/api/effect/direct-messages.ts +119 -0
- package/src/api/effect/discovery.ts +87 -0
- package/src/api/effect/emojis.ts +108 -0
- package/src/api/effect/events.ts +92 -0
- package/src/api/effect/failures.ts +14 -0
- package/src/api/effect/gateway.ts +63 -0
- package/src/api/effect/guards.ts +194 -0
- package/src/api/effect/guilds.ts +247 -0
- package/src/api/effect/helpers.ts +359 -0
- package/src/api/effect/hierarchy.ts +26 -0
- package/src/api/effect/instance.ts +50 -0
- package/src/api/effect/invites.ts +59 -0
- package/src/api/effect/logging.ts +37 -0
- package/src/api/effect/members.ts +521 -0
- package/src/api/effect/messages.ts +1003 -0
- package/src/api/effect/oauth.ts +208 -0
- package/src/api/effect/permissions.ts +44 -0
- package/src/api/effect/presence.ts +83 -0
- package/src/api/effect/rest.ts +27 -0
- package/src/api/effect/roles.ts +136 -0
- package/src/api/effect/service.ts +104 -0
- package/src/api/effect/stickers.ts +112 -0
- package/src/api/effect/supervisor.ts +58 -0
- package/src/api/effect/threads.ts +221 -0
- package/src/api/effect/users.ts +66 -0
- package/src/api/effect/webhook-client.ts +206 -0
- package/src/api/effect/webhooks.ts +75 -0
- package/src/api-errors.ts +985 -0
- package/src/application.ts +103 -0
- package/src/assets.ts +731 -0
- package/src/attachments.ts +469 -0
- package/src/audit-logs.ts +355 -0
- package/src/bot-runner.ts +91 -0
- package/src/builders.ts +390 -0
- package/src/cache.ts +190 -0
- package/src/channels.ts +1051 -0
- package/src/cli.ts +60 -0
- package/src/client.ts +663 -0
- package/src/collectors.ts +248 -0
- package/src/colors.ts +91 -0
- package/src/command-arguments.ts +432 -0
- package/src/command-help.ts +55 -0
- package/src/commands.ts +403 -0
- package/src/counts.ts +160 -0
- package/src/default-commands.ts +1147 -0
- package/src/default-supervisor.ts +484 -0
- package/src/discovery.ts +241 -0
- package/src/effect-testing.ts +603 -0
- package/src/effect.ts +751 -0
- package/src/embeds.ts +253 -0
- package/src/error-tools.ts +191 -0
- package/src/errors.ts +849 -0
- package/src/events.ts +830 -0
- package/src/expressions.ts +198 -0
- package/src/failures.ts +55 -0
- package/src/gateway.ts +86 -0
- package/src/guilds.ts +1108 -0
- package/src/helpers.ts +836 -0
- package/src/index.ts +796 -0
- package/src/input-validation.ts +94 -0
- package/src/instance.ts +111 -0
- package/src/internal/agents-section.ts +114 -0
- package/src/internal/application.ts +51 -0
- package/src/internal/attachment-refresh.ts +57 -0
- package/src/internal/attachments.ts +313 -0
- package/src/internal/audit-logs.ts +336 -0
- package/src/internal/audit.ts +33 -0
- package/src/internal/binding/default-adapters.ts +482 -0
- package/src/internal/binding/default.ts +155 -0
- package/src/internal/binding/execute.ts +221 -0
- package/src/internal/binding/native-adapters.ts +199 -0
- package/src/internal/binding/native.ts +72 -0
- package/src/internal/binding/operations.ts +1171 -0
- package/src/internal/bot-runner.ts +480 -0
- package/src/internal/cache-changes.ts +363 -0
- package/src/internal/cache.ts +323 -0
- package/src/internal/calls.ts +119 -0
- package/src/internal/channel-cache.ts +435 -0
- package/src/internal/channel-decode.ts +399 -0
- package/src/internal/channels.ts +874 -0
- package/src/internal/client/backoff.ts +69 -0
- package/src/internal/client/configuration-fields.ts +18 -0
- package/src/internal/client/drain.ts +150 -0
- package/src/internal/client/intake.ts +228 -0
- package/src/internal/client/lifetime.ts +165 -0
- package/src/internal/client/shard-loop.ts +586 -0
- package/src/internal/client-registry.ts +35 -0
- package/src/internal/client.ts +2448 -0
- package/src/internal/clock.ts +11 -0
- package/src/internal/code-catalogue.ts +739 -0
- package/src/internal/collector.ts +452 -0
- package/src/internal/command-arguments.ts +585 -0
- package/src/internal/command-guards.ts +96 -0
- package/src/internal/command-help.ts +156 -0
- package/src/internal/commands.ts +1319 -0
- package/src/internal/configuration.ts +529 -0
- package/src/internal/counts.ts +471 -0
- package/src/internal/decode/primitives.ts +67 -0
- package/src/internal/decode/timestamp.ts +29 -0
- package/src/internal/decode/trace.ts +65 -0
- package/src/internal/defects.ts +115 -0
- package/src/internal/effect-failures.ts +65 -0
- package/src/internal/embeds.ts +355 -0
- package/src/internal/events.ts +1345 -0
- package/src/internal/expiry-queue.ts +148 -0
- package/src/internal/expressions.ts +415 -0
- package/src/internal/failures.ts +492 -0
- package/src/internal/field-text.ts +40 -0
- package/src/internal/gateway/commands.ts +328 -0
- package/src/internal/gateway/dispatch-table.ts +383 -0
- package/src/internal/gateway/event-dispatches.ts +201 -0
- package/src/internal/gateway/frames.ts +176 -0
- package/src/internal/gateway/options.ts +144 -0
- package/src/internal/gateway/session.ts +625 -0
- package/src/internal/gateway-requests.ts +26 -0
- package/src/internal/gateway.ts +22 -0
- package/src/internal/guild-cache.ts +424 -0
- package/src/internal/guild-discovery.ts +332 -0
- package/src/internal/guild-lifecycle.ts +128 -0
- package/src/internal/guild-settings.ts +209 -0
- package/src/internal/guilds.ts +949 -0
- package/src/internal/init-command.ts +305 -0
- package/src/internal/instance.ts +645 -0
- package/src/internal/invalid-callback-return.ts +28 -0
- package/src/internal/invites.ts +234 -0
- package/src/internal/logging.ts +1007 -0
- package/src/internal/logical-scheduler.ts +139 -0
- package/src/internal/masking.ts +224 -0
- package/src/internal/member-chunks.ts +649 -0
- package/src/internal/member-search-workflow.ts +237 -0
- package/src/internal/member-search.ts +272 -0
- package/src/internal/message-cleanup.ts +515 -0
- package/src/internal/message-fields.ts +71 -0
- package/src/internal/message-search-workflow.ts +166 -0
- package/src/internal/message-search.ts +476 -0
- package/src/internal/message.ts +879 -0
- package/src/internal/metrics.ts +55 -0
- package/src/internal/moderation.ts +288 -0
- package/src/internal/multipart.ts +171 -0
- package/src/internal/node-version.ts +22 -0
- package/src/internal/oauth.ts +1146 -0
- package/src/internal/observer.ts +62 -0
- package/src/internal/operation-signal.ts +26 -0
- package/src/internal/pagination.ts +494 -0
- package/src/internal/permission-requirements.ts +359 -0
- package/src/internal/permissions.ts +417 -0
- package/src/internal/pins.ts +115 -0
- package/src/internal/presence.ts +745 -0
- package/src/internal/protocol/gateway.ts +299 -0
- package/src/internal/rate-limit-templates.ts +138 -0
- package/src/internal/rate-limits.ts +346 -0
- package/src/internal/reaction-collector.ts +499 -0
- package/src/internal/reaction-pages.ts +260 -0
- package/src/internal/reactions.ts +174 -0
- package/src/internal/rejection-scope.ts +119 -0
- package/src/internal/response-json.ts +76 -0
- package/src/internal/rest/admission.ts +210 -0
- package/src/internal/rest/attempt.ts +617 -0
- package/src/internal/rest/classify.ts +391 -0
- package/src/internal/rest/download.ts +658 -0
- package/src/internal/rest/options.ts +145 -0
- package/src/internal/rest/owner.ts +1828 -0
- package/src/internal/rest/request.ts +289 -0
- package/src/internal/rest.ts +9 -0
- package/src/internal/retention-age.ts +33 -0
- package/src/internal/role-hierarchy-workflow.ts +150 -0
- package/src/internal/role-hierarchy.ts +93 -0
- package/src/internal/scheduled-tasks.ts +217 -0
- package/src/internal/sharding.ts +270 -0
- package/src/internal/starter-project.ts +251 -0
- package/src/internal/suggest.ts +50 -0
- package/src/internal/supervisor.ts +2253 -0
- package/src/internal/testing/discovery.ts +23 -0
- package/src/internal/testing/errors.ts +67 -0
- package/src/internal/testing/fixtures.ts +714 -0
- package/src/internal/testing/gateway.ts +305 -0
- package/src/internal/testing/harness.ts +328 -0
- package/src/internal/testing/http.ts +395 -0
- package/src/internal/testing/types.ts +240 -0
- package/src/internal/testing/wait.ts +63 -0
- package/src/internal/thread-events.ts +128 -0
- package/src/internal/threads.ts +718 -0
- package/src/internal/transfer-source.ts +359 -0
- package/src/internal/transport/http.ts +46 -0
- package/src/internal/transport/index.ts +23 -0
- package/src/internal/transport/socket.ts +71 -0
- package/src/internal/transport/user-agent.ts +46 -0
- package/src/internal/uploads.ts +111 -0
- package/src/internal/user-cache.ts +294 -0
- package/src/internal/users.ts +402 -0
- package/src/internal/vanity-url.ts +80 -0
- package/src/internal/webhooks.ts +690 -0
- package/src/invites.ts +87 -0
- package/src/logging.ts +247 -0
- package/src/member-chunks.ts +195 -0
- package/src/member-search.ts +152 -0
- package/src/message-cleanup.ts +308 -0
- package/src/message-errors.ts +245 -0
- package/src/message-search.ts +213 -0
- package/src/messages.ts +768 -0
- package/src/native-commands.ts +1249 -0
- package/src/native-supervisor.ts +345 -0
- package/src/oauth.ts +413 -0
- package/src/observer.ts +118 -0
- package/src/pagination.ts +172 -0
- package/src/permissions.ts +74 -0
- package/src/pins.ts +65 -0
- package/src/presence.ts +124 -0
- package/src/reaction-pages.ts +106 -0
- package/src/reactions.ts +126 -0
- package/src/rest.ts +282 -0
- package/src/role-hierarchy.ts +127 -0
- package/src/sharding.ts +272 -0
- package/src/supervisor.ts +460 -0
- package/src/testing.ts +424 -0
- package/src/text.ts +76 -0
- package/src/threads.ts +274 -0
- package/src/users.ts +237 -0
- package/src/webhooks.ts +512 -0
|
@@ -0,0 +1,1147 @@
|
|
|
1
|
+
import { readCaller, thrownReason } from "#sdk/internal/defects"
|
|
2
|
+
import type {
|
|
3
|
+
CommandCooldownClaim,
|
|
4
|
+
CommandCooldownPer,
|
|
5
|
+
CommandCooldownRequest,
|
|
6
|
+
MemoryCooldownOptions,
|
|
7
|
+
PrefixCommandDefinition,
|
|
8
|
+
PrefixCommandGroupDefinition,
|
|
9
|
+
PrefixCommandGroupMetadata,
|
|
10
|
+
PrefixCommandGuardResult,
|
|
11
|
+
PrefixCommandMetadata,
|
|
12
|
+
PrefixCommandParse,
|
|
13
|
+
PrefixCommandParseInput,
|
|
14
|
+
PrefixCommandParseRejection,
|
|
15
|
+
PrefixCommandRejection,
|
|
16
|
+
PrefixCommandRegistrationOptions,
|
|
17
|
+
PrefixCommandUnmatched,
|
|
18
|
+
PrefixCommandsOptions,
|
|
19
|
+
} from "#sdk/commands"
|
|
20
|
+
import type { CommandArgumentDescriptor, CommandArgumentSchema, CommandArgumentValues } from "#sdk/command-arguments"
|
|
21
|
+
import type { CommandContextHelpOptions, CommandHelpOptions } from "#sdk/command-help"
|
|
22
|
+
import { commandHelp, contextHelpOptions } from "#sdk/internal/command-help"
|
|
23
|
+
import { parseQuotedPrefixCommand } from "#sdk/commands"
|
|
24
|
+
import { ApplicationError, CancelledError, ConfigurationError, SdkDefect } from "#sdk/errors"
|
|
25
|
+
import {
|
|
26
|
+
configurationEffect,
|
|
27
|
+
cooldownRequest,
|
|
28
|
+
cooldownSuffix,
|
|
29
|
+
createMemoryCooldownStore,
|
|
30
|
+
snapshotClaimInput,
|
|
31
|
+
dispatchCommand,
|
|
32
|
+
type LocalMemoryCooldownStore,
|
|
33
|
+
PrefixCommandRegistry,
|
|
34
|
+
rejectionReply,
|
|
35
|
+
routerSubscriptionOptions,
|
|
36
|
+
sameCommandPath,
|
|
37
|
+
snapshotCommandDefinition,
|
|
38
|
+
snapshotCommandCooldown,
|
|
39
|
+
validateCommandShape,
|
|
40
|
+
checkBotCommandKeys,
|
|
41
|
+
} from "#sdk/internal/commands"
|
|
42
|
+
import { convertCommandArguments } from "#sdk/internal/command-arguments"
|
|
43
|
+
import type { SendError } from "#sdk/message-errors"
|
|
44
|
+
import type { DefaultSendOptions, Message, MessageCore, ReplyInput, SendOptions } from "#sdk/messages"
|
|
45
|
+
import * as Cause from "effect/Cause"
|
|
46
|
+
import * as Effect from "effect/Effect"
|
|
47
|
+
import * as Exit from "effect/Exit"
|
|
48
|
+
import { clientServices, type ClientServices } from "#sdk/internal/client-registry"
|
|
49
|
+
import { makeReport, messageReference, primaryError, promiseHook, throwIfErr } from "#sdk/internal/failures"
|
|
50
|
+
import {
|
|
51
|
+
currentRejectionScope,
|
|
52
|
+
fiberRejectionScope,
|
|
53
|
+
inRejectionScope,
|
|
54
|
+
withRejectionScope,
|
|
55
|
+
} from "#sdk/internal/rejection-scope"
|
|
56
|
+
import type { ClientLogger } from "#sdk/internal/logging"
|
|
57
|
+
import { recordCommandFailure } from "#sdk/internal/events"
|
|
58
|
+
import { errAsync, type ResultAsync } from "neverthrow"
|
|
59
|
+
import { askerPageOptions } from "#sdk/internal/reaction-pages"
|
|
60
|
+
import type { DefaultPaginateOptions, PageInput, PaginateFailure, PaginateResult } from "#sdk/reaction-pages"
|
|
61
|
+
import type { Client, EventHandlerOptions, FailureReport, Subscription } from "./index.js"
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Frozen command information copied for a matched message and passed to its guards, middleware and rejection callback.
|
|
65
|
+
* Includes the incoming message and parsed strings, but not converted argument values.
|
|
66
|
+
* Execution and cooldown-key callbacks receive the extended execution context
|
|
67
|
+
*
|
|
68
|
+
* @category Commands
|
|
69
|
+
*/
|
|
70
|
+
export interface DefaultPrefixCommandContext<M extends MessageCore = Message> {
|
|
71
|
+
/** Client supplied to `attach`, available for explicit operations. The application remains responsible for connecting and shutting it down */
|
|
72
|
+
readonly client: Client<M>
|
|
73
|
+
/** Incoming frozen message with this client's selected fields. The router does not fetch excluded fields */
|
|
74
|
+
readonly message: M
|
|
75
|
+
/** Prefix that matched this message, such as `!`, `!!` or the bot mention when mentionPrefix is enabled */
|
|
76
|
+
readonly prefix: string
|
|
77
|
+
/** Registered command name, even when the message used an alias or different letter case */
|
|
78
|
+
readonly name: string
|
|
79
|
+
/** Frozen registered names through this command, such as `["admin", "inspect"]`. Absent for root commands and does not imply permission */
|
|
80
|
+
readonly path?: readonly string[]
|
|
81
|
+
/** Parsed string tokens copied to a frozen array, unchanged by subsequent argument conversion */
|
|
82
|
+
readonly args: readonly string[]
|
|
83
|
+
/** Argument text from the parser. The default retains everything after command-name separator whitespace, including trailing whitespace */
|
|
84
|
+
readonly rawArgs: string
|
|
85
|
+
/** Subscription cancellation signal for operations that support it. Cancellation prevents later router callbacks but cannot forcibly stop pending application promises */
|
|
86
|
+
readonly signal: AbortSignal
|
|
87
|
+
/**
|
|
88
|
+
* Reply to the incoming message through the attached client, with this handler's cancellation signal already applied.
|
|
89
|
+
* A string is sent as the reply's content, such as `reply("Pong")`.
|
|
90
|
+
* Delegates to `client.messages.reply`, including its validation, deadline, nonce, retry, cache and defect behavior.
|
|
91
|
+
* Cancellation or a lost response can leave the reply posted. An Err does not always mean nothing was sent, and uncertain sends are not replayed.
|
|
92
|
+
* Returning the result from a command callback reports an Err like a thrown error, so `({ reply }) => reply("Pong")` needs no further checks
|
|
93
|
+
*/
|
|
94
|
+
readonly reply: (
|
|
95
|
+
input: ReplyInput | string,
|
|
96
|
+
options?: SendOptions,
|
|
97
|
+
) => ResultAsync<M, SendError | CancelledError | ConfigurationError>
|
|
98
|
+
/**
|
|
99
|
+
* Build help pages from the router that matched this command, for example `({ help, reply }) => reply(help()[0] ?? "No commands")`.
|
|
100
|
+
* Takes the same settings as `router.help`, all optional: The prefix defaults to the one this message used and the
|
|
101
|
+
* page length to 2,000 UTF-16 code units. Nothing is sent. Invalid settings throw ConfigurationError as `router.help` does
|
|
102
|
+
*/
|
|
103
|
+
readonly help: (options?: CommandContextHelpOptions) => readonly string[]
|
|
104
|
+
/**
|
|
105
|
+
* Show several pages in this message's channel that the command's author flips with ◀ and ▶ reactions, such as `({ paginate }) => paginate(["First", "Second"])`.
|
|
106
|
+
* Delegates to `client.messages.paginate` with users defaulting to this message's author and this handler's cancellation signal applied, combined with any supplied signal.
|
|
107
|
+
* Pass users to let other people flip, such as `() => true` for anyone. The other options, defaults, permissions, cleanup and failures are those of `client.messages.paginate`.
|
|
108
|
+
* The result settles when listening ends, so the handler stays active until then. Returning it from a command callback reports an Err like a thrown error
|
|
109
|
+
*/
|
|
110
|
+
readonly paginate: (
|
|
111
|
+
pages: readonly PageInput[],
|
|
112
|
+
options?: DefaultPaginateOptions,
|
|
113
|
+
) => ResultAsync<PaginateResult<M>, PaginateFailure | CancelledError>
|
|
114
|
+
/**
|
|
115
|
+
* Send this router's help in this message's channel, such as `({ sendHelp }) => sendHelp()`.
|
|
116
|
+
* Takes the same optional settings as `help`. One page is sent as a plain message, and several pages use `paginate`
|
|
117
|
+
* with its defaults, so only the command's author can flip them.
|
|
118
|
+
* Invalid settings, and help with no visible entries, return ConfigurationError without sending anything
|
|
119
|
+
*/
|
|
120
|
+
readonly sendHelp: (
|
|
121
|
+
options?: CommandContextHelpOptions,
|
|
122
|
+
) => ResultAsync<PaginateResult<M>, PaginateFailure | CancelledError>
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Matched-command context plus fully converted argument values, supplied to execution and cooldown-key callbacks
|
|
127
|
+
*
|
|
128
|
+
* @category Commands
|
|
129
|
+
*/
|
|
130
|
+
export interface DefaultPrefixCommandExecutionContext<
|
|
131
|
+
S extends CommandArgumentSchema = {},
|
|
132
|
+
M extends MessageCore = Message,
|
|
133
|
+
> extends DefaultPrefixCommandContext<M> {
|
|
134
|
+
/** Frozen values keyed by schema names, such as `values.count`. Empty when no schema is supplied. Guards and rejection callbacks never receive partial values */
|
|
135
|
+
readonly values: CommandArgumentValues<S>
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Frozen message and matched prefix for `onUnmatched`, when parsing or lookup did not select an executable command
|
|
140
|
+
*
|
|
141
|
+
* @category Commands
|
|
142
|
+
*/
|
|
143
|
+
export interface DefaultPrefixCommandUnmatchedContext<M extends MessageCore = Message> {
|
|
144
|
+
/** Attached client available for explicit feedback. The router does not take ownership of its lifetime */
|
|
145
|
+
readonly client: Client<M>
|
|
146
|
+
/** Incoming frozen message with the attached client's selected fields only */
|
|
147
|
+
readonly message: M
|
|
148
|
+
/** Exact prefix selected before parsing declined, name lookup missed or a group needed a subcommand */
|
|
149
|
+
readonly prefix: string
|
|
150
|
+
/** Cancellation signal for cooperative feedback work. A promise that ignores it may keep running after the subscription closes */
|
|
151
|
+
readonly signal: AbortSignal
|
|
152
|
+
/**
|
|
153
|
+
* Reply to the unmatched incoming message through the attached client, with this callback's cancellation signal already applied.
|
|
154
|
+
* A string is sent as the reply's content.
|
|
155
|
+
* Delegates to `client.messages.reply`, including its validation, deadline, nonce, retry, cache and defect behavior.
|
|
156
|
+
* Cancellation or a lost response can leave the reply posted. An Err does not always mean nothing was sent, and uncertain sends are not replayed.
|
|
157
|
+
* Returning the result from the callback reports an Err like a thrown error
|
|
158
|
+
*/
|
|
159
|
+
readonly reply: (
|
|
160
|
+
input: ReplyInput | string,
|
|
161
|
+
options?: SendOptions,
|
|
162
|
+
) => ResultAsync<M, SendError | CancelledError | ConfigurationError>
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Decide whether a matched command may run, from raw context before argument conversion.
|
|
167
|
+
* Return true to allow it, false to deny it silently, or `{ deny: "reason" }` to deny it with text that
|
|
168
|
+
* `onReject: "reply"` sends. A promise of those values is awaited.
|
|
169
|
+
* A false verdict is still counted, logged at Debug and passed to a custom onReject callback, but never sends an automatic reply.
|
|
170
|
+
* The built-in `guards` cover common checks. Throws, rejected promises, Err results and other values use subscription error reporting
|
|
171
|
+
*
|
|
172
|
+
* @category Commands
|
|
173
|
+
*/
|
|
174
|
+
export type DefaultPrefixCommandGuard<M extends MessageCore = Message> = (
|
|
175
|
+
context: DefaultPrefixCommandContext<M>,
|
|
176
|
+
) => PrefixCommandGuardResult | PromiseLike<PrefixCommandGuardResult>
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Run around every matched command of a router, in registration order, before its guards.
|
|
180
|
+
* Call `next()` to continue and await it to observe completion. Not calling it stops the command, which is logged at Debug.
|
|
181
|
+
* The rest of the chain runs at most once: Calling `next()` again, even concurrently, returns the first call's promise.
|
|
182
|
+
* When the command fails, `next()` rejects with the command's own error, the same value its execute callback threw,
|
|
183
|
+
* rejected with or returned in an Err
|
|
184
|
+
*
|
|
185
|
+
* A failure of the command is reported once with its command name, whatever the middleware does with the rejection.
|
|
186
|
+
* Rethrowing that same error adds no second report. A different throw, rejection or returned Err from the middleware
|
|
187
|
+
* is reported as a separate failure after the command's, also with the command name. Without a command failure, a
|
|
188
|
+
* middleware failure is reported like a failed command and stops the command if `next()` was not called yet.
|
|
189
|
+
* The command's failure is still reported when the subscription closes while the middleware is running
|
|
190
|
+
*
|
|
191
|
+
* @category Commands
|
|
192
|
+
*/
|
|
193
|
+
export type DefaultPrefixCommandMiddleware<M extends MessageCore = Message> = (
|
|
194
|
+
context: DefaultPrefixCommandContext<M>,
|
|
195
|
+
next: () => Promise<void>,
|
|
196
|
+
) => unknown
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* Rejection feedback for a command: `"reply"` sends a short explanation, such as the missing argument and the command's
|
|
200
|
+
* usage, the guard's deny reason or the cooldown's remaining time. `"silent"` sends nothing, and the rejection is still
|
|
201
|
+
* logged at Debug. A guard returning false never sends an automatic reply, even with "reply" selected.
|
|
202
|
+
* A function receives the context and rejection instead, including false guard denials
|
|
203
|
+
*
|
|
204
|
+
* So that repeated attempts do not make the bot repeat itself, `"reply"` answers an active cooldown key once until its
|
|
205
|
+
* retry time, and a guard denial once per user and command every 5 seconds. Argument rejections are always answered.
|
|
206
|
+
* A skipped reply is counted with the rejection and logged at Debug in the commands category.
|
|
207
|
+
* A function is called for every rejection, so it can count attempts and apply its own limit, for example with `retryAtMs`
|
|
208
|
+
*
|
|
209
|
+
* @category Commands
|
|
210
|
+
*/
|
|
211
|
+
export type DefaultPrefixCommandRejectionFeedback<M extends MessageCore = Message> =
|
|
212
|
+
"reply" | "silent" | ((context: DefaultPrefixCommandContext<M>, rejection: PrefixCommandRejection) => unknown)
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* Prefix and parsing options, plus router-wide middleware, rejection feedback and optional feedback when a
|
|
216
|
+
* command-like message has no executable match
|
|
217
|
+
*
|
|
218
|
+
* @category Commands
|
|
219
|
+
*/
|
|
220
|
+
export interface DefaultPrefixCommandsOptions<M extends MessageCore = Message> extends PrefixCommandsOptions<M> {
|
|
221
|
+
/**
|
|
222
|
+
* Handle parser declines, unknown names and groups without a subcommand, optionally sending feedback.
|
|
223
|
+
* An unknown name carries a `suggestion` when a registered name is close, and a parser decline carries a `reason` when the parser explained a syntax mistake, such as an unclosed quote from `commands.parseQuoted`.
|
|
224
|
+
* Return normally or a promise that completes the work. The router does not interpret a successful return value or send a response.
|
|
225
|
+
* The callback runs for every such message and anyone can cause that, so a reply sent from it needs the application's own limit, and in a channel shared with other bots the prefix may belong to a command of another bot.
|
|
226
|
+
* Throws, rejected promises and returned Err results use the attachment's `onError` reporting, without retry.
|
|
227
|
+
* Not called for ignored bots or messages without a matching prefix
|
|
228
|
+
*/
|
|
229
|
+
readonly onUnmatched?: (
|
|
230
|
+
context: DefaultPrefixCommandUnmatchedContext<M>,
|
|
231
|
+
unmatched: PrefixCommandUnmatched,
|
|
232
|
+
) => unknown
|
|
233
|
+
/**
|
|
234
|
+
* Rejection feedback for commands that do not set their own `onReject`. Omit it to give no feedback, except in
|
|
235
|
+
* runBot, which replies by default. Guards returning false never send an automatic reply
|
|
236
|
+
*/
|
|
237
|
+
readonly onReject?: DefaultPrefixCommandRejectionFeedback<M>
|
|
238
|
+
/** Middleware run around every matched command, in order. See DefaultPrefixCommandMiddleware */
|
|
239
|
+
readonly use?: readonly DefaultPrefixCommandMiddleware<M>[]
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* Storage that reserves a command cooldown and reports whether this invocation may execute.
|
|
244
|
+
* A custom store must handle saving claims and sharing them across processes if needed.
|
|
245
|
+
* Checking and reserving a full key must be atomic, so two concurrent calls cannot both claim the same key
|
|
246
|
+
*
|
|
247
|
+
* @category Commands
|
|
248
|
+
*/
|
|
249
|
+
export interface DefaultCooldownStore {
|
|
250
|
+
/**
|
|
251
|
+
* Reserve `input.key` for `input.durationMs` and return a claim immediately or through a promise.
|
|
252
|
+
* Only `CooldownAcquired` permits the handler to run. Other claims give optional rejection feedback, without waiting or retrying.
|
|
253
|
+
* Malformed claims, throws, rejected promises and returned Err results use subscription error reporting
|
|
254
|
+
*/
|
|
255
|
+
claim(input: CommandCooldownRequest): CommandCooldownClaim | PromiseLike<CommandCooldownClaim>
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* Limit how often a known command executes, per user by default.
|
|
260
|
+
* Claimed after its guards and argument conversion succeed, immediately before execution.
|
|
261
|
+
* The router does not release an acquired claim after handler failure or cancellation
|
|
262
|
+
*
|
|
263
|
+
* @category Commands
|
|
264
|
+
*/
|
|
265
|
+
export interface DefaultPrefixCommandCooldown<S extends CommandArgumentSchema = {}, M extends MessageCore = Message> {
|
|
266
|
+
/** Whole milliseconds per reservation, from 1 through 2,147,483,647 */
|
|
267
|
+
readonly durationMs: number
|
|
268
|
+
/** Whose invocations share the cooldown: `user` (default), `channel` or `guild` */
|
|
269
|
+
readonly per?: CommandCooldownPer
|
|
270
|
+
/**
|
|
271
|
+
* Store whose `claim` performs the reservation. Omit it to use the router's own memory store in this process, sized by
|
|
272
|
+
* the router's `cooldowns` option and shared by every router derived from the same create
|
|
273
|
+
*/
|
|
274
|
+
readonly store?: DefaultCooldownStore
|
|
275
|
+
/**
|
|
276
|
+
* Return a nonempty key suffix from the converted execution context, replacing the one selected by `per`.
|
|
277
|
+
* The router adds the command's canonical name or full group path, so aliases share a reservation and different groups remain separate
|
|
278
|
+
*/
|
|
279
|
+
readonly key?: (context: DefaultPrefixCommandExecutionContext<S, M>) => string
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* A command name and the application callback that handles it.
|
|
284
|
+
* Dispatch runs router middleware and the command's guards, converts arguments, claims any cooldown and then calls `execute`.
|
|
285
|
+
* Registration copies metadata and arguments but retains callback and cooldown-store references.
|
|
286
|
+
* No automatic message or retry is provided, and successful return values are ignored
|
|
287
|
+
*
|
|
288
|
+
* @category Commands
|
|
289
|
+
*/
|
|
290
|
+
export interface DefaultPrefixCommand<
|
|
291
|
+
S extends CommandArgumentSchema = {},
|
|
292
|
+
M extends MessageCore = Message,
|
|
293
|
+
> extends PrefixCommandDefinition {
|
|
294
|
+
/** Named positional conversions, read in property order. Omitted leaves `args` unrestricted and `values` empty */
|
|
295
|
+
readonly arguments?: S
|
|
296
|
+
/**
|
|
297
|
+
* One guard or a list of guards, run in order before argument conversion. The first that denies stops the command.
|
|
298
|
+
* Each command owns its policy, with no inherited group guard or permission from help visibility
|
|
299
|
+
*/
|
|
300
|
+
readonly guard?: DefaultPrefixCommandGuard<M> | readonly DefaultPrefixCommandGuard<M>[]
|
|
301
|
+
/**
|
|
302
|
+
* Feedback after a denied guard, rejected arguments or a denied cooldown claim, overriding the router's `onReject`.
|
|
303
|
+
* A function receives raw context and a safe rejection classification, not partially converted values.
|
|
304
|
+
* Throws, rejected promises and returned Err results use attachment error reporting, without retry
|
|
305
|
+
*/
|
|
306
|
+
readonly onReject?: DefaultPrefixCommandRejectionFeedback<M>
|
|
307
|
+
/** Optional reservation required after the guards and arguments succeed. A denied claim skips execution */
|
|
308
|
+
readonly cooldown?: DefaultPrefixCommandCooldown<S, M>
|
|
309
|
+
/**
|
|
310
|
+
* Perform application work after the command is allowed and all arguments convert.
|
|
311
|
+
* Return normally or a promise completing that work. A returned or resolved Err result is reported like a throw,
|
|
312
|
+
* so `({ reply }) => reply("Pong")` reports a failed reply. Other successful values are ignored.
|
|
313
|
+
* Throws, rejected promises and Err results use attachment `onError` reporting, with no automatic retry or cooldown rollback.
|
|
314
|
+
* Pass `context.signal` to cancellable operations when application work should stop with the subscription
|
|
315
|
+
*/
|
|
316
|
+
readonly execute: (context: DefaultPrefixCommandExecutionContext<S, M>) => unknown
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
/**
|
|
320
|
+
* Commands keyed by name, as registerMany and the runBot commands option accept them. Each value defines one command without its name.
|
|
321
|
+
* Omit `arguments` to leave raw args unrestricted, or set `arguments: {}` to reject positional arguments
|
|
322
|
+
*
|
|
323
|
+
* @category Commands
|
|
324
|
+
*/
|
|
325
|
+
export type DefaultPrefixCommandBatch<M extends MessageCore, S extends Readonly<Record<string, unknown>>> = {
|
|
326
|
+
readonly [K in keyof S]: Omit<
|
|
327
|
+
DefaultPrefixCommand<S[K] extends CommandArgumentSchema ? S[K] : {}, M>,
|
|
328
|
+
"name" | "arguments"
|
|
329
|
+
> & {
|
|
330
|
+
/** Argument schema for the command under this key. Omit it to leave positional arguments unrestricted.
|
|
331
|
+
* Each descriptor is checked on its own, so a mistake such as an unknown type is reported on that descriptor
|
|
332
|
+
*/
|
|
333
|
+
readonly arguments?: {
|
|
334
|
+
readonly [A in keyof S[K]]: S[K][A] extends CommandArgumentDescriptor ? S[K][A] : CommandArgumentDescriptor
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
/**
|
|
340
|
+
* Cooldown reservations kept in one memory store, up to that store's configured key limit.
|
|
341
|
+
* Share this instance across commands that should use the same store.
|
|
342
|
+
* Uses `Date.now()` to set expiry. It does not save claims, run a background timer or share claims with other processes
|
|
343
|
+
*
|
|
344
|
+
* @category Commands
|
|
345
|
+
*/
|
|
346
|
+
export interface MemoryCooldownStore {
|
|
347
|
+
/** Maximum keys this store retains, fixed at creation */
|
|
348
|
+
readonly maxEntries: number
|
|
349
|
+
/** Current stored-key count. May include expired keys until a full store needs room or an explicit sweep removes them */
|
|
350
|
+
readonly size: number
|
|
351
|
+
/**
|
|
352
|
+
* Atomically reserve the requested key, or report its active cooldown. Acquired expiry is `Date.now() + durationMs`.
|
|
353
|
+
* A new key is never refused for lack of space: A full store removes expired keys first, then the reservation that
|
|
354
|
+
* expires soonest, whose key can then claim again early.
|
|
355
|
+
* Malformed keys or durations throw ConfigurationError. A throwing claim getter throws SdkDefect for `commands` with code `application.defect` and the thrown value as its cause
|
|
356
|
+
*/
|
|
357
|
+
claim(input: CommandCooldownRequest): CommandCooldownClaim
|
|
358
|
+
/** Remove keys expired according to `Date.now()` and return the number removed, without changing active reservations */
|
|
359
|
+
sweep(): number
|
|
360
|
+
/** Forget this store's reservations immediately, allowing new claims. Does not cancel handlers or clear other store instances */
|
|
361
|
+
clear(): void
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
/**
|
|
365
|
+
* Immutable registered commands and groups that can be attached to a client.
|
|
366
|
+
* The `register` and `registerGroup` methods return new routers, so use the returned value for subsequent registrations and attachment.
|
|
367
|
+
* Older routers and their active attachments keep the definitions they already had
|
|
368
|
+
*
|
|
369
|
+
* @category Commands
|
|
370
|
+
*/
|
|
371
|
+
export interface DefaultPrefixCommandRouter<M extends MessageCore = Message> {
|
|
372
|
+
/** Frozen command descriptions in registration order across groups, without callbacks or resource candidates. Grouped entries include paths of registered names */
|
|
373
|
+
readonly commands: readonly PrefixCommandMetadata[]
|
|
374
|
+
/** Frozen groups in registration order, including empty groups. These names organize lookup and help, not permission checks */
|
|
375
|
+
readonly groups: readonly PrefixCommandGroupMetadata[]
|
|
376
|
+
/**
|
|
377
|
+
* Build frozen help-text pages locally, for example `router.help({ prefix: "!", maxLength: 2000 })`
|
|
378
|
+
*
|
|
379
|
+
* Root help lists immediate commands and groups in sibling registration order.
|
|
380
|
+
* Selecting a group by its registered names shows that group and its immediate children, including empty groups, unless include rejects an ancestor.
|
|
381
|
+
* Entries show full registered-name paths, aliases and descriptions, with `(Group)` marking groups.
|
|
382
|
+
* Commands and groups registered with `hidden: true` never appear, nor does anything inside a hidden group,
|
|
383
|
+
* and selecting a hidden group throws ConfigurationError as for a missing one
|
|
384
|
+
*
|
|
385
|
+
* Arguments generate `<required>`, `[optional]` and `<rest...>` or `[rest...]` syntax unless explicit `usage` overrides it.
|
|
386
|
+
* No schema means no inferred argument syntax, and an explicit empty usage suppresses it.
|
|
387
|
+
* A selection that is empty, or whose group or ancestor include rejects, returns `[]`. Nothing is sent, and no prefix resolver, guard, cooldown or handler runs
|
|
388
|
+
*
|
|
389
|
+
* Pages respect the UTF-16 length limit and do not split a character represented by two code units, but may split visible character clusters or Markdown.
|
|
390
|
+
* Page-edge whitespace is trimmed and empty pages are removed, so joining pages is not a lossless reconstruction.
|
|
391
|
+
* The caller selects pages to send and handles mentions
|
|
392
|
+
*
|
|
393
|
+
* Malformed options, ill-formed text, too-small limits and invalid visibility callbacks throw ConfigurationError.
|
|
394
|
+
* A throwing option getter throws SdkDefect for `commands` with code `application.defect` and the thrown value as its cause, while another unexpected fault uses `sdk.defect`
|
|
395
|
+
*/
|
|
396
|
+
help(options: CommandHelpOptions): readonly string[]
|
|
397
|
+
/**
|
|
398
|
+
* Validate and add one executable command to a new router, at root unless `options.group` selects an existing parent by registered names.
|
|
399
|
+
* Copies metadata and arguments while retaining callbacks and the cooldown store.
|
|
400
|
+
* Names and aliases must not collide with sibling commands or groups under the router's case policy.
|
|
401
|
+
* Invalid definitions, collisions and missing or alias-only parent paths throw ConfigurationError.
|
|
402
|
+
* A throwing getter throws SdkDefect for `commands` with code `application.defect`, while another unexpected fault uses `sdk.defect`. The original router and its attachments are unchanged
|
|
403
|
+
*/
|
|
404
|
+
register<const S extends CommandArgumentSchema = {}>(
|
|
405
|
+
command: DefaultPrefixCommand<S, M>,
|
|
406
|
+
options?: PrefixCommandRegistrationOptions,
|
|
407
|
+
): DefaultPrefixCommandRouter<M>
|
|
408
|
+
/**
|
|
409
|
+
* Validate and add a nonempty object of commands to one new router, in the order of its own enumerable string keys and under the same optional parent group.
|
|
410
|
+
* Each object key supplies its command name. Omit `arguments` to leave raw args unrestricted, or set `arguments: {}` to reject positional arguments.
|
|
411
|
+
* The router copies every definition before registration. Keys inherited by the batch object are ignored.
|
|
412
|
+
* Recognized fields inside each definition are read once, including inherited and non-enumerable fields.
|
|
413
|
+
* If any definition is invalid or any name collides, the whole call throws
|
|
414
|
+
* ConfigurationError, without a partially registered router or changes to this router and its attachments.
|
|
415
|
+
* The optional parent is validated and snapshotted once for the whole batch. A throwing getter throws SdkDefect for `commands` with code `application.defect`, while another unexpected fault uses `sdk.defect`.
|
|
416
|
+
* Each entry retains its own inferred argument-value type
|
|
417
|
+
*/
|
|
418
|
+
registerMany<const S extends Readonly<Record<string, unknown>>>(
|
|
419
|
+
commands: DefaultPrefixCommandBatch<M, S>,
|
|
420
|
+
options?: PrefixCommandRegistrationOptions,
|
|
421
|
+
): DefaultPrefixCommandRouter<M>
|
|
422
|
+
/**
|
|
423
|
+
* Add a named group to a new router, at root or beneath an existing `options.group` path of registered names.
|
|
424
|
+
* Register parents before children. Groups accept identity and description only, with no handler, schema, guard or cooldown.
|
|
425
|
+
* At dispatch, group names and aliases are consumed using whitespace separators before the command parser runs.
|
|
426
|
+
* Invalid metadata, missing parents or sibling name collisions throw ConfigurationError.
|
|
427
|
+
* A throwing getter throws SdkDefect for `commands` with code `application.defect`, while another unexpected fault uses `sdk.defect`. No callback runs and older routers remain unchanged
|
|
428
|
+
*/
|
|
429
|
+
registerGroup(
|
|
430
|
+
group: PrefixCommandGroupDefinition,
|
|
431
|
+
options?: PrefixCommandRegistrationOptions,
|
|
432
|
+
): DefaultPrefixCommandRouter<M>
|
|
433
|
+
/**
|
|
434
|
+
* Subscribe this router to `messageCreate` through the client's existing bounded event system.
|
|
435
|
+
* Returns a Subscription immediately, without connecting the client or creating another queue.
|
|
436
|
+
* Invalid options throw ConfigurationError, and a throwing onError getter throws SdkDefect for `commands` with code `application.defect`.
|
|
437
|
+
* On a closing or closed client, attach returns an already-closed Subscription whose waitForClose succeeds, and writes a Warn log record with code events.registeredAfterShutdown.
|
|
438
|
+
* Subscription options control scheduling, overflow and `onError` reports for callback failures.
|
|
439
|
+
* Omitted or undefined settings default to eight concurrent commands and overflow dropOldest, so a burst never stops the router.
|
|
440
|
+
* A failed command is reported with its command name, original error and message IDs to `onError`, or logged at Error without one.
|
|
441
|
+
* A failed onUnmatched callback, prefix resolver or custom parser is reported the same way without a command name.
|
|
442
|
+
* The router owns one bounded queue for its `onError` hook, which receives reports one at a time in order, as for client.on.
|
|
443
|
+
* Rejected and unmatched commands are counted and logged at Debug in the commands category.
|
|
444
|
+
* The observe option receives one handler observation per router invocation, including event and command middleware.
|
|
445
|
+
* A matched command supplies its canonical command name, even when a guard denies it or middleware stops it.
|
|
446
|
+
* Reported failures produce outcome failure, cancellation produces cancelled, and other completions produce success.
|
|
447
|
+
* A message with no command match still produces an observation without a command name.
|
|
448
|
+
* Only messages a person typed can run commands. Messages from bots are skipped unless `ignoreBots` is false, and so is every message whose type is neither Default nor Reply, such as the notice Fluxer posts with a new thread's name as its content. A message without a type, which Fluxer never sends, counts as typed.
|
|
449
|
+
* Each attachment dispatches independently, so attaching twice can run the same command twice.
|
|
450
|
+
* Call `subscription.close()` to detach it and signal cancellation, without shutting down the client.
|
|
451
|
+
* The returned `subscription.waitForClose()` observes SDK cleanup, not completion of arbitrary application promises.
|
|
452
|
+
* Cancellation prevents later dispatch stages but cannot forcibly stop application promises already running.
|
|
453
|
+
* The client must have this router's message type `M`. A full-message router cannot attach to a client with omitted fields
|
|
454
|
+
*/
|
|
455
|
+
attach(client: Client<M>, options?: EventHandlerOptions): Subscription
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
/**
|
|
459
|
+
* Recognize message commands such as `!repeat hello` with the default API's optional `commands` tools.
|
|
460
|
+
* Create a router, keep the new router returned by each registration and attach the final router to a client,
|
|
461
|
+
* or pass the commands to runBot, which does all of that.
|
|
462
|
+
* Construction is local. No connection or subscription starts until attachment
|
|
463
|
+
*
|
|
464
|
+
* @category Commands
|
|
465
|
+
*/
|
|
466
|
+
export interface DefaultCommands {
|
|
467
|
+
/**
|
|
468
|
+
* Create an empty router, for example `commands.create({ prefix: "!", parse: commands.parseQuoted })`.
|
|
469
|
+
* Defaults to full Message typing. Supply the client's MessageCore or SelectedMessage type as `M` when it selects fewer fields.
|
|
470
|
+
* Prefix resolvers, parsers, command callbacks and their context client keep that same message type.
|
|
471
|
+
* Invalid options throw ConfigurationError, without including rejected prefix or parser values.
|
|
472
|
+
* A throwing getter throws SdkDefect for `commands` with code `application.defect`, while another unexpected fault uses `sdk.defect`. No client connects and no feedback callback runs during creation
|
|
473
|
+
*/
|
|
474
|
+
create<M extends MessageCore = Message>(options: DefaultPrefixCommandsOptions<M>): DefaultPrefixCommandRouter<M>
|
|
475
|
+
/**
|
|
476
|
+
* Split a suffix using single or double quotes and backslash escapes, retaining original argument text in `rawArgs`.
|
|
477
|
+
* Use as `create({ prefix: "!", parse: commands.parseQuoted })` to opt in instead of the whitespace-only default.
|
|
478
|
+
* Returns undefined for empty input or invalid names, and a `PrefixCommandParseRejection` with a fixed `reason` for an unclosed quote or a trailing escape, which `onUnmatched` receives. Empty quotes produce an empty token.
|
|
479
|
+
* Runs synchronously without client or network work
|
|
480
|
+
*/
|
|
481
|
+
parseQuoted<M extends MessageCore = Message>(
|
|
482
|
+
input: PrefixCommandParseInput<M>,
|
|
483
|
+
): PrefixCommandParse | PrefixCommandParseRejection | undefined
|
|
484
|
+
/**
|
|
485
|
+
* Create an empty in-memory cooldown store with a default limit of 10,000 keys, to share one store between routers.
|
|
486
|
+
* An optional positive safe integer `maxEntries` changes that limit. A full store makes room rather than refusing a
|
|
487
|
+
* new key, removing expired keys first and then the reservation that expires soonest.
|
|
488
|
+
* Invalid options throw ConfigurationError. A throwing getter throws SdkDefect for `commands` with code `application.defect`, while another unexpected fault uses `sdk.defect`.
|
|
489
|
+
* The store has no timer or persistence. Reuse it in command cooldown definitions and clear it explicitly to forget claims
|
|
490
|
+
*/
|
|
491
|
+
memoryCooldowns(options?: MemoryCooldownOptions): MemoryCooldownStore
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
/** Router option keys this API adds to the shared ones */
|
|
495
|
+
const routerAdapterKeys = ["onUnmatched", "onReject", "use"]
|
|
496
|
+
|
|
497
|
+
/** Default-API command tools exposed through the public `commands` namespace, with immediate creation and registration */
|
|
498
|
+
export const defaultCommands: DefaultCommands = Object.freeze({
|
|
499
|
+
create: <M extends MessageCore = Message>(options: DefaultPrefixCommandsOptions<M>) =>
|
|
500
|
+
attempt(() => {
|
|
501
|
+
const registry = new PrefixCommandRegistry<StoredDefaultCommand<M>, M>(options, routerAdapterKeys)
|
|
502
|
+
return freezeRouter(
|
|
503
|
+
new DefaultPrefixCommandRouterOwner(
|
|
504
|
+
registry,
|
|
505
|
+
readCaller(() => snapshotRouterSettings(options)),
|
|
506
|
+
),
|
|
507
|
+
)
|
|
508
|
+
}),
|
|
509
|
+
parseQuoted: parseQuotedPrefixCommand,
|
|
510
|
+
memoryCooldowns: (options: MemoryCooldownOptions | undefined) =>
|
|
511
|
+
attempt(() => defaultMemoryCooldownStore(createMemoryCooldownStore(options))),
|
|
512
|
+
})
|
|
513
|
+
|
|
514
|
+
interface StoredDefaultCommand<M extends MessageCore> extends PrefixCommandDefinition {
|
|
515
|
+
readonly guards: readonly DefaultPrefixCommandGuard<M>[]
|
|
516
|
+
readonly onReject?: DefaultPrefixCommandRejectionFeedback<M>
|
|
517
|
+
readonly cooldown?: {
|
|
518
|
+
readonly store?: DefaultCooldownStore
|
|
519
|
+
readonly durationMs: number
|
|
520
|
+
readonly per: CommandCooldownPer
|
|
521
|
+
readonly key?: (context: DefaultPrefixCommandExecutionContext<CommandArgumentSchema, M>) => string
|
|
522
|
+
}
|
|
523
|
+
readonly execute: (context: DefaultPrefixCommandExecutionContext<CommandArgumentSchema, M>) => unknown
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
interface RouterSettings<M extends MessageCore> {
|
|
527
|
+
readonly onUnmatched?: DefaultPrefixCommandsOptions<M>["onUnmatched"]
|
|
528
|
+
readonly onReject?: DefaultPrefixCommandRejectionFeedback<M>
|
|
529
|
+
readonly use: readonly DefaultPrefixCommandMiddleware<M>[]
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
class DefaultPrefixCommandRouterOwner<M extends MessageCore> implements DefaultPrefixCommandRouter<M> {
|
|
533
|
+
readonly #registry: PrefixCommandRegistry<StoredDefaultCommand<M>, M>
|
|
534
|
+
readonly #settings: RouterSettings<M>
|
|
535
|
+
|
|
536
|
+
constructor(registry: PrefixCommandRegistry<StoredDefaultCommand<M>, M>, settings: RouterSettings<M>) {
|
|
537
|
+
this.#registry = registry
|
|
538
|
+
this.#settings = settings
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
get commands(): readonly PrefixCommandMetadata[] {
|
|
542
|
+
return this.#registry.commands
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
get groups(): readonly PrefixCommandGroupMetadata[] {
|
|
546
|
+
return this.#registry.groups
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
help(options: CommandHelpOptions): readonly string[] {
|
|
550
|
+
return attempt(() => commandHelp(this.#registry.visibleEntries, options))
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
register<const S extends CommandArgumentSchema = {}>(
|
|
554
|
+
command: DefaultPrefixCommand<S, M>,
|
|
555
|
+
options?: PrefixCommandRegistrationOptions,
|
|
556
|
+
): DefaultPrefixCommandRouter<M> {
|
|
557
|
+
return attempt(() =>
|
|
558
|
+
freezeRouter(
|
|
559
|
+
new DefaultPrefixCommandRouterOwner(
|
|
560
|
+
this.#registry.register(
|
|
561
|
+
readCaller(() => snapshotDefaultCommand(command)),
|
|
562
|
+
options,
|
|
563
|
+
),
|
|
564
|
+
this.#settings,
|
|
565
|
+
),
|
|
566
|
+
),
|
|
567
|
+
)
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
registerMany<const S extends Readonly<Record<string, unknown>>>(
|
|
571
|
+
commands: DefaultPrefixCommandBatch<M, S>,
|
|
572
|
+
options?: PrefixCommandRegistrationOptions,
|
|
573
|
+
): DefaultPrefixCommandRouter<M> {
|
|
574
|
+
return attempt(() => {
|
|
575
|
+
const stored = readCaller(() => snapshotDefaultCommandBatch<M>(commands))
|
|
576
|
+
return freezeRouter(
|
|
577
|
+
new DefaultPrefixCommandRouterOwner(this.#registry.registerMany(stored, options), this.#settings),
|
|
578
|
+
)
|
|
579
|
+
})
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
registerGroup(
|
|
583
|
+
group: PrefixCommandGroupDefinition,
|
|
584
|
+
options?: PrefixCommandRegistrationOptions,
|
|
585
|
+
): DefaultPrefixCommandRouter<M> {
|
|
586
|
+
return attempt(() =>
|
|
587
|
+
freezeRouter(
|
|
588
|
+
new DefaultPrefixCommandRouterOwner(this.#registry.registerGroup(group, options), this.#settings),
|
|
589
|
+
),
|
|
590
|
+
)
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
attach(client: Client<M>, options?: EventHandlerOptions): Subscription {
|
|
594
|
+
const services = clientServices(client)
|
|
595
|
+
const onError: unknown = attempt(() => readCaller(() => options?.onError))
|
|
596
|
+
if (onError !== undefined && typeof onError !== "function")
|
|
597
|
+
throw new ConfigurationError("onError", 'The option "onError" must be a function')
|
|
598
|
+
// The router's own hook gets one bounded queue, so a failed command only enqueues its report and the hook
|
|
599
|
+
// never holds a command slot. client.on never sees onError, so no second queue can reorder the reports
|
|
600
|
+
const hooks =
|
|
601
|
+
services && onError !== undefined
|
|
602
|
+
? services.failures.subscriptionQueue(
|
|
603
|
+
promiseHook(onError as (report: FailureReport) => unknown),
|
|
604
|
+
undefined,
|
|
605
|
+
)
|
|
606
|
+
: undefined
|
|
607
|
+
let subscriptionId: string | undefined
|
|
608
|
+
const report =
|
|
609
|
+
(services: ClientServices) => (message: M, name: string | undefined, cause: Cause.Cause<unknown>) =>
|
|
610
|
+
Effect.withFiber((fiber) => {
|
|
611
|
+
recordCommandFailure(name, cause, fiber.context)
|
|
612
|
+
try {
|
|
613
|
+
const internal = makeReport(
|
|
614
|
+
{
|
|
615
|
+
kind: "handler",
|
|
616
|
+
cause,
|
|
617
|
+
event: "messageCreate",
|
|
618
|
+
command: name,
|
|
619
|
+
subscriptionId,
|
|
620
|
+
message: messageReference(message),
|
|
621
|
+
},
|
|
622
|
+
services.logging.secrets,
|
|
623
|
+
)
|
|
624
|
+
if (!hooks) services.failures.report(internal, fiber.context)
|
|
625
|
+
else {
|
|
626
|
+
services.logging.count("handlerFailures")
|
|
627
|
+
hooks.offer(internal)
|
|
628
|
+
}
|
|
629
|
+
} catch (fault) {
|
|
630
|
+
services.logging.outputFailure(fault)
|
|
631
|
+
}
|
|
632
|
+
return Effect.void
|
|
633
|
+
})
|
|
634
|
+
const registered = client.on(
|
|
635
|
+
"messageCreate",
|
|
636
|
+
(message, signal) => this.dispatch(client, message, signal, services, services && report(services)),
|
|
637
|
+
routerSubscriptionOptions(options) as EventHandlerOptions,
|
|
638
|
+
)
|
|
639
|
+
subscriptionId = registered.id
|
|
640
|
+
return registered
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
private dispatch(
|
|
644
|
+
client: Client<M>,
|
|
645
|
+
message: M,
|
|
646
|
+
signal: AbortSignal,
|
|
647
|
+
services: ClientServices | undefined,
|
|
648
|
+
report:
|
|
649
|
+
((message: M, name: string | undefined, cause: Cause.Cause<unknown>) => Effect.Effect<void>) | undefined,
|
|
650
|
+
): Promise<void> {
|
|
651
|
+
const registry = this.#registry
|
|
652
|
+
const settings = this.#settings
|
|
653
|
+
const logger: ClientLogger | undefined = services?.logging
|
|
654
|
+
const operation = dispatchCommand<
|
|
655
|
+
StoredDefaultCommand<M>,
|
|
656
|
+
DefaultPrefixCommandContext<M>,
|
|
657
|
+
DefaultPrefixCommandExecutionContext<CommandArgumentSchema, M>,
|
|
658
|
+
ConfigurationError,
|
|
659
|
+
never,
|
|
660
|
+
M
|
|
661
|
+
>(registry, message, {
|
|
662
|
+
logger,
|
|
663
|
+
...(report === undefined
|
|
664
|
+
? {}
|
|
665
|
+
: { failed: (name: string | undefined, cause: Cause.Cause<unknown>) => report(message, name, cause) }),
|
|
666
|
+
prefix: (resolver, value) => defaultCallback(() => resolver(value)),
|
|
667
|
+
...(services === undefined ? {} : { selfId: () => services.selfUserId() }),
|
|
668
|
+
context: (match) =>
|
|
669
|
+
Object.freeze({
|
|
670
|
+
client,
|
|
671
|
+
message,
|
|
672
|
+
prefix: match.prefix,
|
|
673
|
+
name: match.definition.name,
|
|
674
|
+
...(match.path === undefined ? {} : { path: match.path }),
|
|
675
|
+
args: Object.freeze([...match.parse.args]),
|
|
676
|
+
rawArgs: match.parse.rawArgs,
|
|
677
|
+
signal,
|
|
678
|
+
reply: boundDefaultReply(client, message, signal),
|
|
679
|
+
help: (options?: CommandContextHelpOptions) => this.help(contextHelpOptions(options, match.prefix)),
|
|
680
|
+
paginate: boundDefaultPaginate(client, message, signal),
|
|
681
|
+
sendHelp: (options?: CommandContextHelpOptions) => {
|
|
682
|
+
let pages: readonly string[]
|
|
683
|
+
try {
|
|
684
|
+
pages = this.help(contextHelpOptions(options, match.prefix))
|
|
685
|
+
} catch (error) {
|
|
686
|
+
if (error instanceof ConfigurationError) return errAsync(error)
|
|
687
|
+
throw error
|
|
688
|
+
}
|
|
689
|
+
return boundDefaultPaginate(client, message, signal)(pages)
|
|
690
|
+
},
|
|
691
|
+
}) as DefaultPrefixCommandContext<M>,
|
|
692
|
+
...(settings.use.length === 0
|
|
693
|
+
? {}
|
|
694
|
+
: {
|
|
695
|
+
around: (
|
|
696
|
+
context: DefaultPrefixCommandContext<M>,
|
|
697
|
+
rest: Effect.Effect<void, ConfigurationError>,
|
|
698
|
+
) =>
|
|
699
|
+
aroundCommand(
|
|
700
|
+
settings.use,
|
|
701
|
+
context,
|
|
702
|
+
rest,
|
|
703
|
+
report && ((cause) => report(message, context.name, cause)),
|
|
704
|
+
),
|
|
705
|
+
}),
|
|
706
|
+
guard: (definition, context) =>
|
|
707
|
+
definition.guards.length === 0
|
|
708
|
+
? Effect.succeed(true)
|
|
709
|
+
: defaultCallback(async () => {
|
|
710
|
+
for (const guard of definition.guards) {
|
|
711
|
+
const verdict: unknown = await guard(context)
|
|
712
|
+
throwIfErr(verdict)
|
|
713
|
+
if (verdict !== true) return verdict
|
|
714
|
+
}
|
|
715
|
+
return true
|
|
716
|
+
}),
|
|
717
|
+
convert: (definition, context) =>
|
|
718
|
+
convertCommandArguments(definition.arguments, context.args, { guildId: context.message.guildId }),
|
|
719
|
+
executionContext: (context, values) =>
|
|
720
|
+
Object.freeze({
|
|
721
|
+
...context,
|
|
722
|
+
values: values as CommandArgumentValues<CommandArgumentSchema>,
|
|
723
|
+
}),
|
|
724
|
+
unmatched:
|
|
725
|
+
settings.onUnmatched === undefined
|
|
726
|
+
? undefined
|
|
727
|
+
: (match) =>
|
|
728
|
+
defaultCallback(() =>
|
|
729
|
+
settings.onUnmatched!(
|
|
730
|
+
Object.freeze({
|
|
731
|
+
client,
|
|
732
|
+
message,
|
|
733
|
+
prefix: match.prefix,
|
|
734
|
+
signal,
|
|
735
|
+
reply: boundDefaultReply(client, message, signal),
|
|
736
|
+
}),
|
|
737
|
+
match.unmatched,
|
|
738
|
+
),
|
|
739
|
+
),
|
|
740
|
+
feedback: (definition) => {
|
|
741
|
+
const feedback = definition.onReject ?? settings.onReject
|
|
742
|
+
return feedback === undefined || feedback === "silent"
|
|
743
|
+
? undefined
|
|
744
|
+
: feedback === "reply"
|
|
745
|
+
? "reply"
|
|
746
|
+
: "callback"
|
|
747
|
+
},
|
|
748
|
+
reject: (definition, context, rejection, now) => {
|
|
749
|
+
const feedback = definition.onReject ?? settings.onReject
|
|
750
|
+
if (feedback === undefined || feedback === "silent") return Effect.void
|
|
751
|
+
if (feedback === "reply") {
|
|
752
|
+
const path = context.path ?? [context.name]
|
|
753
|
+
const metadata = registry.commands.find((command) =>
|
|
754
|
+
sameCommandPath(command.path ?? [command.name], path),
|
|
755
|
+
)
|
|
756
|
+
const text = rejectionReply(rejection, metadata, context.prefix, now)
|
|
757
|
+
return text === undefined ? Effect.void : defaultCallback(() => context.reply(text))
|
|
758
|
+
}
|
|
759
|
+
return defaultCallback(() => feedback(context, rejection))
|
|
760
|
+
},
|
|
761
|
+
cooldown: (definition, context, routerStore) => defaultCooldown(definition, context, routerStore),
|
|
762
|
+
execute: (definition, context) => defaultCallback(() => definition.execute(context)),
|
|
763
|
+
active: () => !signal.aborted,
|
|
764
|
+
})
|
|
765
|
+
if (signal.aborted) return Promise.resolve()
|
|
766
|
+
const controller = new AbortController()
|
|
767
|
+
const abort = () => controller.abort()
|
|
768
|
+
signal.addEventListener("abort", abort, { once: true })
|
|
769
|
+
// The router runs as a client.on handler, so its commands share that invocation's rejection records
|
|
770
|
+
return Effect.runPromise(withRejectionScope(operation, currentRejectionScope()), { signal: controller.signal })
|
|
771
|
+
.catch((error: unknown) => {
|
|
772
|
+
if (signal.aborted) return
|
|
773
|
+
throw error
|
|
774
|
+
})
|
|
775
|
+
.finally(() => signal.removeEventListener("abort", abort))
|
|
776
|
+
}
|
|
777
|
+
}
|
|
778
|
+
|
|
779
|
+
/**
|
|
780
|
+
* Run middleware in order around the rest of a command. Each stage, including the rest, runs at most once: A repeated
|
|
781
|
+
* or concurrent `next()` returns the first call's promise, which rejects with the command's primary error.
|
|
782
|
+
* The command's failure is reported once with its command name whether middleware recovers from it, rethrows it or
|
|
783
|
+
* replaces it. A different middleware failure is reported after it, and interruption keeps an earlier command failure
|
|
784
|
+
*/
|
|
785
|
+
function aroundCommand<M extends MessageCore, E>(
|
|
786
|
+
middleware: readonly DefaultPrefixCommandMiddleware<M>[],
|
|
787
|
+
context: DefaultPrefixCommandContext<M>,
|
|
788
|
+
rest: Effect.Effect<void, E>,
|
|
789
|
+
report: ((cause: Cause.Cause<unknown>) => Effect.Effect<void>) | undefined,
|
|
790
|
+
): Effect.Effect<void, E> {
|
|
791
|
+
const signal = context.signal
|
|
792
|
+
return Effect.withFiber((fiber) => {
|
|
793
|
+
const rejections = fiberRejectionScope(fiber.context)
|
|
794
|
+
let outcome: Promise<Exit.Exit<void, E>> | undefined
|
|
795
|
+
let restExit: Exit.Exit<void, E> | undefined
|
|
796
|
+
let restError: unknown
|
|
797
|
+
const stages: Promise<void>[] = []
|
|
798
|
+
const step = (index: number): Promise<void> => {
|
|
799
|
+
const started = stages[index]
|
|
800
|
+
if (started !== undefined) return started
|
|
801
|
+
if (index < middleware.length) {
|
|
802
|
+
const stage = new Promise<unknown>((resolve) =>
|
|
803
|
+
resolve(inRejectionScope(rejections, () => middleware[index]!(context, () => step(index + 1)))),
|
|
804
|
+
).then(throwIfErr)
|
|
805
|
+
stages[index] = stage
|
|
806
|
+
return stage
|
|
807
|
+
}
|
|
808
|
+
const stage = (outcome = Effect.runPromiseExit(withRejectionScope(rest, rejections), { signal })).then(
|
|
809
|
+
(exit) => {
|
|
810
|
+
restExit = exit
|
|
811
|
+
if (Exit.isFailure(exit)) throw (restError = primaryError(exit.cause))
|
|
812
|
+
},
|
|
813
|
+
)
|
|
814
|
+
// allow-silent: settleAround reports the saved command failure even when no middleware awaits this rejection
|
|
815
|
+
stage.catch(() => undefined)
|
|
816
|
+
stages[index] = stage
|
|
817
|
+
return stage
|
|
818
|
+
}
|
|
819
|
+
const settle = settleAround(
|
|
820
|
+
() => restExit,
|
|
821
|
+
(cause) => primaryError(cause) === restError,
|
|
822
|
+
report,
|
|
823
|
+
)
|
|
824
|
+
// @effect-diagnostics-next-line unknownInEffectCatch:off
|
|
825
|
+
return Effect.tryPromise({ try: () => step(0), catch: (error) => error }).pipe(
|
|
826
|
+
Effect.exit,
|
|
827
|
+
// Middleware that did not await next still waits for the command, so its failure is not lost
|
|
828
|
+
Effect.tap(() => Effect.promise(() => outcome ?? Promise.resolve(undefined))),
|
|
829
|
+
Effect.flatMap((exit) =>
|
|
830
|
+
settle.finish(
|
|
831
|
+
Exit.isSuccess(exit)
|
|
832
|
+
? undefined
|
|
833
|
+
: Cause.hasInterrupts(exit.cause)
|
|
834
|
+
? exit.cause
|
|
835
|
+
: Cause.die(primaryError(exit.cause)),
|
|
836
|
+
),
|
|
837
|
+
),
|
|
838
|
+
Effect.onExit(() => settle.saved),
|
|
839
|
+
) as Effect.Effect<void, E>
|
|
840
|
+
})
|
|
841
|
+
}
|
|
842
|
+
|
|
843
|
+
/**
|
|
844
|
+
* Settle a command wrapped by middleware. The command's own failure is reported once, with its command name, whether
|
|
845
|
+
* middleware succeeded, threw it again or failed differently. A different middleware failure is reported after it.
|
|
846
|
+
* The `saved` argument reports a command failure that nothing else settled, such as after interruption
|
|
847
|
+
*/
|
|
848
|
+
function settleAround(
|
|
849
|
+
restExit: () => Exit.Exit<void, unknown> | undefined,
|
|
850
|
+
rethrown: (cause: Cause.Cause<unknown>) => boolean,
|
|
851
|
+
report: ((cause: Cause.Cause<unknown>) => Effect.Effect<void>) | undefined,
|
|
852
|
+
) {
|
|
853
|
+
let settled = false
|
|
854
|
+
const commandFailure = () => {
|
|
855
|
+
const exit = restExit()
|
|
856
|
+
return exit !== undefined && Exit.isFailure(exit) ? exit.cause : undefined
|
|
857
|
+
}
|
|
858
|
+
const saved = Effect.suspend(() => {
|
|
859
|
+
const failure = commandFailure()
|
|
860
|
+
if (settled || failure === undefined || report === undefined || Cause.hasInterrupts(failure)) return Effect.void
|
|
861
|
+
settled = true
|
|
862
|
+
return report(failure)
|
|
863
|
+
})
|
|
864
|
+
const finish = (middlewareFailure: Cause.Cause<unknown> | undefined): Effect.Effect<void, unknown> =>
|
|
865
|
+
Effect.suspend(() => {
|
|
866
|
+
const failure = commandFailure()
|
|
867
|
+
if (failure === undefined)
|
|
868
|
+
return middlewareFailure === undefined ? Effect.void : Effect.failCause(middlewareFailure)
|
|
869
|
+
// Recovered or rethrown, the command's failure reaches the dispatcher's report once
|
|
870
|
+
if (
|
|
871
|
+
middlewareFailure === undefined ||
|
|
872
|
+
(!Cause.hasInterrupts(middlewareFailure) && rethrown(middlewareFailure))
|
|
873
|
+
) {
|
|
874
|
+
settled = true
|
|
875
|
+
return Effect.failCause(failure)
|
|
876
|
+
}
|
|
877
|
+
// Without a separate report, one combined failure still carries both errors
|
|
878
|
+
if (report === undefined) {
|
|
879
|
+
settled = true
|
|
880
|
+
return Effect.failCause(Cause.combine(failure, middlewareFailure))
|
|
881
|
+
}
|
|
882
|
+
return saved.pipe(Effect.andThen(Effect.failCause(middlewareFailure)))
|
|
883
|
+
})
|
|
884
|
+
return { finish, saved }
|
|
885
|
+
}
|
|
886
|
+
|
|
887
|
+
function snapshotRouterSettings<M extends MessageCore>(options: DefaultPrefixCommandsOptions<M>): RouterSettings<M> {
|
|
888
|
+
const { onUnmatched, onReject, use } = options
|
|
889
|
+
if (onUnmatched !== undefined && typeof onUnmatched !== "function")
|
|
890
|
+
throw new ConfigurationError("commands", 'The option "onUnmatched" must be a function')
|
|
891
|
+
if (onReject !== undefined && onReject !== "reply" && onReject !== "silent" && typeof onReject !== "function")
|
|
892
|
+
throw new ConfigurationError("commands", 'The option "onReject" must be "reply", "silent" or a function')
|
|
893
|
+
return Object.freeze({
|
|
894
|
+
...(onUnmatched === undefined ? {} : { onUnmatched }),
|
|
895
|
+
...(onReject === undefined ? {} : { onReject }),
|
|
896
|
+
use: snapshotFunctions<DefaultPrefixCommandMiddleware<M>>(
|
|
897
|
+
use,
|
|
898
|
+
'The option "use" must be an array of middleware functions',
|
|
899
|
+
),
|
|
900
|
+
})
|
|
901
|
+
}
|
|
902
|
+
|
|
903
|
+
function snapshotFunctions<F>(value: unknown, message: string): readonly F[] {
|
|
904
|
+
if (value === undefined) return Object.freeze([])
|
|
905
|
+
if (!Array.isArray(value)) throw new ConfigurationError("commands", message)
|
|
906
|
+
const copied: F[] = []
|
|
907
|
+
for (let index = 0; index < value.length; index += 1) {
|
|
908
|
+
if (!Object.hasOwn(value, index) || typeof value[index] !== "function")
|
|
909
|
+
throw new ConfigurationError("commands", message)
|
|
910
|
+
copied.push(value[index] as F)
|
|
911
|
+
}
|
|
912
|
+
return Object.freeze(copied)
|
|
913
|
+
}
|
|
914
|
+
|
|
915
|
+
function snapshotDefaultCommand<S extends CommandArgumentSchema, M extends MessageCore>(
|
|
916
|
+
command: DefaultPrefixCommand<S, M>,
|
|
917
|
+
keyedName?: string,
|
|
918
|
+
): StoredDefaultCommand<M> {
|
|
919
|
+
validateCommandShape(command, [
|
|
920
|
+
"name",
|
|
921
|
+
"aliases",
|
|
922
|
+
"description",
|
|
923
|
+
"usage",
|
|
924
|
+
"hidden",
|
|
925
|
+
"arguments",
|
|
926
|
+
"guard",
|
|
927
|
+
"onReject",
|
|
928
|
+
"cooldown",
|
|
929
|
+
"execute",
|
|
930
|
+
])
|
|
931
|
+
const { execute, guard, onReject, cooldown: sourceCooldown } = command
|
|
932
|
+
if (typeof execute !== "function")
|
|
933
|
+
throw new ConfigurationError("command", 'The command option "execute" must be a function')
|
|
934
|
+
const guards =
|
|
935
|
+
guard === undefined
|
|
936
|
+
? Object.freeze([])
|
|
937
|
+
: typeof guard === "function"
|
|
938
|
+
? Object.freeze([guard])
|
|
939
|
+
: snapshotFunctions<DefaultPrefixCommandGuard<M>>(
|
|
940
|
+
guard,
|
|
941
|
+
'The option "guard" must be a function or an array of functions',
|
|
942
|
+
)
|
|
943
|
+
if (onReject !== undefined && onReject !== "reply" && onReject !== "silent" && typeof onReject !== "function")
|
|
944
|
+
throw new ConfigurationError("command", 'The option "onReject" must be "reply", "silent" or a function')
|
|
945
|
+
const cooldown = snapshotCommandCooldown(sourceCooldown)
|
|
946
|
+
const definition = snapshotCommandDefinition(command, keyedName)
|
|
947
|
+
return Object.freeze({
|
|
948
|
+
...definition,
|
|
949
|
+
execute: execute as StoredDefaultCommand<M>["execute"],
|
|
950
|
+
guards: guards as readonly DefaultPrefixCommandGuard<M>[],
|
|
951
|
+
...(onReject === undefined ? {} : { onReject }),
|
|
952
|
+
...(cooldown === undefined ? {} : { cooldown: cooldown as NonNullable<StoredDefaultCommand<M>["cooldown"]> }),
|
|
953
|
+
}) as StoredDefaultCommand<M>
|
|
954
|
+
}
|
|
955
|
+
|
|
956
|
+
function snapshotDefaultCommandBatch<M extends MessageCore>(commands: unknown): readonly StoredDefaultCommand<M>[] {
|
|
957
|
+
if (typeof commands !== "object" || commands === null || Array.isArray(commands))
|
|
958
|
+
throw new ConfigurationError("command", "A command batch must be an object")
|
|
959
|
+
for (const key of Reflect.ownKeys(commands))
|
|
960
|
+
if (typeof key === "symbol" && Object.prototype.propertyIsEnumerable.call(commands, key))
|
|
961
|
+
throw new ConfigurationError("command", "Command batch keys must be strings")
|
|
962
|
+
const names = Object.keys(commands)
|
|
963
|
+
if (names.length === 0) throw new ConfigurationError("command", "A command batch must not be empty")
|
|
964
|
+
const stored: StoredDefaultCommand<M>[] = []
|
|
965
|
+
for (const name of names) {
|
|
966
|
+
const value = (commands as Readonly<Record<string, unknown>>)[name]
|
|
967
|
+
if (typeof value !== "object" || value === null || Array.isArray(value))
|
|
968
|
+
throw new ConfigurationError("command", `The command batch entry ${JSON.stringify(name)} must be an object`)
|
|
969
|
+
if (Object.prototype.hasOwnProperty.call(value, "name"))
|
|
970
|
+
throw new ConfigurationError(
|
|
971
|
+
"command",
|
|
972
|
+
`The command batch entry ${JSON.stringify(name)} must not set "name", because its object key is the name`,
|
|
973
|
+
)
|
|
974
|
+
stored.push(snapshotDefaultCommand(value as DefaultPrefixCommand<CommandArgumentSchema, M>, name))
|
|
975
|
+
}
|
|
976
|
+
return Object.freeze(stored)
|
|
977
|
+
}
|
|
978
|
+
|
|
979
|
+
/**
|
|
980
|
+
* Create the command tools a runBot commands option describes, registering its keyed commands or its register callback.
|
|
981
|
+
* Rejections are answered with `onReject: "reply"` unless the option selects other feedback.
|
|
982
|
+
* Bot-authored messages are skipped as the runBot ignoreBots setting says, unless the option sets its own ignoreBots.
|
|
983
|
+
* Misuse throws ConfigurationError. A register callback's own throw becomes ApplicationError naming `runBot commands`
|
|
984
|
+
*/
|
|
985
|
+
export function botRouter<M extends MessageCore>(
|
|
986
|
+
options: DefaultPrefixCommandsOptions<M> & {
|
|
987
|
+
readonly commands: unknown
|
|
988
|
+
},
|
|
989
|
+
ignoreBots: boolean,
|
|
990
|
+
): DefaultPrefixCommandRouter<M> {
|
|
991
|
+
if (typeof options !== "object" || options === null || Array.isArray(options))
|
|
992
|
+
throw new ConfigurationError("commands", "The commands option must be an object")
|
|
993
|
+
checkBotCommandKeys(options, routerAdapterKeys)
|
|
994
|
+
// The onError hook and delivery settings belong to the router's attachment, which runBot makes with them
|
|
995
|
+
const {
|
|
996
|
+
commands: definitions,
|
|
997
|
+
onError: _onError,
|
|
998
|
+
concurrency: _concurrency,
|
|
999
|
+
partition: _partition,
|
|
1000
|
+
overflow: _overflow,
|
|
1001
|
+
maxPendingMessages: _maxPendingMessages,
|
|
1002
|
+
maxPendingBytes: _maxPendingBytes,
|
|
1003
|
+
...settings
|
|
1004
|
+
} = options as typeof options & EventHandlerOptions
|
|
1005
|
+
const router = defaultCommands.create<M>({
|
|
1006
|
+
...settings,
|
|
1007
|
+
ignoreBots: settings.ignoreBots ?? ignoreBots,
|
|
1008
|
+
onReject: settings.onReject ?? "reply",
|
|
1009
|
+
})
|
|
1010
|
+
if (typeof definitions === "function") {
|
|
1011
|
+
const registered: unknown = registerCallback(() => definitions(router))
|
|
1012
|
+
if (
|
|
1013
|
+
typeof registered !== "object" ||
|
|
1014
|
+
registered === null ||
|
|
1015
|
+
!(registered instanceof DefaultPrefixCommandRouterOwner)
|
|
1016
|
+
)
|
|
1017
|
+
throw new ConfigurationError("commands", "A commands register callback must return the registered router")
|
|
1018
|
+
return registered as DefaultPrefixCommandRouter<M>
|
|
1019
|
+
}
|
|
1020
|
+
return router.registerMany(definitions as DefaultPrefixCommandBatch<M, Readonly<Record<string, undefined>>>)
|
|
1021
|
+
}
|
|
1022
|
+
|
|
1023
|
+
/** Reply to one message with a string or message input, applying the handler's cancellation signal */
|
|
1024
|
+
export function boundDefaultReply<M extends MessageCore>(
|
|
1025
|
+
client: Client<M>,
|
|
1026
|
+
message: M,
|
|
1027
|
+
signal: AbortSignal,
|
|
1028
|
+
): DefaultPrefixCommandContext<M>["reply"] {
|
|
1029
|
+
return (input, options) => client.messages.reply(message, input, bindDefaultReplyOptions(options, signal))
|
|
1030
|
+
}
|
|
1031
|
+
|
|
1032
|
+
function boundDefaultPaginate<M extends MessageCore>(
|
|
1033
|
+
client: Client<M>,
|
|
1034
|
+
message: M,
|
|
1035
|
+
signal: AbortSignal,
|
|
1036
|
+
): DefaultPrefixCommandContext<M>["paginate"] {
|
|
1037
|
+
return (pages, options) =>
|
|
1038
|
+
client.messages.paginate(message.channelId, pages, askerPageOptions(options, message.author.id, signal))
|
|
1039
|
+
}
|
|
1040
|
+
|
|
1041
|
+
function bindDefaultReplyOptions(options: SendOptions | undefined, signal: AbortSignal): DefaultSendOptions {
|
|
1042
|
+
if (options === undefined) return { signal }
|
|
1043
|
+
if (typeof options !== "object" || options === null || Array.isArray(options)) return options as DefaultSendOptions
|
|
1044
|
+
// Bind cancellation without reading getters before the operation's async validation and defect boundary
|
|
1045
|
+
return new Proxy(Object.create(null) as DefaultSendOptions, {
|
|
1046
|
+
get: (_target, property) => (property === "signal" ? signal : Reflect.get(options, property, options)),
|
|
1047
|
+
ownKeys: () => Reflect.ownKeys(options),
|
|
1048
|
+
getOwnPropertyDescriptor: (_target, property) => {
|
|
1049
|
+
const descriptor = Reflect.getOwnPropertyDescriptor(options, property)
|
|
1050
|
+
return descriptor === undefined ? undefined : { ...descriptor, configurable: true }
|
|
1051
|
+
},
|
|
1052
|
+
})
|
|
1053
|
+
}
|
|
1054
|
+
|
|
1055
|
+
function defaultCooldown<M extends MessageCore>(
|
|
1056
|
+
definition: StoredDefaultCommand<M>,
|
|
1057
|
+
context: DefaultPrefixCommandExecutionContext<CommandArgumentSchema, M>,
|
|
1058
|
+
routerStore: LocalMemoryCooldownStore,
|
|
1059
|
+
): Effect.Effect<{ readonly key: string; readonly claim: unknown } | undefined, ConfigurationError> {
|
|
1060
|
+
const cooldown = definition.cooldown
|
|
1061
|
+
if (cooldown === undefined) return Effect.succeed(undefined)
|
|
1062
|
+
return defaultCallback(() => cooldown.key?.(context) ?? cooldownSuffix(cooldown.per, context.message)).pipe(
|
|
1063
|
+
Effect.flatMap((key) =>
|
|
1064
|
+
configurationEffect(() => cooldownRequest(context.path ?? definition.name, key, cooldown.durationMs)),
|
|
1065
|
+
),
|
|
1066
|
+
Effect.flatMap((request) => {
|
|
1067
|
+
const store = cooldown.store
|
|
1068
|
+
const claim: Effect.Effect<unknown, ConfigurationError> =
|
|
1069
|
+
store !== undefined
|
|
1070
|
+
? defaultCallback(() => store.claim(request))
|
|
1071
|
+
: configurationEffect(() => {
|
|
1072
|
+
const claimed = routerStore.claim(request)
|
|
1073
|
+
if (claimed._tag === "Failure") throw claimed.error
|
|
1074
|
+
return claimed.value
|
|
1075
|
+
})
|
|
1076
|
+
return Effect.map(claim, (value) => ({ key: request.key, claim: value }))
|
|
1077
|
+
}),
|
|
1078
|
+
)
|
|
1079
|
+
}
|
|
1080
|
+
|
|
1081
|
+
function defaultMemoryCooldownStore(owner: LocalMemoryCooldownStore): MemoryCooldownStore {
|
|
1082
|
+
return Object.freeze({
|
|
1083
|
+
maxEntries: owner.maxEntries,
|
|
1084
|
+
get size() {
|
|
1085
|
+
return owner.size
|
|
1086
|
+
},
|
|
1087
|
+
claim: (input: CommandCooldownRequest) => {
|
|
1088
|
+
const result = attempt(() => owner.claim(readCaller(() => snapshotClaimInput(input))))
|
|
1089
|
+
if (result._tag === "Success") return result.value
|
|
1090
|
+
throw result.error
|
|
1091
|
+
},
|
|
1092
|
+
sweep: () => owner.sweep(),
|
|
1093
|
+
clear: () => owner.clear(),
|
|
1094
|
+
})
|
|
1095
|
+
}
|
|
1096
|
+
|
|
1097
|
+
function freezeRouter<M extends MessageCore>(
|
|
1098
|
+
router: DefaultPrefixCommandRouterOwner<M>,
|
|
1099
|
+
): DefaultPrefixCommandRouter<M> {
|
|
1100
|
+
return Object.freeze(router)
|
|
1101
|
+
}
|
|
1102
|
+
|
|
1103
|
+
/** Run an application callback, treating a returned or resolved Err result like a throw of its error */
|
|
1104
|
+
function defaultCallback<A>(callback: () => A | PromiseLike<A>): Effect.Effect<A> {
|
|
1105
|
+
return Effect.withFiber((fiber) => {
|
|
1106
|
+
// Operations the callback starts hold their rejection records for the command's outcome
|
|
1107
|
+
const rejections = fiberRejectionScope(fiber.context)
|
|
1108
|
+
return Effect.tryPromise({
|
|
1109
|
+
try: () =>
|
|
1110
|
+
Promise.resolve()
|
|
1111
|
+
.then(() => inRejectionScope(rejections, callback))
|
|
1112
|
+
.then((value) => {
|
|
1113
|
+
throwIfErr(value)
|
|
1114
|
+
return value
|
|
1115
|
+
}),
|
|
1116
|
+
catch: (error): never => {
|
|
1117
|
+
throw error
|
|
1118
|
+
},
|
|
1119
|
+
})
|
|
1120
|
+
})
|
|
1121
|
+
}
|
|
1122
|
+
|
|
1123
|
+
/**
|
|
1124
|
+
* Run local command setup, keeping ConfigurationError for misuse. A throw from a marked read of caller definitions,
|
|
1125
|
+
* options or claims is an application fault, and any other throw, such as from building the registry, is an SDK fault
|
|
1126
|
+
*/
|
|
1127
|
+
function attempt<A>(create: () => A): A {
|
|
1128
|
+
try {
|
|
1129
|
+
return create()
|
|
1130
|
+
} catch (error) {
|
|
1131
|
+
if (error instanceof ConfigurationError) throw error
|
|
1132
|
+
throw new SdkDefect("commands", [thrownReason(error)])
|
|
1133
|
+
}
|
|
1134
|
+
}
|
|
1135
|
+
|
|
1136
|
+
/**
|
|
1137
|
+
* Run a runBot register callback. Misuse and SDK defects from the registrations it makes keep their errors, and any
|
|
1138
|
+
* other throw is the application's own failure, carried by ApplicationError naming `runBot commands`
|
|
1139
|
+
*/
|
|
1140
|
+
function registerCallback<A>(register: () => A): A {
|
|
1141
|
+
try {
|
|
1142
|
+
return register()
|
|
1143
|
+
} catch (error) {
|
|
1144
|
+
if (error instanceof ConfigurationError || error instanceof SdkDefect) throw error
|
|
1145
|
+
throw new ApplicationError("runBot commands", error)
|
|
1146
|
+
}
|
|
1147
|
+
}
|