nyxx_commands library

A framework for easily creating slash commands and text commands for Discord using the nyxx library.

Classes

AbstractCheck
Represents a check on a command.
Autocomplete
An annotation used to override the callback used to handle autocomplete events for a specific argument.
AutocompleteContext
Represents a context in which an autocomplete event was triggered.
ButtonComponentContext
A context in which a button component was interacted with.
CallHooked<T extends CommandContext>
Represents an entity which can handle command callback hooks.
ChatCommand
Represents a Discord Slash Command.
ChatCommandCheck
A check that succeeds if the command being invoked is a ChatCommand.
ChatCommandComponent
An entity that is part of a chat command tree.
ChatContext
A context in which a ChatCommand was executed.
ChatContextData
Data about a context in which a ChatCommand was executed.
ChatGroup
Represents a Subcommand Group.
Check
A simple, stateless check for commands.
Checked
Represents an entity that can handle checks.
Choices
An annotation used to restrict input to a set of choices for a given parameter.
CombineConverter<R, T>
A converter that extends the functionality of an existing converter, piping its output through another function.
Command<T extends CommandContext>
An entity capable of being invoked by users.
CommandContext
A context in which a command was executed.
CommandContextData
Data about a context in which a command was executed.
CommandGroup<T extends CommandContext>
An entity capable of having multiple child entities.
CommandOptions
Options that modify how a command behaves.
CommandRegisterable<T extends CommandContext>
Represents an entity that can be added as a child to a command group.
CommandsOptions
Options that modify how the CommandsPlugin instance works.
CommandsPlugin
The base plugin used to interact with nyxx_commands.
ComponentContext
A context in which a component was interacted with.
ComponentContextData
Data about a context in which a component was interacted with.
ComponentId
An identifier for message components containing metadata about the handler associated with the component.
ContextData
The base class for all contexts in nyxx_commands.
ContextManager
Exposes methods for creating contexts from the raw event dispatched from Discord.
Converter<T>
Contains metadata and parsing capabilities for a given type.
CooldownCheck
A check that succeeds if a command is not on cooldown for a given context.
CooldownType
An enum that represents the different ways to sort contexts into buckets.
Description
An annotation used to add a description to Slash Command arguments.
DoubleConverter
A converter that converts input to doubles, possibly with a minimum or maximum value.
EventManager
A handler for events incoming from nyxx and nyxx_interactions, and listeners associated with those events.
FallbackConverter<T>
A converter that successively tries a list of converters until one succeeds.
GuildChannelConverter<T extends GuildChannel>
A converter that converts input to one or more types of GuildChannels.
GuildCheck
A check that checks that a command was executed in a particular guild, or in a channel that is not in a guild.
IntConverter
A converter that converts input to ints, possibly with a minimum or maximum value.
InteractionChatCommandCheck
A check that succeeds if the command being invoked is a ChatCommand and that the context was created from an interaction.
InteractionChatContext
A context in which a ChatCommand was invoked from an interaction.
InteractionCommandCheck
A check that succeeds if the context was created from an interaction.
InteractionCommandContext
A context in which a command was executed from an interaction.
InteractionCommandContextData
Data about a context in which a command was executed from an interaction.
InteractionContextData
Data about a context which was created by an interaction.
InteractionInteractiveContext
A context that can be interacted with and originated from an interaction.
InteractiveContext
A context that can be interacted with.
MessageChatCommandCheck
A check that succeeds if the command being invoked is a ChatCommand and that the context was created from a text message.
MessageChatContext
A context in which a ChatCommand was invoked from a text message.
MessageCommand
Represents a Discord Message Command.
MessageCommandCheck
A check that succeeds if the command being invoked is a MessageCommand.
MessageContext
A context in which a MessageCommand was executed.
ModalContext
A context in which a user submitted a modal.
Name
An annotation used to change the name displayed in the Discord UI for a given command argument.
NumConverter<T extends num>
A converter that converts input to various types of numbers, possibly with a minimum or maximum value.
Options
Represents an entity that supports command options.
PermissionsCheck
A check that succeeds if the member invoking the command has a certain set of permissions.
ResponseLevel
Information about how a command should respond when using InteractiveContext.respond.
RoleCheck
A check that checks that the user that executes a command has a specific role.
RuntimeType<T>
A non-opaque representation of a Type that can be used at runtime.
SelectMenuContext<T>
A context in which a multi-select component was interacted with.
SimpleConverter<T>
A basic wrapper around a converter, providing an easy way to create custom converters.
StringView
A wrapper class for Strings which adds a cursor tracking an offset in the string.
UseConverter
An annotation used to specify the converter to use for an argument, overriding the default converter for that type.
UserCheck
A check that checks that a command was executed by a specific user.
UserCommand
Represents a Discord User Command.
UserCommandCheck
A check that succeeds if the command being invoked is a UserCommand.
UserContext
A context in which a UserCommand was executed.

