67 symbols from @neontechspace/fluxerly/effect
Variables#
commands#
Define text commands, parse their arguments and attach them to an existing client
The simplest route is run's commands option. Creation, registration and help return their result directly and throw Configuration for misuse, so a misconfigured router fails at startup. Commands listen through one bounded message subscription in the caller's Scope when attach executes. The router does not connect the client or create a separate SDK runtime. Guards, cooldown keys, unmatched feedback and handler Effects remain application-owned, with built-in guards for common checks. The router does not retry failures, and it replies on its own only when on is selected. Groups optionally organize command paths and help pages. Flat commands remain independent, and each protected command still needs its own guard
const commands: Commandsimport { commands, type Client } from "@neontechspace/fluxerly/effect"
export function commandGroupExample(client: Client) {
return commands
.create({ prefix: "!" })
.registerGroup({ name: "tools", aliases: ["t"] })
.register({ name: "ping", execute: ({ reply }) => reply("Pong") }, { group: ["tools"] })
.attach(client)
}
import { Effect } from "effect"
import { commands, type Client } from "@neontechspace/fluxerly/effect"
export const installPing = (client: Client) =>
commands
.create({
prefix: "!",
parse: commands.parseQuoted,
onUnmatched: ({ reply }, unmatched) => {
if (unmatched._tag !== "CommandUnknownName") return Effect.void
const hint = unmatched.suggestion === undefined ? "" : `. Closest known command: ${unmatched.suggestion}`
return reply(`Unknown command: ${unmatched.name}${hint}`)
},
})
.register({ name: "ping", execute: ({ reply }) => reply("Pong") })
.attach(client)
Argument schemas are optional definitions of the values a command expects. Guards see raw input first. Conversion failures give rejection feedback without consuming a cooldown. The execute callback receives inferred frozen values alongside unchanged args
import { commands, type Client } from "@neontechspace/fluxerly/effect"
export function typedCommandExample(client: Client) {
return commands
.create({ prefix: "!", parse: commands.parseQuoted, onReject: "reply" })
.register({
name: "repeat",
arguments: {
mode: { type: "choice", choices: ["fast", "slow"] },
count: { type: "integer", min: 1, max: 5, default: 1 },
note: { type: "text", optional: true, rest: true },
},
cooldown: { durationMs: 10_000, per: "user" },
execute: ({ reply, values }) => reply(`${values.count} / ${values.mode} / ${values.note ?? "No note"}`),
})
.attach(client)
}
import { Effect } from "effect"
import { type Client, type PrefixCommandRouter } from "@neontechspace/fluxerly/effect"
export function commandHelpExample(client: Client, router: PrefixCommandRouter, channelId: string) {
const pages = router.help({ prefix: "!", maxLength: 1_000, include: (command) => command.name !== "admin" })
// Visibility is not authorization. Each command still needs its own policy
return Effect.forEach(pages, (content) => client.messages.send(channelId, { content, allowedMentions: {} }), {
discard: true,
})
// Earlier pages remain sent if a later send fails or is interrupted. No retries occur
}
guards#
Built-in native command guards, namely guild, dm, owner and require
const guards: Guardsimport { guards, runBot } from "@neontechspace/fluxerly/effect"
export const moderationBot = (token: string | undefined) =>
runBot({
token,
commands: {
prefix: "!",
commands: {
purge: {
guard: [guards.guildOnly(), guards.requirePermissions(["ManageMessages"])],
execute: ({ reply }) => reply("Purging"),
},
},
},
})
Interfaces#
BotCommandsOptions #
Prefix commands for the native run: The router options of commands, the commands themselves, an optional failure hook and the delivery settings of the router's attach
Router-level callbacks, such as on and middleware, run without extra services, while each command's services are added to the bot's requirements. The router is attached before the gateway starts and closed when the bot stops. The delivery settings concurrency, partition, partition, overflow, max and max are passed to attach unchanged and checked before any client exists. Omitted settings keep the attach defaults: Eight commands at a time and overflow drop, so a burst drops the oldest waiting message with a Warn record. With overflow "stop", a full queue fails the bot with Critical. Unlike commands, run replies to a rejected command by default, such as one with a missing argument, as on does. Set on to send no reply, or a function to give custom feedback. An unset ignore follows the run ignore setting
interface BotCommandsOptions<
M extends MessageCore = Message,
S extends Readonly<Record<string, unknown>>
= Readonly<Record<string, unknown>>,
C extends BotCommandEntries<S> = BotCommandEntries<S>,
RouterServices = never,
ReadyServices = never
>
extends PrefixCommandsOptions<
unknown, never, M
>, HandlerOptions<M>interface BotCommandsOptions<
M extends MessageCore = Message,
S extends Readonly<
Record<string, unknown>
>
= Readonly<
Record<string, unknown>
>,
C extends BotCommandEntries<S>
= BotCommandEntries<S>,
RouterServices = never,
ReadyServices = never
>
extends PrefixCommandsOptions<
unknown, never, M
>, HandlerOptions<M>commands#-
Commands keyed by name, such as
{ ping: { execute: (, or a callback that receives the empty router and returns it with registrations, for groups or commands built elsewhere{ reply }) => reply( "Pong") } } The callback runs synchronously when the
runEffect runs. Invalid registrations and a return value other than the registered router are misuse and die withBot Configuration. Any other throw from the callback creates no client, andError runfails withBot Applicationwhose source is "Error runcommands" and whose cause is the thrown valueBot | C & PrefixCommandBatch<M, S> | ((router: PrefixCommandRouter<never, M>) => PrefixCommandRouter<RouterServices, M>)| C & PrefixCommandBatch<M, S> | (( router: PrefixCommandRouter<never, M> ) => PrefixCommandRouter< RouterServices, M >) onoptional#Error -
Receive command failures, and the reports of the router's own subscription, instead of the client-level
on, as the router attach option doesError Those are a failing
partitionhook, a throwing partition function and an overflow that stops the router (overflow "stop"). With overflowReady drop, a full queue only writes a Warn record and produces no reportOldest (report: FailureReport) => Effect<unknown, unknown, never>(report: FailureReport) => Effect<unknown, unknown, never> partitionoptional#Ready -
Hold the commands of a partition key until its own setup is done, as the
clientoption.on partitiondoes for event handlersReady Valid only together with partition, otherwise
rundies withBot Configurationbefore any client exists. Before the first waiting message of a key starts, the SDK calls the hook with the key and runs its Effect with the services available whenError runruns. The key's messages stay in the queue without using one of the concurrent command slots until the Effect completes, while other keys keep running, and the held messages count towardBot maxandPending Messages max. A hook that fails or dies reports every waiting message of that key to thePending Bytes onoption of the commands, like a throwing partition function does, without a command name, and those messages run no command. The services the hook requires are added to the bot's requirementsError (key: string) => Effect<unknown, unknown, ReadyServices>(key: string) => Effect< unknown, unknown, ReadyServices >
Inherited from Prefix: case, cooldowns, ignore, mention, on, on, parse, prefix, use
Inherited from Handler: concurrency, max, max, overflow, partition
Commands#
Recognize message commands such as !repeat hello with commands from the package's /effect entry point
Creation, registration and help are local and return their result directly, throwing Configuration for misuse. Attachment and memory-store operations return Effects that do nothing until run
interface Commandscreate#
Validate options and create an empty local router, without connecting or subscribing a client
Defaults to full Message typing. Supply Message or the client's Selected type as M for fewer selected fields. Prefix resolvers, parsers, command callbacks and the context client keep the same message type. The router records services R required by optional unmatched feedback, but does not require them until attachment. Invalid options throw Configuration. A throwing getter throws Sdk for commands with code application, while another unexpected fault uses sdk. No prefix resolver, parser or feedback callback runs during creation
create<E = never, R = never, M extends MessageCore = Message>(
options: PrefixCommandsOptions<E, R, M>
): PrefixCommandRouter<R, M>create<
E = never,
R = never,
M extends MessageCore = Message
>(
options:
PrefixCommandsOptions<E, R, M>
): PrefixCommandRouter<R, M>Parameters
options-
PrefixCommandsOptions<E, R, M>
- Returns
PrefixCommandRouter<R, M>
memoryCooldowns #
Create a fresh in-memory cooldown store
Defaults to 10,000 retained keys, or the supplied positive safe integer max. A full store makes room rather than refusing a new key, removing expired keys first and then the reservation that expires soonest. Invalid options throw Configuration. A throwing getter throws Sdk for commands with code application, while another unexpected fault uses sdk. Keep the store for reuse in command cooldowns. It has no persistence, scope finalizer or background timer
memoryCooldowns(
options?: MemoryCooldownOptions
): MemoryCooldownStorememoryCooldowns(
options?: MemoryCooldownOptions
): MemoryCooldownStoreParameters
optionsoptional-
MemoryCooldownOptions
- Returns
MemoryCooldownStore
parseArgument #
Convert one token with a built-in argument descriptor, such as commands, which returns 1_800_000
The grammar is the router's own, so a token converts here exactly when it converts in a command with that descriptor. Accepts every descriptor type except custom, whose parse function can be called directly. The result has the descriptor's value type, such as a string for id and a Member for member. A rejected token returns undefined, as does a missing token unless the descriptor has a default, which is returned instead. A member descriptor needs options, the community the token belongs to, and rejects every token without it. Runs synchronously without a cache, client or network work. A bad descriptor, a custom descriptor, a token that is neither a string nor undefined and bad options throw Configuration. A throwing getter or proxy trap in the descriptor or options throws Sdk for commands with code application, while another unexpected fault uses sdk
parseArgument<
D extends
| CommandArgumentText
| CommandArgumentInteger
| CommandArgumentNumber
| CommandArgumentBoolean
| CommandArgumentId
| CommandArgumentChoice<readonly string[]>
| CommandArgumentUserSelection<
readonly CommandArgumentUser[]
>
| CommandArgumentChannelSelection<
readonly CommandArgumentChannel[]
>
| CommandArgumentRoleSelection<
readonly CommandArgumentRole[]
>
| CommandArgumentMember
| CommandArgumentDuration
>(
token: string | undefined,
descriptor: D,
options?: CommandArgumentParseOptions
): CommandArgumentValue<D> | undefinedparseArgument<
D extends
| CommandArgumentText
| CommandArgumentInteger
| CommandArgumentNumber
| CommandArgumentBoolean
| CommandArgumentId
| CommandArgumentChoice<
readonly string[]
>
| CommandArgumentUserSelection<
readonly CommandArgumentUser[]
>
| CommandArgumentChannelSelection<
readonly CommandArgumentChannel[]
>
| CommandArgumentRoleSelection<
readonly CommandArgumentRole[]
>
| CommandArgumentMember
| CommandArgumentDuration
>(
token: string | undefined,
descriptor: D,
options?:
CommandArgumentParseOptions
):
| CommandArgumentValue<D>
| undefinedParameters
token-
string | undefined descriptor-
D optionsoptional-
CommandArgumentParseOptions
- Returns
CommandArgumentValue<D> | undefined
parseQuoted #
Synchronously split a suffix with single or double quotes and backslash escapes, preserving original argument text in raw
Select with create(, since the default splits only on whitespace. Returns undefined for empty input or invalid names, and a Prefix with a fixed reason and the command name for an unclosed quote or a trailing escape, which on receives. For 'a'b, the single-quote reason adds that a quote followed directly by a letter or digit does not close the span. A double quote opens a span anywhere. A single quote opens one only at the start of a word and closes unless a letter or digit follows, so don't stays literal and 'Yes', 'No' is Yes, and No. Empty quotes produce an empty token
parseQuoted<M extends MessageCore = Message>(
input: PrefixCommandParseInput<M>
): PrefixCommandParse | PrefixCommandParseRejection | undefinedparseQuoted<
M extends MessageCore = Message
>(
input: PrefixCommandParseInput<M>
):
| PrefixCommandParse
| PrefixCommandParseRejection
| undefinedParameters
input-
PrefixCommandParseInput<M>
- Returns
PrefixCommandParse | PrefixCommandParseRejection | undefined| PrefixCommandParse | PrefixCommandParseRejection | undefined
suggest#
Name the candidate closest to a misspelled name, such as commands, which returns "ping"
This is the rule behind the suggestion of Command. It agrees with the router's suggestion for its default case-insensitive matching when the candidates are the registered names of one level. The router also considers aliases and reports the command's own name for a near alias, whereas this helper returns the candidate that matched. A router created with case compares case. Case is ignored. A candidate counts when it is within one edit of a name of up to four characters, or within two edits of a longer name, where an edit inserts, deletes or replaces one character, or swaps two adjacent characters. The closest candidate wins, and the earliest of equally close ones. Returns the winning candidate as written, or undefined when none is close enough or the name is empty. The helper applies no hidden-command filter, so pass only names that may be revealed. Runs synchronously without client or network work. A name that is not a string, candidates that are not an iterable of strings and a lone string as candidates throw Configuration. Candidates whose iterator lookup or iterator throws make it throw Sdk for commands with code application, while another unexpected fault uses sdk
suggest(
name: string,
candidates: Iterable<string>
): string | undefinedsuggest(
name: string,
candidates: Iterable<string>
): string | undefinedParameters
name-
string candidates-
Iterable<string>
- Returns
string | undefined
CooldownStore #
Storage that checks and reserves a command cooldown in one atomic claim
The application owns persistence and coordination of competing claims, including across processes. A claim can be immediate or return an Effect requiring the handler's services
interface CooldownStore<E = never, R = never>interface CooldownStore<
E = never, R = never
>claim#
Reserve input for input, returning a claim directly or through an Effect
The returned Effect runs within command dispatch, preserving the attachment's services and interruption. Only Cooldown permits execution. Other claims call optional rejection feedback without waiting or retrying. Malformed claims fail with Configuration. Store failures and defects use subscription error reporting
claim(
input: CommandCooldownRequest
): CommandCooldownClaim | Effect<CommandCooldownClaim, E, R>claim(
input: CommandCooldownRequest
):
| CommandCooldownClaim
| Effect<
CommandCooldownClaim, E, R
>Parameters
input-
CommandCooldownRequest
- Returns
CommandCooldownClaim | Effect<CommandCooldownClaim, E, R>| CommandCooldownClaim | Effect<CommandCooldownClaim, E, R>
Guards#
Built-in native command guards for the most common access rules
Pass one or a list as a command's guard. Each denial carries a short reason that on sends to the user. Invalid guard settings throw Configuration when the guard is created
interface GuardsdmOnly #
Allow the command only in a confirmed one-to-one or group conversation, and deny every other message
A message with a guild is denied without a request. For a message without one, the guard checks the direct-message cache, then the channel cache, and otherwise reads the channel once with direct, which also fills an enabled direct-message cache. Enable cache to avoid a read for each invocation in the same conversation. A private conversation allows the command. A cached community channel, or a read that Fluxer answers with anything other than a private conversation, denies it. Any other read failure, such as a network failure, timeout or rejection, leaves the channel unconfirmed and fails the guard's Effect with that User, which is reported with the command name
dmOnly<
M extends MessageCore = Message
>(): PrefixCommandGuard<UserOperationFailure, never, M>dmOnly<
M extends MessageCore = Message
>(): PrefixCommandGuard<
UserOperationFailure, never, M
>- Returns
PrefixCommandGuard<UserOperationFailure, never, M>PrefixCommandGuard< UserOperationFailure, never, M >
guildOnly #
Allow the command only for a message that carries its community's guild, and deny every other message without a request
Fluxer's gateway supplies the guild with every community message, so a message without one is denied even when its channel belongs to a community
guildOnly<
M extends MessageCore = Message
>(): PrefixCommandGuard<never, never, M>guildOnly<
M extends MessageCore = Message
>(): PrefixCommandGuard<
never, never, M
>- Returns
PrefixCommandGuard<never, never, M>
ownerOnly #
Allow the command only for the owner of the bot's application, as Fluxer reports it
The first invocation reads the owner's user ID with application, and the guard keeps it for the rest of the client's lifetime, so later invocations decide without a request and an ownership transfer applies to a new client. Invocations that start before the first read completes each read it. A failed read, such as a network failure, timeout or rejection, keeps nothing and fails the guard's Effect with that Bot, which is reported with the command name, and the next invocation reads again
ownerOnly<
M extends MessageCore = Message
>(): PrefixCommandGuard<BotApplicationOperationFailure, never, M>ownerOnly<
M extends MessageCore = Message
>(): PrefixCommandGuard<
BotApplicationOperationFailure,
never,
M
>- Returns
PrefixCommandGuard<BotApplicationOperationFailure, never, M>PrefixCommandGuard< BotApplicationOperationFailure, never, M >
Allow the command only for the given decimal user IDs, such as the bot owner's
An undefined argument, such as an unset environment variable, throws Configuration rather than falling back to the application owner
ownerOnly<M extends MessageCore = Message>(
ownerIds: string | readonly string[]
): PrefixCommandGuard<never, never, M>ownerOnly<
M extends MessageCore = Message
>(
ownerIds:
| string
| readonly string[]
): PrefixCommandGuard<
never, never, M
>Parameters
ownerIds -
string | readonly string[]
- Returns
PrefixCommandGuard<never, never, M>
requirePermissions #
Allow the command only when the invoking member has every named permission in the message's channel, and deny it in direct messages
The guard decides with permissions and prefer: It reads the community, member, roles and channel from enabled caches first and fetches only what is missing, at most once each per invocation, then applies permissions. The reads share one deadline, rest, and only fetches count toward it. Cached observations reflect the last applied gateway events, so a permission change that Fluxer has made but the gateway has not yet delivered is not seen. Where a stale grant matters, check again with permissions before acting. A cached channel without its overwrite list is read again instead of being treated as having no overwrites. In a thread, the guard also reads the thread's parent channel the same way, cache first, and decides as Fluxer does: From the parent channel's permissions, with SendMessages granted exactly when SendMessagesInThreads is. It does not check whether the member can see a private thread or whether the thread is archived or locked. Fluxer sends a channel's permission overwrite list, empty when there are none. When Fluxer sent the channel without its permission overwrite list, its permissions cannot be confirmed, so the guard denies the command rather than guessing. Every other failed read fails the command, which is reported with the command name. The decision does not guarantee that Fluxer allows a later action. A timed-out member keeps its permission bits, but Fluxer blocks sending, editing and publishing own messages, reacting, uploading, typing, changing the own nickname, writing in threads and joining voice, so check members as well. The denial names each missing permission by Fluxer's label, such as Manage community
requirePermissions<M extends MessageCore = Message>(
names: readonly (
| "CreateInstantInvite" | "KickMembers" | "BanMembers"
| "Administrator" | "ManageChannels" | "ManageGuild"
| "AddReactions" | "ViewAuditLog" | "PrioritySpeaker"
| "Stream" | "ViewChannel" | "SendMessages"
| "SendTtsMessages" | "ManageMessages" | "EmbedLinks"
| "AttachFiles" | "ReadMessageHistory" | "MentionEveryone"
| "UseExternalEmojis" | "Connect" | "Speak" | "MuteMembers"
| "DeafenMembers" | "MoveMembers" | "UseVad"
| "ChangeNickname" | "ManageNicknames" | "ManageRoles"
| "ManageWebhooks" | "ManageExpressions" | "ManageThreads"
| "CreatePublicThreads" | "CreatePrivateThreads"
| "UseExternalStickers" | "SendMessagesInThreads"
| "ModerateMembers" | "CreateExpressions" | "PinMessages"
| "BypassSlowmode" | "UpdateRtcRegion"
| "ViewChannelMembers")[]
): PrefixCommandGuard<
ClientClosedError | ChannelOperationError | GuildOperationError,
never,
M
>requirePermissions<
M extends MessageCore = Message
>(
names: readonly (
| "CreateInstantInvite"
| "KickMembers" | "BanMembers"
| "Administrator"
| "ManageChannels"
| "ManageGuild"
| "AddReactions"
| "ViewAuditLog"
| "PrioritySpeaker" | "Stream"
| "ViewChannel"
| "SendMessages"
| "SendTtsMessages"
| "ManageMessages"
| "EmbedLinks" | "AttachFiles"
| "ReadMessageHistory"
| "MentionEveryone"
| "UseExternalEmojis"
| "Connect" | "Speak"
| "MuteMembers"
| "DeafenMembers"
| "MoveMembers" | "UseVad"
| "ChangeNickname"
| "ManageNicknames"
| "ManageRoles"
| "ManageWebhooks"
| "ManageExpressions"
| "ManageThreads"
| "CreatePublicThreads"
| "CreatePrivateThreads"
| "UseExternalStickers"
| "SendMessagesInThreads"
| "ModerateMembers"
| "CreateExpressions"
| "PinMessages"
| "BypassSlowmode"
| "UpdateRtcRegion"
| "ViewChannelMembers")[]
): PrefixCommandGuard<
| ClientClosedError
| ChannelOperationError
| GuildOperationError,
never,
M
>Parameters
names-
readonly ( | "CreateInstantInvite" | "KickMembers" | "BanMembers" | "Administrator" | "ManageChannels" | "ManageGuild" | "AddReactions" | "ViewAuditLog" | "PrioritySpeaker" | "Stream" | "ViewChannel" | "SendMessages" | "SendTtsMessages" | "ManageMessages" | "EmbedLinks" | "AttachFiles" | "ReadMessageHistory" | "MentionEveryone" | "UseExternalEmojis" | "Connect" | "Speak" | "MuteMembers" | "DeafenMembers" | "MoveMembers" | "UseVad" | "ChangeNickname" | "ManageNicknames" | "ManageRoles" | "ManageWebhooks" | "ManageExpressions" | "ManageThreads" | "CreatePublicThreads" | "CreatePrivateThreads" | "UseExternalStickers" | "SendMessagesInThreads" | "ModerateMembers" | "CreateExpressions" | "PinMessages" | "BypassSlowmode" | "UpdateRtcRegion" | "ViewChannelMembers")[]readonly ( | "CreateInstantInvite" | "KickMembers" | "BanMembers" | "Administrator" | "ManageChannels" | "ManageGuild" | "AddReactions" | "ViewAuditLog" | "PrioritySpeaker" | "Stream" | "ViewChannel" | "SendMessages" | "SendTtsMessages" | "ManageMessages" | "EmbedLinks" | "AttachFiles" | "ReadMessageHistory" | "MentionEveryone" | "UseExternalEmojis" | "Connect" | "Speak" | "MuteMembers" | "DeafenMembers" | "MoveMembers" | "UseVad" | "ChangeNickname" | "ManageNicknames" | "ManageRoles" | "ManageWebhooks" | "ManageExpressions" | "ManageThreads" | "CreatePublicThreads" | "CreatePrivateThreads" | "UseExternalStickers" | "SendMessagesInThreads" | "ModerateMembers" | "CreateExpressions" | "PinMessages" | "BypassSlowmode" | "UpdateRtcRegion" | "ViewChannelMembers")[]
- Returns
PrefixCommandGuard< ClientClosedError | ChannelOperationError | GuildOperationError, never, M >PrefixCommandGuard< | ClientClosedError | ChannelOperationError | GuildOperationError, never, M >
MemoryCooldownStore #
Bounded in-memory cooldown reservations for one process, using the caller's Effect Clock wall time
Claim, sweep and clear return lazy Effects, so storage changes occur only when those Effects run. No background timer, persistence or cross-process coordination is provided
interface MemoryCooldownStoremax#Entries -
Fixed key limit selected when the store is created
number size#-
Immediate stored-key count, including expired keys until a full store needs room or a sweep removes them
number
claim#
When run, atomically reserve the key or report its active cooldown
Acquired expiry is the caller Clock's current wall time plus duration. A new key is never refused for lack of space: A full store removes expired keys first, then the reservation that expires soonest, whose key can then claim again early. Malformed keys or durations are misuse and die with Configuration. Unexpected input getter defects remain in the Effect cause
claim(input: CommandCooldownRequest): Effect<CommandCooldownClaim>claim(
input: CommandCooldownRequest
): Effect<CommandCooldownClaim>Parameters
input-
CommandCooldownRequest
- Returns
Effect<CommandCooldownClaim>
clear#
sweep#
PrefixCommand #
A prefix command whose application callbacks return Effects rather than promises
Dispatch evaluates its guard, converts arguments, claims any cooldown and runs the execution Effect. Callbacks use the attachment's captured services and interruption, without a detached runtime. Registration copies metadata and arguments while retaining callbacks and the cooldown store. E describes callback failures and R describes required services. Callback failures are reported by the subscription, not by a completed attach
interface PrefixCommand<
E = never,
R = never,
S extends CommandArgumentSchema = { … },
M extends MessageCore = Message
>
extends PrefixCommandDefinitioninterface PrefixCommand<
E = never,
R = never,
S extends CommandArgumentSchema
= { … },
M extends MessageCore = Message
>
extends PrefixCommandDefinitionargumentsoptional#-
Named positional conversions in property order
Omitted leaves parsed
argsunrestricted and convertedvaluesemptyS cooldownoptional#-
PrefixCommandCooldown<E, R, S, M> execute#-
Return the Effect that performs work for this allowed command with fully converted arguments
The subscription runs it in the attachment's context and discards its success value, rather than sending it as a reply. Failures and defects use safe attachment
onreporting, without retry or cooldown rollback. Non-Effect returns fail withError Configuration. Cooperative Effect work is interrupted when the attachment closes. Synchronous work and promises that ignore cancellation cannot be forcibly stoppedError (context: PrefixCommandExecutionContext<S, M>) => Effect<unknown, E, R>( context: PrefixCommandExecutionContext< S, M > ) => Effect<unknown, E, R> guardoptional#-
One guard or a list of guards, run in order before argument conversion
The first that denies stops the command. Each command owns its policy, with no inherited group guard or authorization from help visibility. Non-Effect returns and invalid verdicts fail with
Configuration. Failures and defects use subscription error reporting rather than rejection feedbackError PrefixCommandGuard<E, R, M> | readonly PrefixCommandGuard<E, R, M>[]| PrefixCommandGuard<E, R, M> | readonly PrefixCommandGuard<E, R, M>[] onoptional#Reject -
Feedback after a denied guard, rejected arguments or a denied cooldown, overriding the router's
onReject A function receives raw context and a safe rejection classification, never partially converted values. Its success value is discarded. Failures and defects use attachment error reporting, without retry. Non-Effect returns fail with
ConfigurationError PrefixCommandRejectionFeedback<E, R, M>
Inherited from Prefix: aliases, description, , name, usage
PrefixCommandContext #
Message and parsed arguments for a native command's guard and rejection callback
These values cannot be changed. Execution and cooldown-key callbacks receive the extended context with converted values. Native callbacks run in the attachment's Effect context, with interruption rather than the default API's AbortSignal field
interface PrefixCommandContext<M extends MessageCore = Message>interface PrefixCommandContext<
M extends MessageCore = Message
>args#-
Parsed string tokens copied to a frozen array, preserved alongside any converted values
readonly string[] client#-
Client supplied to
attach, available for explicit Effect operationsThe application still owns its connection and shutdown
Client<M> help#-
Build help pages from the router that matched this command, for example
({ help, reply }) => reply(help()[0] ?? "No commands") Takes the same settings as
router, all optional: The prefix defaults to the one this message used and the page length to 2,000 UTF-16 code units. Nothing is sent. Invalid settings throw.help ConfigurationasError routerdoes.help (options?: CommandContextHelpOptions) => readonly string[](options?: CommandContextHelpOptions) => readonly string[] message#-
Frozen incoming message with the attached client's selected fields
The router does not fetch omitted fields
M name#-
Registered command name, regardless of the alias or letter case used in the message
string paginate#-
Show several pages in this message's channel that the command's author flips with ◀ and ▶ reactions, such as
({ paginate }) => paginate(["First", "Second"]) Delegates to
clientwith users defaulting to this message's author. Pass users to let other people flip, such as.messages .paginate () => truefor anyone. The other options, defaults, permissions, cleanup and failures are those ofclient. The Effect completes when listening ends, so the handler stays active until then.messages .paginate (pages: readonly PageInput[], options?: PaginateOptions) => Effect<PaginateResult<M>, PaginateFailure>( pages: readonly PageInput[], options?: PaginateOptions ) => Effect< PaginateResult<M>, PaginateFailure > pathoptional#-
Frozen registered names through this command, such as
["admin", "inspect"]Absent at root and does not imply authorization
readonly string[] prefix#-
Exact prefix selected for this invocation, such as
!or!!string raw#Args -
Argument text retained by the parser
The default removes command-name separator whitespace but preserves the remainder
string reply#-
Reply to the incoming message through the attached client
The returned Effect follows handler interruption and can fail with
Send. A string is sent as the reply's content, such asError reply(. Delegates to"Pong") client, including its validation, deadline, nonce, retry, cache and defect behavior. Interruption or a lost response can leave the reply posted. Failure does not always mean nothing was sent, and uncertain sends are not replayed. The router replies on its own only when.messages .reply onis selectedReject: "reply" (input: string | ReplyInput, options?: RequestOptions) => Effect<M, SendError>( input: string | ReplyInput, options?: RequestOptions ) => Effect<M, SendError> send#Help -
Send this router's help in this message's channel, such as
({ sendHelp }) => send Help() Takes the same optional settings as
help. One page is sent as a plain message, and several pages usepaginatewith its defaults, so only the command's author can flip them. Invalid settings, and help with no visible entries, fail withConfigurationwithout sending anythingError (options?: CommandContextHelpOptions) => Effect<PaginateResult<M>, PaginateFailure>(options?: CommandContextHelpOptions) => Effect< PaginateResult<M>, PaginateFailure >
PrefixCommandCooldown #
Limit how often a command executes, per user by default
Claimed after the guards allow execution and all arguments convert, before executing the handler. A claimed cooldown remains claimed if the handler fails or is interrupted
interface PrefixCommandCooldown<
E = never,
R = never,
S extends CommandArgumentSchema = { … },
M extends MessageCore = Message
>interface PrefixCommandCooldown<
E = never,
R = never,
S extends CommandArgumentSchema
= { … },
M extends MessageCore = Message
>duration#Ms -
Whole milliseconds per claim, from 1 through 2,147,483,647
number keyoptional#-
Synchronously return a nonempty suffix from the converted context, replacing the one selected by
perThe router adds the canonical command name or full group path, so aliases share a claim but different parent groups do not. Routers sharing a store also share claims when their command identities and suffixes match
(context: PrefixCommandExecutionContext<S, M>) => string( context: PrefixCommandExecutionContext< S, M > ) => string peroptional#-
Whose invocations share the cooldown:
user(default),channelorguildCommandCooldownPer storeoptional#-
Reservation store retained by reference
Omit it to use the router's own memory store in this process, sized by the router's
cooldownsoption, using the handler's Effect Clock and shared by every router derived from the same createCooldownStore<E, R>
PrefixCommandExecutionContext #
Command context supplied to execution and cooldown-key callbacks only after the complete argument schema succeeds
interface PrefixCommandExecutionContext<
S extends CommandArgumentSchema = { … },
M extends MessageCore = Message
>
extends PrefixCommandContext<M>interface PrefixCommandExecutionContext<
S extends CommandArgumentSchema
= { … },
M extends MessageCore = Message
>
extends PrefixCommandContext<M>values#-
Frozen values keyed by schema names, such as
values, or an empty object when no schema is supplied.count Not available to guards or rejection callbacks
CommandArgumentValues<S>
Inherited from Prefix: args, client, help, message, name, paginate, path, prefix, raw, reply, send
PrefixCommandRouter #
Immutable registered commands and groups for attachment to a native client
Registration returns a new router synchronously, leaving earlier routers and attachments unchanged, and throws Configuration for misuse. R records services required by registered callbacks, which must be provided when attaching the router. Creating or registering a router does not run its callbacks
interface PrefixCommandRouter<
R = never,
M extends MessageCore = Message
>interface PrefixCommandRouter<
R = never,
M extends MessageCore = Message
>commands#-
Frozen executable-command information in registration order across groups, without callbacks or resource candidates
Grouped commands include canonical paths
readonly PrefixCommandMetadata[] groups#-
Frozen group information in registration order, including empty groups
Groups organize lookup and help, not authorization
readonly PrefixCommandGroupMetadata[]
attach#
Return an Effect that registers this router as one bounded message subscription in the caller's scope
Provide registered callback services R and any error-callback or partition services R2 when running this Effect
attach<E = never, R2 = never>(
client: Client<M>,
options?: EventHandlerOptions<E, R2, unknown>
): Effect<Subscription, never, Scope | R | R2>attach<E = never, R2 = never>(
client: Client<M>,
options?: EventHandlerOptions<
E, R2, unknown
>
): Effect<
Subscription, never,
Scope | R | R2
>Produces a Subscription after registration, not after connecting the client or completing future command work.
Callback failures and defects use subscription on reporting with the command name and full Cause, rather than failing an already completed attachment Effect.
A failed on callback or custom parser is reported the same way without a command name.
The router owns one bounded queue for its on hook, which receives reports one at a time in order, as for client.
Omitted or undefined settings default to eight concurrent commands and overflow drop, so a burst never stops the router.
With partition, the option partition holds a key's messages until the Effect it returns completes, as for client.
The held messages wait in the queue without using a concurrent command slot, and a hook that fails or dies reports each waiting message to the router's on, without a command name, and runs no command for it.
A throwing partition function and an overflow that stops the router are reported to on the same way, in the order the reports arrived. Without an on they go to the client-level on or the log.
The option without partition is misuse and dies with Configuration.
Rejected and unmatched commands are counted and logged at Debug in the commands category.
The observe option receives one handler observation per router invocation, including event and command middleware.
A matched command supplies its canonical command name, even when a guard denies it or middleware stops it.
Reported failures produce outcome failure, interruption produces cancelled, and other completions produce success.
A message with no command match still produces an observation without a command name.
Only messages a person typed can run commands. Messages from bots are skipped unless ignore is false, and so is every message whose type is neither Default nor Reply, such as the notice Fluxer posts with a new thread's name as its content. A message without a type, which Fluxer never sends, counts as typed.
Each attachment dispatches independently, so duplicate attachments can execute a command twice
Run subscription or close the registration scope to detach and interrupt handlers, without shutting down the client.
The returned subscription completes after handler finalizers. Work that disables interruption can delay closure.
Synchronous work and caller-owned promises that ignore interruption cannot be forcibly stopped
The client must use message type M. A full-message router cannot attach to a client with omitted fields.
Invalid options are misuse and die with Configuration, and a throwing on getter dies with its thrown value.
On a closing or closed client, attach succeeds with an already-closed
Subscription whose wait succeeds, and writes a Warn log record with code events
Parameters
client-
Client<M> optionsoptional-
EventHandlerOptions<E, R2, unknown>
- Returns
Effect<Subscription, never, Scope | R | R2>Effect< Subscription, never, Scope | R | R2 >
help#
Build frozen help pages locally and synchronously, without sending messages or executing commands
It needs no scope or registered callback services
help(options: CommandHelpOptions): readonly string[]help(
options: CommandHelpOptions
): readonly string[]Root help lists immediate commands and groups in sibling registration order.
A canonical group selection shows the group and its immediate children, including empty groups, unless include rejects an ancestor.
Entries show full canonical paths, aliases and descriptions, with (Group) marking groups.
Commands and groups registered with hidden: true never appear, nor does anything inside a hidden group,
and selecting a hidden group throws Configuration as for a missing one
Schemas generate <required>, [optional] and <rest...> or [rest...] syntax unless explicit usage overrides it.
An empty usage suppresses inferred syntax, and an absent schema adds no argument syntax.
A selection that is empty, or whose group or ancestor include rejects, produces []. No prefix resolver, guard, cooldown or handler is evaluated
The explicit UTF-16 page limit is respected and pages end between visible characters, so surrogate pairs, flags and base characters with combining marks are not split, but a page can be shorter than the limit and Markdown may still be split. Only a single character longer than the limit is cut, between code points. Page-edge whitespace is trimmed and empty pages are removed, so joining pages does not reconstruct the exact original text. The application chooses which pages to send and how to handle mentions
Malformed options, ill-formed text, too-small limits and invalid visibility callbacks throw Configuration.
A throwing option getter throws Sdk for commands with code application and the thrown value as its cause, while another unexpected fault uses sdk
Parameters
options-
CommandHelpOptions
- Returns
readonly string[]
register#
Validate and add a command to a new router, at root or an existing canonical options path
Copies metadata and arguments, retaining callbacks and the cooldown store without invoking them. The resulting router requires this command's services R2 in addition to existing R when attached. Names and aliases must not collide with sibling commands or groups under the router's case policy. Invalid definitions, collisions and missing or alias-only parent paths throw Configuration. A throwing getter throws Sdk for commands with code application, while another unexpected fault uses sdk. Earlier routers and active attachments remain unchanged
register<
E,
R2,
S extends Readonly<Record<string, CommandArgumentDescriptor>>
= { … }
>(
command: PrefixCommand<E, R2, S, M>,
options?: PrefixCommandRegistrationOptions
): PrefixCommandRouter<R | R2, M>register<
E,
R2,
S extends Readonly<
Record<
string,
CommandArgumentDescriptor
>
>
= { … }
>(
command:
PrefixCommand<E, R2, S, M>,
options?: PrefixCommandRegistrationOptions
): PrefixCommandRouter<R | R2, M>Parameters
command-
PrefixCommand<E, R2, S, M> optionsoptional-
PrefixCommandRegistrationOptions
- Returns
PrefixCommandRouter<R | R2, M>
registerGroup #
Add a group to a new router, at root or beneath an existing canonical options path
Register parent groups before children. Groups accept identity and description only, without callbacks or argument schemas. Group names and aliases use fixed whitespace separators at dispatch, before the command parser runs. Invalid metadata, missing parents and sibling name collisions throw Configuration. A throwing getter throws Sdk for commands with code application, while another unexpected fault uses sdk. Existing routers keep their data, and required services R do not change
registerGroup(
group: PrefixCommandGroupDefinition,
options?: PrefixCommandRegistrationOptions
): PrefixCommandRouter<R, M>registerGroup(
group:
PrefixCommandGroupDefinition,
options?: PrefixCommandRegistrationOptions
): PrefixCommandRouter<R, M>Parameters
optionsoptional-
PrefixCommandRegistrationOptions
- Returns
PrefixCommandRouter<R, M>
registerMany #
Validate and add a nonempty keyed command object to one new router, in JavaScript own enumerable string-key order and under one optional parent
Each object key supplies its command name. Set arguments: {} to reject positional arguments, or arguments: undefined to leave raw args unrestricted. Every definition is snapshotted before registration. Inherited batch keys are ignored. Recognized fields inside each definition are read once, including inherited and non-enumerable fields. If any definition is invalid or any name collides, the call throws Configuration and produces no partially registered router. Earlier routers and attachments remain unchanged. The optional parent is validated and snapshotted once. A throwing getter throws Sdk for commands with code application, while another unexpected fault uses sdk. Each entry retains its inferred argument values, and the returned router records every callback service requirement
registerMany<
S extends Readonly<Record<string, unknown>>,
C extends Readonly<
Record<
keyof S,
{
readonly arguments?: Readonly<
Record<string, CommandArgumentDescriptor>
>
readonly execute: unknown
}
>
>
>(
commands: C & PrefixCommandBatch<M, S>,
options?: PrefixCommandRegistrationOptions
): PrefixCommandRouter<R | BatchRequirements<C>, M>registerMany<
S extends Readonly<
Record<string, unknown>
>,
C extends Readonly<
Record<
keyof S,
{
readonly arguments?: Readonly<
Record<
string,
CommandArgumentDescriptor
>
>
readonly execute: unknown
}
>
>
>(
commands:
& C
& PrefixCommandBatch<M, S>,
options?: PrefixCommandRegistrationOptions
): PrefixCommandRouter<
R | BatchRequirements<C>,
M
>Parameters
commands-
C & PrefixCommandBatch<M, S> optionsoptional-
PrefixCommandRegistrationOptions
- Returns
PrefixCommandRouter<R | BatchRequirements<C>, M>PrefixCommandRouter< R | BatchRequirements<C>, M >
PrefixCommandUnmatchedContext #
Frozen message and prefix for native on feedback, without an assumed command or converted arguments
interface PrefixCommandUnmatchedContext<
M extends MessageCore = Message
>interface PrefixCommandUnmatchedContext<
M extends MessageCore = Message
>client#-
Attached client for explicit feedback operations, without transferring its lifetime to the router
Client<M> message#-
Incoming frozen message with the client's selected fields only
M prefix#-
Exact prefix selected before parsing declined, name lookup missed or a group needed a subcommand
string reply#-
Reply to the unmatched incoming message through the attached client, inheriting this callback's interruption
A string is sent as the reply's content. Delegates to
client, including its validation, deadline, nonce, retry, cache and defect behavior. Interruption or a lost response can leave the reply posted. Failure does not always mean nothing was sent, and uncertain sends are not replayed.messages .reply (input: string | ReplyInput, options?: RequestOptions) => Effect<M, SendError>( input: string | ReplyInput, options?: RequestOptions ) => Effect<M, SendError>
PrefixCommandsOptions #
Prefix and parser configuration with optional Effect feedback when no executable command is selected
interface PrefixCommandsOptions<
E = never,
R = never,
M extends MessageCore = Message
>
extends PrefixCommandParsing<M>interface PrefixCommandsOptions<
E = never,
R = never,
M extends MessageCore = Message
>
extends PrefixCommandParsing<M>onoptional#Reject -
Rejection feedback for commands that do not set their own
onReject Omit it to give no feedback, except in
run, which replies by default. Guards returning false never send an automatic replyBot PrefixCommandRejectionFeedback<E, R, M> onoptional#Unmatched -
Return an Effect that handles a parser decline, unknown name or group without a subcommand
An unknown name carries a
suggestionwhen a registered name is close, and a parser decline carries areasonand the commandnamewhen the parser explained a syntax mistake, such as an unclosed quote fromcommands. The Effect runs for every such message and anyone can cause that, so a reply sent from it needs the application's own limit, and in a channel shared with other bots the prefix may belong to a command of another bot. Runs in the attachment's captured Effect context and follows subscription interruption, with its success value discarded. Failures and defects use attachment.parse Quoted onreporting, without retry or automatic replies. Not called for ignored bot messages or messages without a matching prefix. Returning anything other than an Effect fails dispatch withError ConfigurationError ( context: PrefixCommandUnmatchedContext<M>, unmatched: PrefixCommandUnmatched ) => Effect<unknown, E, R>( context: PrefixCommandUnmatchedContext<M>, unmatched: PrefixCommandUnmatched ) => Effect<unknown, E, R> prefix#-
Prefix text, accepted-prefix list or per-message resolver, which may return an Effect
If several prefixes match, the longest wins. Return undefined to ignore the message. A resolver failure is reported without a command name
| string | readonly string[] | ((message: M) => | PrefixCommandPrefixValue | Effect<PrefixCommandPrefixValue, unknown, never>)| string | readonly string[] | ((message: M) => | PrefixCommandPrefixValue | Effect< PrefixCommandPrefixValue, unknown, never >) useoptional#-
Middleware run around every matched command, in order
readonly PrefixCommandMiddleware<E, R, M>[]readonly PrefixCommandMiddleware< E, R, M >[]
Inherited from Prefix: case, cooldowns, ignore, mention, parse
Type Aliases#
BatchRequirements #
The services required by every command in a register batch, recorded on the returned router
type BatchRequirements<C> =
C extends Readonly<Record<string, unknown>>
? CommandRequirements<C[keyof C]>
: nevertype BatchRequirements<C> =
C extends Readonly<
Record<string, unknown>
>
? CommandRequirements<C[keyof C]>
: neverBotCommandEntries #
The keyed-command constraint the native run infers command services from: Each entry's optional argument schema and callback
type BotCommandEntries<S> =
Readonly<
Record<
keyof S,
{
readonly arguments?: CommandArgumentSchema
readonly execute: unknown
}
>
>type BotCommandEntries<S> =
Readonly<
Record<
keyof S,
{
readonly arguments?:
CommandArgumentSchema
readonly execute: unknown
}
>
>CommandRequirements #
type CommandRequirements<C> =
| (C extends { readonly execute: infer F }
? EffectRequirements<F>
: never)
| (C extends { readonly guard: infer F }
? F extends readonly infer G[]
? EffectRequirements<G>
: EffectRequirements<F>
: never)
| (C extends { readonly onReject: infer F }
? EffectRequirements<F>
: never)
| (C extends {
readonly cooldown: {
readonly store: { readonly claim: infer F }
}
}
? F extends (...arguments_: any[]) => infer A
? A extends Effect.Effect<unknown, unknown, infer R>
? R
: never
: never
: never)type CommandRequirements<C> =
| (C extends {
readonly execute: infer F
}
? EffectRequirements<F>
: never)
| (C extends {
readonly guard: infer F
}
? F extends readonly infer G[]
? EffectRequirements<G>
: EffectRequirements<F>
: never)
| (C extends {
readonly onReject: infer F
}
? EffectRequirements<F>
: never)
| (C extends {
readonly cooldown: {
readonly store: {
readonly claim: infer F
}
}
}
? F extends (
...arguments_: any[]
) => infer A
? A extends Effect.Effect<
unknown, unknown,
infer R
>
? R
: never
: never
: never)EffectRequirements #
type EffectRequirements<F> =
F extends (...arguments_: any[])
=> Effect.Effect<unknown, unknown, infer R>
? R
: nevertype EffectRequirements<F> =
F extends (
...arguments_: any[]
) => Effect.Effect<
unknown, unknown, infer R
>
? R
: neverPrefixCommandBatch #
Commands keyed by name, as register and the run commands option accept them
Each value defines one command without its name. Omit arguments to leave raw args unrestricted, or set arguments: {} to reject positional arguments
type PrefixCommandBatch<
M extends MessageCore,
S extends Readonly<Record<string, unknown>>
> = {
readonly [K in keyof S]:
& Omit<
PrefixCommand<
unknown,
any,
S[K] extends CommandArgumentSchema ? S[K] : { … },
M
>,
"name" | "arguments"
>
& {
readonly arguments?: {
readonly [A in keyof S[K]]:
S[K][A] extends CommandArgumentDescriptor
? S[K][A]
: CommandArgumentDescriptor
}
}
}type PrefixCommandBatch<
M extends MessageCore,
S extends Readonly<
Record<string, unknown>
>
> = {
readonly [K in keyof S]:
& Omit<
PrefixCommand<
unknown,
any,
S[
K
] extends CommandArgumentSchema
? S[K]
: { … },
M
>,
"name" | "arguments"
>
& {
readonly arguments?: {
readonly [A in keyof S[K]]:
S[K][
A
] extends CommandArgumentDescriptor
? S[K][A]
: CommandArgumentDescriptor
}
}
}PrefixCommandGuard #
Decide whether a matched command may run, from raw context before argument conversion
The Effect produces true to allow it, false to deny it silently, or { deny: "reason" } to deny it with text that on sends. The built-in guards cover common checks. A false verdict is still counted, logged at Debug and passed to a custom on callback, but never sends an automatic reply. Failures, defects and other values use subscription error reporting
type PrefixCommandGuard<
E = never,
R = never,
M extends MessageCore = Message
> = (context: PrefixCommandContext<M>)
=> Effect.Effect<PrefixCommandGuardResult, E, R>type PrefixCommandGuard<
E = never,
R = never,
M extends MessageCore = Message
> = (
context: PrefixCommandContext<M>
) => Effect.Effect<
PrefixCommandGuardResult,
E,
R
>PrefixCommandMiddleware #
Run around every matched command of a router, in registration order, before its guards
Include next in the returned Effect to continue. Leaving it out stops the command, which is logged at Debug. The rest of the chain runs at most once: Evaluating next again, even concurrently as in Effect, waits for the first run and repeats its outcome. When the command fails, next fails with the command's own failure, the same error or defect its execute Effect produced
type PrefixCommandMiddleware<
E = never,
R = never,
M extends MessageCore = Message
> = (
context: PrefixCommandContext<M>,
next: Effect.Effect<void, unknown>
) => Effect.Effect<unknown, E, R>type PrefixCommandMiddleware<
E = never,
R = never,
M extends MessageCore = Message
> = (
context: PrefixCommandContext<M>,
next:
Effect.Effect<void, unknown>
) => Effect.Effect<unknown, E, R>A failure of the command is reported once with its command name, whatever the middleware does with it.
Failing again with that same error adds no second report. A different failure or defect of the middleware is
reported as a separate failure after the command's, also with the command name. Without a command failure, a
middleware failure is reported like a failed command and stops the command if next has not run yet.
The command's failure is still reported when the middleware is interrupted, for example because the subscription closes
PrefixCommandRejectionFeedback #
Rejection feedback for a command: "reply" sends a short explanation, such as the missing argument and the command's usage, the guard's deny reason or the cooldown's remaining time
"silent" sends nothing, and the rejection is still logged at Debug. A guard returning false never sends an automatic reply, even with "reply" selected. A function returns an Effect that gives feedback instead, including for false guard denials
type PrefixCommandRejectionFeedback<
E = never,
R = never,
M extends MessageCore = Message
> =
| "reply"
| "silent"
| ((
context: PrefixCommandContext<M>,
rejection: PrefixCommandRejection
) => Effect.Effect<unknown, E, R>)type PrefixCommandRejectionFeedback<
E = never,
R = never,
M extends MessageCore = Message
> =
| "reply"
| "silent"
| ((
context:
PrefixCommandContext<M>,
rejection:
PrefixCommandRejection
) => Effect.Effect<unknown, E, R>)So that repeated attempts do not make the bot repeat itself, "reply" answers an active cooldown key once until its
retry time, and a guard denial once per user and command every 5 seconds, measured with the handler's Effect Clock.
Argument rejections are always answered. A skipped reply is counted with the rejection and logged at Debug in the
commands category. A function is called for every rejection, so it can count attempts and apply its own limit, for
example with retry
Re-Exports#
Declared in JavaScript & TypeScript and documented there. Import them from @neontechspace/fluxerly/effect as well
Command#Argument Boolean - Convert only the exact lowercase strings
trueandfalseto booleans, rejecting other spellings and numeric substitutes Command#Argument Channel - Channel data that a
channelargument can matchChoice Command#Argument Channel Selection - Select a channel from a fixed list of candidates by decimal ID, complete channel mention or exact name
Command#Argument Choice - Match one of the configured nonempty strings exactly, returning that string rather than its list position
Command#Argument Custom - Convert one token, or the remaining tokens with
rest, through an application parse function Command#Argument Duration - Convert a duration such as
90s,5m,1h30mor2dto whole milliseconds Command#Argument Id - Keep a decimal resource ID as a string without losing digits through JavaScript number conversion
Command#Argument Integer - Convert a decimal token such as
3or-2to a JavaScript safe integer Command#Argument Member - Select a member of the message's community by complete user mention or decimal user ID, without a roster lookup
Command#Argument Metadata - Frozen description of an argument for help generation, without resource candidate data
Command#Argument Number - Convert decimal text such as
1.25,-2or3e2to a finite JavaScript number Command#Argument Parse Options - Settings for
commandsthat a message would otherwise supply.parse Argument Command#Argument Role - Role data that a
roleargument can matchChoice Command#Argument Role Selection - Select a role from a fixed list of candidates by decimal ID, complete role mention or exact name
Command#Argument Text - Keep one nonempty parsed token as a string, or join the remaining tokens when
restis true Command#Argument User - User data that a
userargument can matchChoice Command#Argument User Selection - Select a user from a fixed list of candidates by decimal ID, complete user mention or exact username
Command#Context Help Options - Choose help pages for the
helpfunction of a command context Command#Cooldown Request - Request to reserve a cooldown after successful guard and argument conversion, before command execution
Command#Help Options - Choose the text prefix, page length and visible entries for
router.help Memory#Cooldown Options - Limit the cooldown keys held by one memory store in one process
Prefix#Command Definition - Names, help text and positional arguments for a command such as
!repeat hello 3 Prefix#Command Group Definition - A named parent for commands, such as
adminin!admin inspect Prefix#Command Group Metadata - Frozen group information copied at registration, including its registered-name path for adding children or selecting help
Prefix#Command Metadata - Frozen command information for inspection and help generation
Prefix#Command Parse - Parser result copied and frozen by the router before command callbacks run
Prefix#Command Parse Input - Frozen input given to a custom parser after prefix matching and any group lookup
Prefix#Command Parse Rejection - A parser result that reports a syntax mistake in text that was meant as a command, such as a quote that never closes
Prefix#Command Parsing - Parsing and cooldown settings shared by both API styles, apart from the prefix, which each API resolves in its own way
Prefix#Command Registration Options - Choose the existing parent group for a new command or child group
Command#Argument Descriptor - One argument's conversion settings, selected by its
typefield and validated when the command is registered Command#Argument Mention - Additional complete-token mention form accepted by an
iddescriptor Command#Argument Optional Value - The converted value type V, with undefined added when descriptor D sets
optional: true Command#Argument Rejection Reason - Argument rejection classification without the rejected token.
Missingmeans a required token was absent,Invalidmeans conversion failed andAmbiguousmeans multiple candidates matched.Unexpectedmeans positional tokens remained after the schema was consumed Command#Argument Schema - Describe positional arguments by name, such as
{ text: { type: "text" }, count: { type: "integer" } } Command#Argument Type - Supported positional conversions, performed locally after the guard allows the command
Command#Argument Value - TypeScript result type for one descriptor, including undefined when
optional: trueis selected without adefault Command#Argument Values - Frozen converted values keyed by the command's argument names, such as
values.count Command#Cooldown Claim - Outcome of reserving a cooldown, selected by
_tag Command#Cooldown Per - Whose invocations share one cooldown: The invoking user, the channel, or the guild
Prefix#Command Guard Result - A guard's decision:
trueallows the command,falsedenies it without an automatic reply, and{ deny }denies it with a reason thatonsends to the userReject: "reply" Prefix#Command Prefix - Text that starts a command invocation, such as
!, or a list of accepted prefixes Prefix#Command Prefix Value - Prefix text selected for one message: One prefix, a list of accepted prefixes, or undefined to ignore the message
Prefix#Command Rejection - Why a known command did not execute, passed as a frozen value to its optional
oncallbackReject Prefix#Command Unmatched - A prefix matched but no executable command was selected