@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
package/src/helpers.ts
ADDED
|
@@ -0,0 +1,836 @@
|
|
|
1
|
+
import { FluxerlyError, operationDetails } from "./errors.js"
|
|
2
|
+
import { operationErrorMessage } from "./api-errors.js"
|
|
3
|
+
import { err, ok, type Result } from "neverthrow"
|
|
4
|
+
import { Permissions } from "./guilds.js"
|
|
5
|
+
import type { GuildMember } from "./guilds.js"
|
|
6
|
+
import type { GuildChannel } from "./channels.js"
|
|
7
|
+
import type { DirectMessageChannel, User } from "./users.js"
|
|
8
|
+
import type { MessageReference } from "./messages.js"
|
|
9
|
+
import { guildShardId, maximumShardCount } from "./internal/sharding.js"
|
|
10
|
+
|
|
11
|
+
const snowflakeEpochMs = 1_420_070_400_000n
|
|
12
|
+
const snowflakeTimestampShift = 22n
|
|
13
|
+
const largestSnowflake = (1n << 63n) - 1n
|
|
14
|
+
const largestPermissionBits = (1n << 64n) - 1n
|
|
15
|
+
const largestTimestampSeconds = 8_640_000_000_000
|
|
16
|
+
const markdownEscapable = /[[\]()\\*_~`@#\-|:<>]/gu
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Choose how Fluxer displays a timestamp in a message. The viewer's locale and timezone control its rendered text
|
|
20
|
+
*
|
|
21
|
+
* @category Builders and formatting
|
|
22
|
+
*/
|
|
23
|
+
export const TimestampStyles: Readonly<{
|
|
24
|
+
/** Time without seconds */
|
|
25
|
+
ShortTime: "t"
|
|
26
|
+
/** Time including seconds */
|
|
27
|
+
LongTime: "T"
|
|
28
|
+
/** Compact date */
|
|
29
|
+
ShortDate: "d"
|
|
30
|
+
/** Written-out date */
|
|
31
|
+
LongDate: "D"
|
|
32
|
+
/** Date and time, the default used by `format.timestamp` */
|
|
33
|
+
ShortDateTime: "f"
|
|
34
|
+
/** Written-out date and time */
|
|
35
|
+
LongDateTime: "F"
|
|
36
|
+
/** Compact date and short time */
|
|
37
|
+
ShortDateShortTime: "s"
|
|
38
|
+
/** Compact date and time including seconds */
|
|
39
|
+
ShortDateMediumTime: "S"
|
|
40
|
+
/** Time relative to the viewer's current time, such as "a few minutes ago" */
|
|
41
|
+
RelativeTime: "R"
|
|
42
|
+
}> = Object.freeze({
|
|
43
|
+
ShortTime: "t",
|
|
44
|
+
LongTime: "T",
|
|
45
|
+
ShortDate: "d",
|
|
46
|
+
LongDate: "D",
|
|
47
|
+
ShortDateTime: "f",
|
|
48
|
+
LongDateTime: "F",
|
|
49
|
+
ShortDateShortTime: "s",
|
|
50
|
+
ShortDateMediumTime: "S",
|
|
51
|
+
RelativeTime: "R",
|
|
52
|
+
})
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* One Fluxer timestamp-markup display style
|
|
56
|
+
*
|
|
57
|
+
* @category Builders and formatting
|
|
58
|
+
*/
|
|
59
|
+
export type TimestampStyle = (typeof TimestampStyles)[keyof typeof TimestampStyles]
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* The result of `format.parseMention`. Read `kind` to identify what was mentioned and `id` to get its decimal ID
|
|
63
|
+
*
|
|
64
|
+
* @category Builders and formatting
|
|
65
|
+
*/
|
|
66
|
+
export type Mention =
|
|
67
|
+
| {
|
|
68
|
+
/** This mention names a user, including the `<@!id>` spelling */
|
|
69
|
+
readonly kind: "user"
|
|
70
|
+
/** Mentioned user's decimal ID, without surrounding markup */
|
|
71
|
+
readonly id: string
|
|
72
|
+
}
|
|
73
|
+
| {
|
|
74
|
+
/** This mention names a role */
|
|
75
|
+
readonly kind: "role"
|
|
76
|
+
/** Mentioned role's decimal ID */
|
|
77
|
+
readonly id: string
|
|
78
|
+
}
|
|
79
|
+
| {
|
|
80
|
+
/** This mention names a channel */
|
|
81
|
+
readonly kind: "channel"
|
|
82
|
+
/** Mentioned channel's decimal ID */
|
|
83
|
+
readonly id: string
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Custom-emoji fields used by Fluxer's explicit `<:name:id>` or `<a:name:id>` markup
|
|
88
|
+
*
|
|
89
|
+
* @category Builders and formatting
|
|
90
|
+
*/
|
|
91
|
+
export interface CustomEmojiMarkup {
|
|
92
|
+
/** ASCII letters, digits, underscores, or hyphens as accepted by Fluxer's message parser */
|
|
93
|
+
readonly name: string
|
|
94
|
+
/** Decimal Fluxer emoji ID */
|
|
95
|
+
readonly id: string
|
|
96
|
+
/** Selects `<a:...>` rather than `<:...>` */
|
|
97
|
+
readonly animated?: boolean
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* One parsed timestamp markup value. The `date` field has whole-second precision because Fluxer markup has no milliseconds
|
|
102
|
+
*
|
|
103
|
+
* @category Builders and formatting
|
|
104
|
+
*/
|
|
105
|
+
export interface TimestampMarkup {
|
|
106
|
+
/** UTC instant represented by the markup */
|
|
107
|
+
readonly date: Date
|
|
108
|
+
/** Explicit style, or Fluxer's default short-date-time style when omitted in the markup */
|
|
109
|
+
readonly style: TimestampStyle
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/** The channel information needed to make a web link: Its `id` and, for a community channel, its `guildId`.
|
|
113
|
+
* Supply a direct-message channel without `guildId`. Passing `guildId: null` is not the direct-message form
|
|
114
|
+
*
|
|
115
|
+
* @category Builders and formatting
|
|
116
|
+
*/
|
|
117
|
+
export type ChannelLinkTarget = Pick<GuildChannel, "id" | "guildId"> | Pick<DirectMessageChannel, "id">
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Optional raw permission bitfield requested by a hosted bot-installation page
|
|
121
|
+
*
|
|
122
|
+
* @category Builders and formatting
|
|
123
|
+
*/
|
|
124
|
+
export interface InstallationLinkOptions {
|
|
125
|
+
/** Unsigned 64-bit Fluxer permission bitfield. Omit it to leave the provider's requested permissions unspecified */
|
|
126
|
+
readonly permissions?: bigint
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/** A helper could not use its input.
|
|
130
|
+
* Helpers such as `format.userMention` throw this for invalid input, because passing it is a programming mistake.
|
|
131
|
+
* The try-prefixed helpers, such as `format.tryParseMention`, report the same error without throwing.
|
|
132
|
+
* The default API returns it in a Result, while the native API fails with it in the Effect error channel.
|
|
133
|
+
* Read `operation` and `reason` to identify the problem. The error does not store the rejected value
|
|
134
|
+
*
|
|
135
|
+
* @category Errors
|
|
136
|
+
*/
|
|
137
|
+
export class HelperError extends FluxerlyError {
|
|
138
|
+
/** Fixed name that identifies this error type */
|
|
139
|
+
readonly _tag = "HelperError"
|
|
140
|
+
|
|
141
|
+
constructor(
|
|
142
|
+
/** Helper that rejected the input */
|
|
143
|
+
readonly operation:
|
|
144
|
+
| "format.userMention"
|
|
145
|
+
| "format.roleMention"
|
|
146
|
+
| "format.channelMention"
|
|
147
|
+
| "format.parseMention"
|
|
148
|
+
| "format.timestamp"
|
|
149
|
+
| "format.parseTimestamp"
|
|
150
|
+
| "format.customEmoji"
|
|
151
|
+
| "format.parseCustomEmoji"
|
|
152
|
+
| "snowflakes.parse"
|
|
153
|
+
| "snowflakes.createdAt"
|
|
154
|
+
| "snowflakes.boundary"
|
|
155
|
+
| "snowflakes.shardFor"
|
|
156
|
+
| "permissionBits.has"
|
|
157
|
+
| "permissionBits.from"
|
|
158
|
+
| "permissionBits.hasAll"
|
|
159
|
+
| "permissionBits.hasAny"
|
|
160
|
+
| "permissionBits.missing"
|
|
161
|
+
| "permissionBits.inspect"
|
|
162
|
+
| "permissionBits.toDecimal"
|
|
163
|
+
| "colors.parse"
|
|
164
|
+
| "colors.toHex"
|
|
165
|
+
| "colors.toRgb"
|
|
166
|
+
| "text.split"
|
|
167
|
+
| "links.channel"
|
|
168
|
+
| "links.message"
|
|
169
|
+
| "links.installation"
|
|
170
|
+
| "embed.color"
|
|
171
|
+
| "embed.timestamp",
|
|
172
|
+
/** Invalid input category, without retaining the rejected value */
|
|
173
|
+
readonly reason:
|
|
174
|
+
"id" | "markup" | "time" | "permissionBits" | "link" | "color" | "text" | "limit" | "shardCount",
|
|
175
|
+
/** Optional underlying failure retained as the error's cause */
|
|
176
|
+
options?: { readonly cause?: unknown },
|
|
177
|
+
) {
|
|
178
|
+
super(
|
|
179
|
+
operationErrorMessage({
|
|
180
|
+
subject: "Helper",
|
|
181
|
+
operation,
|
|
182
|
+
reason: "input",
|
|
183
|
+
outcome: "notDispatched",
|
|
184
|
+
inputExplanation: helperExplanation(operation, reason),
|
|
185
|
+
}),
|
|
186
|
+
{
|
|
187
|
+
code: `helper.${reason}`,
|
|
188
|
+
cause: options?.cause,
|
|
189
|
+
details: operationDetails({ operation, reason }),
|
|
190
|
+
},
|
|
191
|
+
)
|
|
192
|
+
this.name = this._tag
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/** What the helper accepts, for the HelperError message. It never includes the rejected value */
|
|
197
|
+
function helperExplanation(operation: HelperError["operation"], reason: HelperError["reason"]): string {
|
|
198
|
+
switch (reason) {
|
|
199
|
+
case "id":
|
|
200
|
+
return "IDs must be decimal strings from 0 through 9,223,372,036,854,775,807"
|
|
201
|
+
case "markup":
|
|
202
|
+
if (operation === "format.parseMention")
|
|
203
|
+
return "Text must be a user, role, or channel mention such as <@123>"
|
|
204
|
+
if (operation === "format.parseTimestamp") return "Text must be timestamp markup such as <t:1700000000:R>"
|
|
205
|
+
if (operation === "format.parseCustomEmoji") return "Text must be custom emoji markup such as <:name:123>"
|
|
206
|
+
if (operation === "format.timestamp") return "Timestamp style must be one of the TimestampStyles values"
|
|
207
|
+
return "Custom emoji must have a name of letters, digits, underscores, or hyphens, a decimal id, and an optional boolean animated"
|
|
208
|
+
case "time":
|
|
209
|
+
if (operation === "format.parseTimestamp")
|
|
210
|
+
return "Timestamp markup must hold a time after the Unix epoch that a Date can represent"
|
|
211
|
+
if (operation === "snowflakes.boundary")
|
|
212
|
+
return "The Date must be valid, from 2015-01-01T00:00:00Z (the Fluxer ID epoch) through the largest ID time"
|
|
213
|
+
if (operation === "embed.timestamp")
|
|
214
|
+
return "Timestamp must be a valid Date, or Unix epoch milliseconds within the Date range"
|
|
215
|
+
if (operation === "format.timestamp") return "The Date must be valid and after the Unix epoch"
|
|
216
|
+
return "The Date must be valid"
|
|
217
|
+
case "permissionBits":
|
|
218
|
+
return "Permission bits must be a bigint from 0 through 18,446,744,073,709,551,615, and permission names must be keys of Permissions"
|
|
219
|
+
case "link":
|
|
220
|
+
if (operation === "links.installation")
|
|
221
|
+
return "Installation link options must be an object that may contain only permissions"
|
|
222
|
+
if (operation === "links.message")
|
|
223
|
+
return "The message must have a decimal id and belong to the given channel, and the channel must have a decimal id and, for a community channel, a decimal guildId"
|
|
224
|
+
return "The channel must be an object with a decimal id and, for a community channel, a decimal guildId"
|
|
225
|
+
case "color":
|
|
226
|
+
return operation === "colors.parse" || operation === "embed.color"
|
|
227
|
+
? "Colors must be integers from 0 through 16,777,215, 6-digit hex strings such as #ff8800, or [red, green, blue] arrays of integers from 0 through 255"
|
|
228
|
+
: "Colors must be integers from 0 through 16,777,215"
|
|
229
|
+
case "text":
|
|
230
|
+
return "Text must be a well-formed string without unpaired surrogates"
|
|
231
|
+
case "limit":
|
|
232
|
+
return "Split options must be an object with only maxLength, a positive safe integer of at least 2 when the text contains surrogate pairs"
|
|
233
|
+
case "shardCount":
|
|
234
|
+
return "The total shard count must be an integer from 1 through 16,384"
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* A key of Permissions, such as `"ManageMessages"`, accepted by the named permissionBits helpers
|
|
240
|
+
*
|
|
241
|
+
* @category Roles and permissions
|
|
242
|
+
*/
|
|
243
|
+
export type PermissionName = keyof typeof Permissions
|
|
244
|
+
|
|
245
|
+
/** Known permission names and any unnamed bits found by permissionBits.inspect.
|
|
246
|
+
* This object and its names array are frozen. They do not decide what a user may do
|
|
247
|
+
*
|
|
248
|
+
* @category Roles and permissions
|
|
249
|
+
*/
|
|
250
|
+
export interface PermissionBitInspection {
|
|
251
|
+
/** Present known names in Permissions declaration order, not sorted by display label */
|
|
252
|
+
readonly names: readonly PermissionName[]
|
|
253
|
+
/** Present bits without a known name, preserved exactly rather than discarded */
|
|
254
|
+
readonly unknownBits: bigint
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
const permissionNames = Object.freeze(Object.keys(Permissions) as PermissionName[])
|
|
258
|
+
const knownPermissionBits = Object.values(Permissions).reduce((bits, flag) => bits | flag, 0n)
|
|
259
|
+
|
|
260
|
+
function validPermissionBits(bits: unknown): bits is bigint {
|
|
261
|
+
return typeof bits === "bigint" && bits >= 0n && bits <= largestPermissionBits
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
function namedPermissions(
|
|
265
|
+
names: readonly PermissionName[],
|
|
266
|
+
operation: HelperError["operation"],
|
|
267
|
+
): Result<bigint, HelperError> {
|
|
268
|
+
if (!Array.isArray(names)) return err(helperError(operation, "permissionBits"))
|
|
269
|
+
let bits = 0n
|
|
270
|
+
for (const name of names) {
|
|
271
|
+
if (typeof name !== "string" || !Object.hasOwn(Permissions, name))
|
|
272
|
+
return err(helperError(operation, "permissionBits"))
|
|
273
|
+
bits |= Permissions[name as PermissionName]
|
|
274
|
+
}
|
|
275
|
+
return ok(bits)
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
const timestampStyleValues = new Set<string>(Object.values(TimestampStyles))
|
|
279
|
+
|
|
280
|
+
function helperError(operation: HelperError["operation"], reason: HelperError["reason"]): HelperError {
|
|
281
|
+
return new HelperError(operation, reason)
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
function isSnowflake(value: unknown): value is string {
|
|
285
|
+
if (typeof value !== "string" || !/^(?:0|[1-9][0-9]*)$/u.test(value)) return false
|
|
286
|
+
try {
|
|
287
|
+
return BigInt(value) <= largestSnowflake
|
|
288
|
+
} catch {
|
|
289
|
+
// allow-silent: a value BigInt cannot parse is not a snowflake
|
|
290
|
+
return false
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
function snowflake(value: unknown, operation: HelperError["operation"]): Result<bigint, HelperError> {
|
|
295
|
+
return isSnowflake(value) ? ok(BigInt(value)) : err(helperError(operation, "id"))
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
function markupId(value: unknown, operation: HelperError["operation"]): Result<string, HelperError> {
|
|
299
|
+
return isSnowflake(value) ? ok(value) : err(helperError(operation, "id"))
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
function timestampDate(value: unknown, operation: HelperError["operation"]): Result<Date, HelperError> {
|
|
303
|
+
if (!(value instanceof Date) || !Number.isFinite(value.getTime())) return err(helperError(operation, "time"))
|
|
304
|
+
return ok(value)
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
function timestampStyle(value: unknown, operation: HelperError["operation"]): Result<TimestampStyle, HelperError> {
|
|
308
|
+
return typeof value === "string" && timestampStyleValues.has(value)
|
|
309
|
+
? ok(value as TimestampStyle)
|
|
310
|
+
: err(helperError(operation, "markup"))
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
function customEmoji(value: unknown, operation: HelperError["operation"]): Result<CustomEmojiMarkup, HelperError> {
|
|
314
|
+
if (typeof value !== "object" || value === null || Array.isArray(value))
|
|
315
|
+
return err(helperError(operation, "markup"))
|
|
316
|
+
const input = value as Record<string, unknown>
|
|
317
|
+
if (typeof input.name !== "string" || !/^[A-Za-z0-9_-]+$/u.test(input.name))
|
|
318
|
+
return err(helperError(operation, "markup"))
|
|
319
|
+
if (!isSnowflake(input.id)) return err(helperError(operation, "id"))
|
|
320
|
+
if (input.animated !== undefined && typeof input.animated !== "boolean")
|
|
321
|
+
return err(helperError(operation, "markup"))
|
|
322
|
+
return ok(Object.freeze({ name: input.name, id: input.id, ...(input.animated === true ? { animated: true } : {}) }))
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
function channelLink(
|
|
326
|
+
value: unknown,
|
|
327
|
+
operation: "links.channel" | "links.message",
|
|
328
|
+
): Result<{ readonly id: string; readonly guildId: string | null }, HelperError> {
|
|
329
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) return err(helperError(operation, "link"))
|
|
330
|
+
const input = value as Record<string, unknown>
|
|
331
|
+
if (!isSnowflake(input.id)) return err(helperError(operation, "id"))
|
|
332
|
+
if (!("guildId" in input)) return ok({ id: input.id, guildId: null })
|
|
333
|
+
return isSnowflake(input.guildId)
|
|
334
|
+
? ok({ id: input.id, guildId: input.guildId })
|
|
335
|
+
: err(helperError(operation, "link"))
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
function installationPermissions(value: unknown): Result<string | undefined, HelperError> {
|
|
339
|
+
if (value === undefined) return ok(undefined)
|
|
340
|
+
if (typeof value !== "object" || value === null || Array.isArray(value))
|
|
341
|
+
return err(helperError("links.installation", "link"))
|
|
342
|
+
const input = value as Record<string, unknown>
|
|
343
|
+
if (Object.keys(input).some((key) => key !== "permissions")) return err(helperError("links.installation", "link"))
|
|
344
|
+
if (input.permissions === undefined) return ok(undefined)
|
|
345
|
+
if (typeof input.permissions !== "bigint") return err(helperError("links.installation", "permissionBits"))
|
|
346
|
+
return validPermissionBits(input.permissions)
|
|
347
|
+
? ok(input.permissions.toString())
|
|
348
|
+
: err(helperError("links.installation", "permissionBits"))
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
/**
|
|
352
|
+
* Return a successful helper value, or throw the helper's expected error for invalid input.
|
|
353
|
+
* Plain public helpers use this over their Result-returning cores, so both keep identical validation
|
|
354
|
+
*/
|
|
355
|
+
export function valueOrThrow<A, E>(result: Result<A, E>): A {
|
|
356
|
+
if (result.isErr()) throw result.error
|
|
357
|
+
return result.value
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
function userMention(id: string): Result<string, HelperError> {
|
|
361
|
+
return markupId(id, "format.userMention").map((value) => `<@${value}>`)
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
function roleMention(id: string): Result<string, HelperError> {
|
|
365
|
+
return markupId(id, "format.roleMention").map((value) => `<@&${value}>`)
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
function channelMention(id: string): Result<string, HelperError> {
|
|
369
|
+
return markupId(id, "format.channelMention").map((value) => `<#${value}>`)
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
function parseMention(value: string): Result<Mention, HelperError> {
|
|
373
|
+
if (typeof value !== "string") return err(helperError("format.parseMention", "markup"))
|
|
374
|
+
const user = /^<@!?([0-9]+)>$/u.exec(value)
|
|
375
|
+
const role = /^<@&([0-9]+)>$/u.exec(value)
|
|
376
|
+
const channel = /^<#([0-9]+)>$/u.exec(value)
|
|
377
|
+
if (user && isSnowflake(user[1])) return ok(Object.freeze({ kind: "user" as const, id: user[1] }))
|
|
378
|
+
if (role && isSnowflake(role[1])) return ok(Object.freeze({ kind: "role" as const, id: role[1] }))
|
|
379
|
+
if (channel && isSnowflake(channel[1])) return ok(Object.freeze({ kind: "channel" as const, id: channel[1] }))
|
|
380
|
+
return err(helperError("format.parseMention", "markup"))
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
function timestamp(value: Date, style: TimestampStyle = TimestampStyles.ShortDateTime): Result<string, HelperError> {
|
|
384
|
+
const date = timestampDate(value, "format.timestamp")
|
|
385
|
+
if (date.isErr()) return err(date.error)
|
|
386
|
+
const resolvedStyle = timestampStyle(style, "format.timestamp")
|
|
387
|
+
if (resolvedStyle.isErr()) return err(resolvedStyle.error)
|
|
388
|
+
const seconds = Math.floor(date.value.getTime() / 1_000)
|
|
389
|
+
if (seconds <= 0 || seconds > largestTimestampSeconds) return err(helperError("format.timestamp", "time"))
|
|
390
|
+
return ok(`<t:${seconds}:${resolvedStyle.value}>`)
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
function parseTimestamp(value: string): Result<TimestampMarkup, HelperError> {
|
|
394
|
+
if (typeof value !== "string") return err(helperError("format.parseTimestamp", "markup"))
|
|
395
|
+
const match = /^<t:([0-9]+)(?::([tTdDfFsSR]))?>$/u.exec(value)
|
|
396
|
+
if (!match) return err(helperError("format.parseTimestamp", "markup"))
|
|
397
|
+
const seconds = Number(match[1])
|
|
398
|
+
if (!Number.isSafeInteger(seconds) || seconds <= 0 || seconds > largestTimestampSeconds)
|
|
399
|
+
return err(helperError("format.parseTimestamp", "time"))
|
|
400
|
+
const style = (match[2] ?? TimestampStyles.ShortDateTime) as TimestampStyle
|
|
401
|
+
return ok(Object.freeze({ date: new Date(seconds * 1_000), style }))
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
function customEmojiMarkup(input: CustomEmojiMarkup): Result<string, HelperError> {
|
|
405
|
+
return customEmoji(input, "format.customEmoji").map(
|
|
406
|
+
(value) => `<${value.animated === true ? "a" : ""}:${value.name}:${value.id}>`,
|
|
407
|
+
)
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
function parseCustomEmoji(value: string): Result<CustomEmojiMarkup, HelperError> {
|
|
411
|
+
if (typeof value !== "string") return err(helperError("format.parseCustomEmoji", "markup"))
|
|
412
|
+
const match = /^<(a?):([A-Za-z0-9_-]+):([0-9]+)>$/u.exec(value)
|
|
413
|
+
if (!match) return err(helperError("format.parseCustomEmoji", "markup"))
|
|
414
|
+
return customEmoji(
|
|
415
|
+
{ name: match[2]!, id: match[3]!, ...(match[1] === "a" ? { animated: true } : {}) },
|
|
416
|
+
"format.parseCustomEmoji",
|
|
417
|
+
)
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
/**
|
|
421
|
+
* Methods of the format helper, which creates and reads mention, timestamp and custom-emoji markup and escapes Markdown.
|
|
422
|
+
* Most methods return plain values and throw HelperError for invalid input.
|
|
423
|
+
* The try-prefixed parsers accept untrusted text and return a Result instead of throwing
|
|
424
|
+
*
|
|
425
|
+
* @category Builders and formatting
|
|
426
|
+
*/
|
|
427
|
+
export type FormatHelpers = Readonly<{
|
|
428
|
+
/**
|
|
429
|
+
* Add backslashes so text is treated literally by Fluxer's markup parser, for example escaping `**bold**`.
|
|
430
|
+
* Returns the escaped string immediately and never throws for string input.
|
|
431
|
+
* It does not change a message's `allowedMentions` or enable notifications
|
|
432
|
+
*/
|
|
433
|
+
escapeMarkdown(value: string): string
|
|
434
|
+
/**
|
|
435
|
+
* Create `<@id>` text for a decimal user ID, such as `<@123>`, and return it directly.
|
|
436
|
+
* Throws HelperError when the ID is not a valid decimal-string snowflake.
|
|
437
|
+
* This does not look up the user, and allowedMentions must be set separately to request a notification
|
|
438
|
+
*/
|
|
439
|
+
userMention(id: string): string
|
|
440
|
+
/**
|
|
441
|
+
* Create `<@&id>` text for a decimal role ID, such as `<@&123>`, and return it directly.
|
|
442
|
+
* Throws HelperError for an invalid ID.
|
|
443
|
+
* Role members are not notified merely because this text appears in a message, and allowedMentions must be set separately
|
|
444
|
+
*/
|
|
445
|
+
roleMention(id: string): string
|
|
446
|
+
/**
|
|
447
|
+
* Create `<#id>` text linking to a channel, such as `<#123>`, and return it directly.
|
|
448
|
+
* Throws HelperError for an invalid decimal-string ID, and no channel lookup occurs
|
|
449
|
+
*/
|
|
450
|
+
channelMention(id: string): string
|
|
451
|
+
/**
|
|
452
|
+
* Read a string containing exactly one user, role or channel mention into a frozen `{ kind, id }` object.
|
|
453
|
+
* Both `<@id>` and `<@!id>` produce kind `"user"`.
|
|
454
|
+
* Throws HelperError for surrounding text, malformed markup or an invalid decimal ID.
|
|
455
|
+
* For text received from users, use tryParseMention, which reports the same HelperError without throwing
|
|
456
|
+
*/
|
|
457
|
+
parseMention(value: string): Mention
|
|
458
|
+
/**
|
|
459
|
+
* Read a mention with the same rules as parseMention, but report invalid text without throwing.
|
|
460
|
+
* The default API returns a Result holding the frozen `{ kind, id }` object or HelperError.
|
|
461
|
+
* The native API returns an Effect that reads the text when run and fails with HelperError.
|
|
462
|
+
* Use it for text received from users or other untrusted sources
|
|
463
|
+
*/
|
|
464
|
+
tryParseMention(value: string): Result<Mention, HelperError>
|
|
465
|
+
/**
|
|
466
|
+
* Create `<t:seconds:style>` message text from a Date, which Fluxer displays in the reader's local time.
|
|
467
|
+
* The style defaults to ShortDateTime, and milliseconds are dropped.
|
|
468
|
+
* The whole Unix second must be from 1 through 8_640_000_000_000.
|
|
469
|
+
* Throws HelperError for an invalid Date, a time outside that range or an unsupported style.
|
|
470
|
+
* The input Date is not changed
|
|
471
|
+
*/
|
|
472
|
+
timestamp(value: Date, style?: TimestampStyle): string
|
|
473
|
+
/**
|
|
474
|
+
* Read exactly one `<t:seconds:style>` or `<t:seconds>` string into a frozen object with a new Date and style.
|
|
475
|
+
* A missing style becomes ShortDateTime.
|
|
476
|
+
* The Date has whole-second precision.
|
|
477
|
+
* Throws HelperError for malformed markup, nonpositive seconds or dates outside JavaScript's range.
|
|
478
|
+
* For text received from users, use tryParseTimestamp, which reports the same HelperError without throwing
|
|
479
|
+
*/
|
|
480
|
+
parseTimestamp(value: string): TimestampMarkup
|
|
481
|
+
/**
|
|
482
|
+
* Read timestamp markup with the same rules as parseTimestamp, but report invalid text without throwing.
|
|
483
|
+
* The default API returns a Result holding the frozen date and style or HelperError.
|
|
484
|
+
* The native API returns an Effect that reads the text when run and fails with HelperError.
|
|
485
|
+
* Use it for text received from users or other untrusted sources
|
|
486
|
+
*/
|
|
487
|
+
tryParseTimestamp(value: string): Result<TimestampMarkup, HelperError>
|
|
488
|
+
/**
|
|
489
|
+
* Create `<:name:id>` text, or `<a:name:id>` when animated is true.
|
|
490
|
+
* A GuildEmoji can be passed directly.
|
|
491
|
+
* Throws HelperError for invalid names, IDs or animation values.
|
|
492
|
+
* This does not upload or look up an emoji
|
|
493
|
+
*/
|
|
494
|
+
customEmoji(input: CustomEmojiMarkup): string
|
|
495
|
+
/**
|
|
496
|
+
* Read exactly one `<:name:id>` or `<a:name:id>` string into frozen name, ID and animated fields.
|
|
497
|
+
* Throws HelperError for malformed markup.
|
|
498
|
+
* This does not resolve shortcodes such as `:smile:` or parse Unicode emoji.
|
|
499
|
+
* For text received from users, use tryParseCustomEmoji, which reports the same HelperError without throwing
|
|
500
|
+
*/
|
|
501
|
+
parseCustomEmoji(value: string): CustomEmojiMarkup
|
|
502
|
+
/**
|
|
503
|
+
* Read custom-emoji markup with the same rules as parseCustomEmoji, but report invalid text without throwing.
|
|
504
|
+
* The default API returns a Result holding the frozen name, ID and animated fields or HelperError.
|
|
505
|
+
* The native API returns an Effect that reads the text when run and fails with HelperError.
|
|
506
|
+
* Use it for text received from users or other untrusted sources
|
|
507
|
+
*/
|
|
508
|
+
tryParseCustomEmoji(value: string): Result<CustomEmojiMarkup, HelperError>
|
|
509
|
+
}>
|
|
510
|
+
|
|
511
|
+
/**
|
|
512
|
+
* Create or read Fluxer's special message text, such as mentions, timestamps and custom emoji.
|
|
513
|
+
* Most methods return plain values and throw HelperError for invalid input, which indicates a programming mistake.
|
|
514
|
+
* For text received from users, the try-prefixed parsers return a Result instead.
|
|
515
|
+
* Use `isOk()` before reading `value`, or `isErr()` before reading `error`.
|
|
516
|
+
* Formatting a mention only creates text, it cannot enable notifications.
|
|
517
|
+
* Keep message notification intent explicit with `allowedMentions` when sending that text
|
|
518
|
+
*
|
|
519
|
+
* @example
|
|
520
|
+
* ```ts
|
|
521
|
+
* import { format, links, type GuildChannel } from "@neontechspace/fluxerly"
|
|
522
|
+
*
|
|
523
|
+
* export function helpersExample(userId: string, messageId: string, channel: GuildChannel) {
|
|
524
|
+
* return {
|
|
525
|
+
* escaped: format.escapeMarkdown("@everyone: **literal**"),
|
|
526
|
+
* mention: format.userMention(userId),
|
|
527
|
+
* message: links.message({ id: messageId, channelId: channel.id }, channel),
|
|
528
|
+
* }
|
|
529
|
+
* }
|
|
530
|
+
* ```
|
|
531
|
+
*/
|
|
532
|
+
export const format: FormatHelpers = Object.freeze({
|
|
533
|
+
escapeMarkdown(value: string): string {
|
|
534
|
+
return value.replace(markdownEscapable, "\\$&")
|
|
535
|
+
},
|
|
536
|
+
userMention: (id: string): string => valueOrThrow(userMention(id)),
|
|
537
|
+
roleMention: (id: string): string => valueOrThrow(roleMention(id)),
|
|
538
|
+
channelMention: (id: string): string => valueOrThrow(channelMention(id)),
|
|
539
|
+
parseMention: (value: string): Mention => valueOrThrow(parseMention(value)),
|
|
540
|
+
tryParseMention: parseMention,
|
|
541
|
+
timestamp: (value: Date, style?: TimestampStyle): string => valueOrThrow(timestamp(value, style)),
|
|
542
|
+
parseTimestamp: (value: string): TimestampMarkup => valueOrThrow(parseTimestamp(value)),
|
|
543
|
+
tryParseTimestamp: parseTimestamp,
|
|
544
|
+
customEmoji: (input: CustomEmojiMarkup): string => valueOrThrow(customEmojiMarkup(input)),
|
|
545
|
+
parseCustomEmoji: (value: string): CustomEmojiMarkup => valueOrThrow(parseCustomEmoji(value)),
|
|
546
|
+
tryParseCustomEmoji: parseCustomEmoji,
|
|
547
|
+
})
|
|
548
|
+
|
|
549
|
+
/**
|
|
550
|
+
* Methods of the snowflakes helper, which reads and converts decimal Fluxer IDs without losing precision
|
|
551
|
+
*
|
|
552
|
+
* @category Builders and formatting
|
|
553
|
+
*/
|
|
554
|
+
export type SnowflakeHelpers = Readonly<{
|
|
555
|
+
/**
|
|
556
|
+
* Return true for a decimal string from `"0"` through `"9223372036854775807"`, with no extra leading zeroes.
|
|
557
|
+
* Returns false immediately for numbers, whitespace and invalid strings, without converting through Number or failing
|
|
558
|
+
*/
|
|
559
|
+
isValid(value: unknown): value is string
|
|
560
|
+
/**
|
|
561
|
+
* Convert a valid decimal-string ID to bigint without losing precision.
|
|
562
|
+
* Throws HelperError for an invalid ID.
|
|
563
|
+
* For IDs received from users, use tryParse, which reports the same HelperError without throwing
|
|
564
|
+
*/
|
|
565
|
+
parse(value: string): bigint
|
|
566
|
+
/**
|
|
567
|
+
* Convert a decimal-string ID with the same rules as parse, but report an invalid ID without throwing.
|
|
568
|
+
* The default API returns a Result holding the bigint or HelperError.
|
|
569
|
+
* The native API returns an Effect that reads the ID when run and fails with HelperError.
|
|
570
|
+
* Use it for IDs received from users or other untrusted sources
|
|
571
|
+
*/
|
|
572
|
+
tryParse(value: string): Result<bigint, HelperError>
|
|
573
|
+
/**
|
|
574
|
+
* Return a new UTC Date for the creation time encoded in an ID.
|
|
575
|
+
* Throws HelperError for an invalid ID.
|
|
576
|
+
* This decodes the ID's high 41 timestamp bits relative to 2015-01-01 UTC, and does not fetch the resource or prove it is visible
|
|
577
|
+
*/
|
|
578
|
+
createdAt(value: string): Date
|
|
579
|
+
/**
|
|
580
|
+
* Make the smallest ID for a Date's exact UTC millisecond, useful as a time-based pagination boundary.
|
|
581
|
+
* Throws HelperError for an invalid Date, a date before 2015-01-01 UTC or a result outside the ID range.
|
|
582
|
+
* This does not create a resource.
|
|
583
|
+
* Whether the boundary is included depends on the endpoint using it
|
|
584
|
+
*/
|
|
585
|
+
boundary(value: Date): string
|
|
586
|
+
/**
|
|
587
|
+
* Return the shard that receives a community's gateway events when the bot runs totalShards shards.
|
|
588
|
+
* Fluxer calls a community a guild, so the first argument is a guild ID.
|
|
589
|
+
* Fluxer routes each community with (guildId >> 22) % totalShards, and this helper applies the same formula.
|
|
590
|
+
* Use it to find which process owns a community when shards run in several processes.
|
|
591
|
+
* Throws HelperError for an invalid ID or a totalShards outside 1 through 16,384.
|
|
592
|
+
* It does not check whether the bot belongs to that community
|
|
593
|
+
*/
|
|
594
|
+
shardFor(guildId: string, totalShards: number): number
|
|
595
|
+
}>
|
|
596
|
+
|
|
597
|
+
function parseSnowflake(value: string): Result<bigint, HelperError> {
|
|
598
|
+
return snowflake(value, "snowflakes.parse")
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
function snowflakeBoundary(value: Date): Result<string, HelperError> {
|
|
602
|
+
const date = timestampDate(value, "snowflakes.boundary")
|
|
603
|
+
if (date.isErr()) return err(date.error)
|
|
604
|
+
const unixMs = BigInt(date.value.getTime())
|
|
605
|
+
if (unixMs < snowflakeEpochMs) return err(helperError("snowflakes.boundary", "time"))
|
|
606
|
+
const boundary = (unixMs - snowflakeEpochMs) << snowflakeTimestampShift
|
|
607
|
+
return boundary <= largestSnowflake ? ok(boundary.toString()) : err(helperError("snowflakes.boundary", "time"))
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
/** Inspect Fluxer IDs, called snowflakes, or make time-based pagination boundaries.
|
|
611
|
+
* IDs stay decimal strings or bigint because JavaScript numbers cannot represent every 64-bit ID exactly.
|
|
612
|
+
* Conversions return plain values and throw HelperError for invalid input, while tryParse returns a Result
|
|
613
|
+
*/
|
|
614
|
+
export const snowflakes: SnowflakeHelpers = Object.freeze({
|
|
615
|
+
isValid(value: unknown): value is string {
|
|
616
|
+
return isSnowflake(value)
|
|
617
|
+
},
|
|
618
|
+
parse: (value: string): bigint => valueOrThrow(parseSnowflake(value)),
|
|
619
|
+
tryParse: parseSnowflake,
|
|
620
|
+
createdAt: (value: string): Date =>
|
|
621
|
+
valueOrThrow(
|
|
622
|
+
snowflake(value, "snowflakes.createdAt").map(
|
|
623
|
+
(id) => new Date(Number((id >> snowflakeTimestampShift) + snowflakeEpochMs)),
|
|
624
|
+
),
|
|
625
|
+
),
|
|
626
|
+
boundary: (value: Date): string => valueOrThrow(snowflakeBoundary(value)),
|
|
627
|
+
shardFor: (guildId: string, totalShards: number): number => {
|
|
628
|
+
valueOrThrow(snowflake(guildId, "snowflakes.shardFor"))
|
|
629
|
+
if (
|
|
630
|
+
typeof totalShards !== "number" ||
|
|
631
|
+
!Number.isSafeInteger(totalShards) ||
|
|
632
|
+
totalShards < 1 ||
|
|
633
|
+
totalShards > maximumShardCount
|
|
634
|
+
)
|
|
635
|
+
throw helperError("snowflakes.shardFor", "shardCount")
|
|
636
|
+
return guildShardId(guildId, totalShards)
|
|
637
|
+
},
|
|
638
|
+
})
|
|
639
|
+
|
|
640
|
+
/**
|
|
641
|
+
* Methods of the display helper, which chooses a display name from supplied user or member data
|
|
642
|
+
*
|
|
643
|
+
* @category Builders and formatting
|
|
644
|
+
*/
|
|
645
|
+
export type DisplayHelpers = Readonly<{
|
|
646
|
+
/** Return the member's nickname, otherwise the user's displayName, otherwise username.
|
|
647
|
+
* Only null or undefined trigger a fallback. Supply a member for the same user, this helper does not check identity or fetch data
|
|
648
|
+
*/
|
|
649
|
+
name(
|
|
650
|
+
user: Pick<User, "username"> & { readonly displayName?: string | null },
|
|
651
|
+
member?: Pick<GuildMember, "nickname">,
|
|
652
|
+
): string
|
|
653
|
+
}>
|
|
654
|
+
|
|
655
|
+
/** Choose a name to show from user and optional community member information already held by the application */
|
|
656
|
+
export const display: DisplayHelpers = Object.freeze({
|
|
657
|
+
name(
|
|
658
|
+
user: Pick<User, "username"> & { readonly displayName?: string | null },
|
|
659
|
+
member?: Pick<GuildMember, "nickname">,
|
|
660
|
+
): string {
|
|
661
|
+
return member?.nickname ?? user.displayName ?? user.username
|
|
662
|
+
},
|
|
663
|
+
})
|
|
664
|
+
|
|
665
|
+
/**
|
|
666
|
+
* Methods of the permissionBits helper, which builds and inspects raw bigint permission flags.
|
|
667
|
+
* Each method returns a plain value and throws HelperError for invalid input
|
|
668
|
+
*
|
|
669
|
+
* @category Roles and permissions
|
|
670
|
+
*/
|
|
671
|
+
export type PermissionBitHelpers = Readonly<{
|
|
672
|
+
/**
|
|
673
|
+
* Combine names such as `["ManageMessages", "ManageRoles"]` into one bigint permission set for role or overwrite inputs.
|
|
674
|
+
* An empty array gives 0n, and duplicates have no extra effect.
|
|
675
|
+
* Administrator remains one flag rather than expanding to all permissions.
|
|
676
|
+
* Throws HelperError for an unknown name
|
|
677
|
+
*/
|
|
678
|
+
from(names: readonly PermissionName[]): bigint
|
|
679
|
+
/**
|
|
680
|
+
* Return whether bits contains one named permission.
|
|
681
|
+
* Throws HelperError for bits outside the unsigned 64-bit bigint range or an unknown permission name.
|
|
682
|
+
* This does not calculate inherited permissions or authorize an action
|
|
683
|
+
*/
|
|
684
|
+
has(bits: bigint, permission: PermissionName): boolean
|
|
685
|
+
/**
|
|
686
|
+
* Return true if bits contains every requested permission, including true for an empty names array.
|
|
687
|
+
* Every name is validated even if a permission is missing, and unknown bits are unchanged.
|
|
688
|
+
* Throws HelperError for invalid bits or unknown names
|
|
689
|
+
*/
|
|
690
|
+
hasAll(bits: bigint, names: readonly PermissionName[]): boolean
|
|
691
|
+
/**
|
|
692
|
+
* Return true if bits contains at least one requested permission, or false for an empty names array.
|
|
693
|
+
* Every name is validated even after finding a match.
|
|
694
|
+
* Throws HelperError for invalid bits or unknown names
|
|
695
|
+
*/
|
|
696
|
+
hasAny(bits: bigint, names: readonly PermissionName[]): boolean
|
|
697
|
+
/**
|
|
698
|
+
* List requested permissions absent from bits, in the order first requested and without duplicates.
|
|
699
|
+
* Returns a frozen array, empty if nothing is missing, and input arrays are not changed.
|
|
700
|
+
* Throws HelperError for invalid bits or unknown names
|
|
701
|
+
*/
|
|
702
|
+
missing(bits: bigint, names: readonly PermissionName[]): readonly PermissionName[]
|
|
703
|
+
/**
|
|
704
|
+
* Return a frozen object listing present known names and any remaining flags as unknownBits.
|
|
705
|
+
* Names follow Permissions declaration order.
|
|
706
|
+
* Unknown flags are preserved, and Administrator does not add other names.
|
|
707
|
+
* Throws HelperError for bits outside the unsigned 64-bit range
|
|
708
|
+
*/
|
|
709
|
+
inspect(bits: bigint): PermissionBitInspection
|
|
710
|
+
/**
|
|
711
|
+
* Convert unsigned 64-bit bigint permission bits to the decimal string used in Fluxer JSON requests and URLs.
|
|
712
|
+
* Throws HelperError for values outside that range
|
|
713
|
+
*/
|
|
714
|
+
toDecimal(bits: bigint): string
|
|
715
|
+
}>
|
|
716
|
+
|
|
717
|
+
/** Work with sets of named permissions stored in a bigint bitfield, without writing bitwise expressions by hand.
|
|
718
|
+
* Each method returns a plain value. Invalid names or values outside unsigned 64-bit bigint range throw HelperError.
|
|
719
|
+
* These inspect stored flags only, they do not expand Administrator, apply channel overrides or decide whether an action is allowed
|
|
720
|
+
*/
|
|
721
|
+
export const permissionBits: PermissionBitHelpers = Object.freeze({
|
|
722
|
+
from: (names: readonly PermissionName[]): bigint => valueOrThrow(namedPermissions(names, "permissionBits.from")),
|
|
723
|
+
has(bits: bigint, permission: PermissionName): boolean {
|
|
724
|
+
if (typeof bits !== "bigint" || bits < 0n || bits > largestPermissionBits)
|
|
725
|
+
throw helperError("permissionBits.has", "permissionBits")
|
|
726
|
+
if (typeof permission !== "string" || !Object.hasOwn(Permissions, permission))
|
|
727
|
+
throw helperError("permissionBits.has", "permissionBits")
|
|
728
|
+
const flag = Permissions[permission as PermissionName]
|
|
729
|
+
return (bits & flag) === flag
|
|
730
|
+
},
|
|
731
|
+
hasAll(bits: bigint, names: readonly PermissionName[]): boolean {
|
|
732
|
+
if (!validPermissionBits(bits)) throw helperError("permissionBits.hasAll", "permissionBits")
|
|
733
|
+
const required = valueOrThrow(namedPermissions(names, "permissionBits.hasAll"))
|
|
734
|
+
return (bits & required) === required
|
|
735
|
+
},
|
|
736
|
+
hasAny(bits: bigint, names: readonly PermissionName[]): boolean {
|
|
737
|
+
if (!validPermissionBits(bits)) throw helperError("permissionBits.hasAny", "permissionBits")
|
|
738
|
+
return (bits & valueOrThrow(namedPermissions(names, "permissionBits.hasAny"))) !== 0n
|
|
739
|
+
},
|
|
740
|
+
missing(bits: bigint, names: readonly PermissionName[]): readonly PermissionName[] {
|
|
741
|
+
if (!validPermissionBits(bits)) throw helperError("permissionBits.missing", "permissionBits")
|
|
742
|
+
valueOrThrow(namedPermissions(names, "permissionBits.missing"))
|
|
743
|
+
return Object.freeze([...new Set(names)].filter((name) => (bits & Permissions[name]) !== Permissions[name]))
|
|
744
|
+
},
|
|
745
|
+
inspect(bits: bigint): PermissionBitInspection {
|
|
746
|
+
if (!validPermissionBits(bits)) throw helperError("permissionBits.inspect", "permissionBits")
|
|
747
|
+
return Object.freeze({
|
|
748
|
+
names: Object.freeze(permissionNames.filter((name) => (bits & Permissions[name]) === Permissions[name])),
|
|
749
|
+
unknownBits: bits & (largestPermissionBits ^ knownPermissionBits),
|
|
750
|
+
})
|
|
751
|
+
},
|
|
752
|
+
toDecimal(bits: bigint): string {
|
|
753
|
+
if (!validPermissionBits(bits)) throw helperError("permissionBits.toDecimal", "permissionBits")
|
|
754
|
+
return bits.toString()
|
|
755
|
+
},
|
|
756
|
+
})
|
|
757
|
+
|
|
758
|
+
/**
|
|
759
|
+
* Methods of the links helper, which builds Fluxer channel, message and installation URLs.
|
|
760
|
+
* Each method returns the URL directly and throws HelperError for invalid input
|
|
761
|
+
*
|
|
762
|
+
* @category Builders and formatting
|
|
763
|
+
*/
|
|
764
|
+
export type LinkHelpers = Readonly<{
|
|
765
|
+
/**
|
|
766
|
+
* Build a hosted community-channel or direct-message URL from `{ id, guildId }` for a community channel or `{ id }` for a private conversation.
|
|
767
|
+
* DirectMessageChannel inputs use Fluxer's `/channels/@me/:channelId` route.
|
|
768
|
+
* Throws HelperError for invalid decimal IDs.
|
|
769
|
+
* A URL does not prove the channel exists or the reader can open it
|
|
770
|
+
*/
|
|
771
|
+
channel(target: ChannelLinkTarget): string
|
|
772
|
+
/**
|
|
773
|
+
* Build a hosted message URL in the supplied actual community-channel or direct-message context.
|
|
774
|
+
* Message and channel IDs must match, otherwise the call throws HelperError.
|
|
775
|
+
* Private versus community context is not inferred from the message alone, and access is not checked
|
|
776
|
+
*/
|
|
777
|
+
message(message: MessageReference, channel: ChannelLinkTarget): string
|
|
778
|
+
/**
|
|
779
|
+
* Build a URL for Fluxer's bot-installation flow from an application ID, with the fixed `bot` scope and optional unsigned 64-bit permissions.
|
|
780
|
+
* For the hosted `links` export, the URL starts at Fluxer's API authorization route, which redirects to the web app's installation page wherever Fluxer currently serves it.
|
|
781
|
+
* Instance links open the instance web app's installation page directly.
|
|
782
|
+
* Throws HelperError for invalid IDs or options, and an alternate origin or scope is not accepted.
|
|
783
|
+
* This does not open the page, install the bot, authorize permissions or check whether the application exists
|
|
784
|
+
*/
|
|
785
|
+
installation(applicationId: string, options?: InstallationLinkOptions): string
|
|
786
|
+
}>
|
|
787
|
+
|
|
788
|
+
/** Make URLs for opening channels, messages or bot installation in the hosted Fluxer app.
|
|
789
|
+
* Each method returns the URL directly and throws HelperError for invalid input. No browser is opened and no access or existence check is made
|
|
790
|
+
*/
|
|
791
|
+
export const links: LinkHelpers = Object.freeze({
|
|
792
|
+
channel(target: ChannelLinkTarget): string {
|
|
793
|
+
const { id, guildId } = valueOrThrow(channelLink(target, "links.channel"))
|
|
794
|
+
return guildId === null
|
|
795
|
+
? `https://fluxer.app/channels/@me/${id}`
|
|
796
|
+
: `https://fluxer.app/channels/${guildId}/${id}`
|
|
797
|
+
},
|
|
798
|
+
message(message: MessageReference, channel: ChannelLinkTarget): string {
|
|
799
|
+
const resolvedChannel = valueOrThrow(channelLink(channel, "links.message"))
|
|
800
|
+
const id = markupId(message?.id, "links.message")
|
|
801
|
+
if (id.isErr() || message?.channelId !== resolvedChannel.id) throw helperError("links.message", "link")
|
|
802
|
+
return resolvedChannel.guildId === null
|
|
803
|
+
? `https://fluxer.app/channels/@me/${resolvedChannel.id}/${id.value}`
|
|
804
|
+
: `https://fluxer.app/channels/${resolvedChannel.guildId}/${resolvedChannel.id}/${id.value}`
|
|
805
|
+
},
|
|
806
|
+
installation(applicationId: string, options?: InstallationLinkOptions): string {
|
|
807
|
+
return `https://api.fluxer.app/v1/oauth2/authorize?${installationQuery(applicationId, options)}`
|
|
808
|
+
},
|
|
809
|
+
})
|
|
810
|
+
|
|
811
|
+
// The hosted marketing site has no installation page, so hosted links start at the API route that redirects to the web app
|
|
812
|
+
function installationQuery(applicationId: string, options: InstallationLinkOptions | undefined): URLSearchParams {
|
|
813
|
+
const id = valueOrThrow(markupId(applicationId, "links.installation"))
|
|
814
|
+
const permissions = valueOrThrow(installationPermissions(options))
|
|
815
|
+
const query = new URLSearchParams({ client_id: id, scope: "bot" })
|
|
816
|
+
if (permissions !== undefined) query.set("permissions", permissions)
|
|
817
|
+
return query
|
|
818
|
+
}
|
|
819
|
+
|
|
820
|
+
/**
|
|
821
|
+
* Make channel, message and installation URLs for a validated instance web-app base
|
|
822
|
+
*
|
|
823
|
+
* The hosted `links` export is unchanged.
|
|
824
|
+
* This factory keeps its local input checks, including thrown HelperError. Channel and message URLs replace only the
|
|
825
|
+
* hosted application base, and installation URLs open the instance web app's installation page directly.
|
|
826
|
+
* No network request occurs
|
|
827
|
+
*/
|
|
828
|
+
export function createInstanceLinks(webapp: string): LinkHelpers {
|
|
829
|
+
const project = (url: string): string => `${webapp}${url.slice("https://fluxer.app".length)}`
|
|
830
|
+
return Object.freeze({
|
|
831
|
+
channel: (...input: Parameters<typeof links.channel>) => project(links.channel(...input)),
|
|
832
|
+
message: (...input: Parameters<typeof links.message>) => project(links.message(...input)),
|
|
833
|
+
installation: (...input: Parameters<typeof links.installation>) =>
|
|
834
|
+
`${webapp}/oauth2/authorize?${installationQuery(...input)}`,
|
|
835
|
+
})
|
|
836
|
+
}
|