Constants

attachmentConverter → const Converter<Attachment>
A converter that converts input to an Attachment.
boolConverter → const Converter<bool>
A Converter that converts input to a bool.
categoryGuildChannelConverter → const GuildChannelConverter<GuildCategory>
A converter that converts input to an GuildCategory.
doubleConverter → const Converter<double>
A Converter that converts input to a double.
guildChannelConverter → const GuildChannelConverter<GuildChannel>
A converter that converts input to a GuildChannel.
intConverter → const Converter<int>
A Converter that converts input to an int.
memberConverter → const Converter<Member>
A converter that converts input to a Member.
mentionableConverter → const Converter<CommandOptionMentionable<CommandOptionMentionable>>
A converter that converts input to a CommandOptionMentionable.
roleConverter → const Converter<Role>
A converter that converts input to a Role.
snowflakeConverter → const Converter<Snowflake>
A converter that converts input to a Snowflake.
stageVoiceChannelConverter → const GuildChannelConverter<GuildStageChannel>
A converter that converts input to an GuildStageChannel.
stringConverter → const Converter<String>
A Converter that converts input to a String.
textGuildChannelConverter → const GuildChannelConverter<GuildTextChannel>
A converter that converts input to an GuildTextChannel.
userConverter → const Converter<User>
A converter that converts input to a User.
voiceGuildChannelConverter → const GuildChannelConverter<GuildVoiceChannel>
A converter that converts input to an GuildVoiceChannel.

Properties

commandNameRegexp RegExp
A pattern all command and argument names should match.
final

Functions

convertToKebabCase(String camelCase) String
Convert a camelCase string to kebab-case.
dmOr(FutureOr<String> defaultPrefix(MessageCreateEvent)) Future<String> Function(MessageCreateEvent)
A wrapper function for prefixes that allows commands to be invoked from messages without a prefix in Direct Messages.
id<T extends Function>(dynamic id, T fn) → T
A special function that can be wrapped around another function in order to tell nyxx_commands how to identify the function at compile time.
mentionOr(FutureOr<String> defaultPrefix(MessageCreateEvent)) Future<String> Function(MessageCreateEvent)
A wrapper function for prefixes that allows commands to be invoked with a mention prefix.
parse<T>(CommandsPlugin commands, ContextData context, StringView toParse, RuntimeType<T> expectedType, {Converter<T>? converterOverride}) Future<T>
Apply a converter to an input and return the result.
registerDefaultConverters(CommandsPlugin commands) → void
Adds the default converters to an instance of CommandsPlugin.

Enums

CommandType
Indicates the ways a ChatCommand can be executed.
ComponentIdStatus
The status of the handler associated with a ComponentId.

Exceptions / Errors

AutocompleteFailedException
A wrapper class for an exception that caused an autocomplete event to fail.
BadInputException
An exception that occurred due to an invalid input from the user.
CheckFailedException
An exception thrown when an AbstractCheck fails.
CommandInvocationException
An exception that occurred during the execution of a command.
CommandNotFoundException
An exception thrown when a message command matching CommandsPlugin.prefix is found, but no command could be resolved from the rest of the message.
CommandRegistrationError
An error that occurred during registration of a command.
CommandsError
The base class for all errors thrown by nyxx_commands.
CommandsException
The base class for exceptions thrown by nyxx_commands.
ContextualException
An exception that can be attached to a known context.
ConverterFailedException
An exception thrown when a converter fails to convert user input.
InteractionTimeoutException
An exception thrown when an interaction times out in a command.
NoConverterException
An exception thrown when no Converter was found or created for a type.
NotEnoughArgumentsException
An exception thrown when the end of user input is encountered before all the required arguments of a ChatCommand have been parsed.
ParsingException
An exception that occurred while a StringView was parsing input.
UncaughtCommandsException
An exception thrown by nyxx_commands to indicate misuse of the library.
UncaughtException
A wrapper class for an exception that was thrown inside the Command.execute callback.
UnhandledInteractionException
An exception thrown when an interaction on a component created by nyxx_commands was received but was not handled.