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.
- ChatCommand
- Represents a Discord Slash Command.
- ChatCommandCheck
- A check that succeeds if the command being invoked is a ChatCommand.
- ChatGroup
- Represents a Subcommand Group.
- Check
- A simple, stateless check for commands.
- 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.
- CommandOptions
- Options that modify how a command behaves.
- CommandsOptions
- Options that modify how the CommandsPlugin instance works.
- CommandsPlugin
- The base plugin used to interact with nyxx_commands.
-
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.
-
FallbackConverter<
T> - A converter that successively tries a list of converters until one succeeds.
-
GuildChannelConverter<
T extends IGuildChannel> -
A converter that converts input to one or more types of
IGuildChannel
s. - GuildCheck
- A check that checks that a command was executed in a particular guild, or in a channel that is not in a guild.
-
ICallHooked<
T extends IContext> - Represents an entity which can handle command callback hooks.
- IChatCommandComponent
- An entity that is part of a chat command tree.
- IChatContext
- Represents a context in which a ChatCommand was invoked.
- IChecked
- Represents an entity that can handle checks.
-
ICommand<
T extends IContext> - An entity capable of being invoked by users.
-
ICommandGroup<
T extends IContext> - An entity capable of having multiple child entities.
-
ICommandRegisterable<
T extends IContext> - Represents an entity that can be added as a child to a command group.
- IContext
- A context in which a command was executed.
- IContextBase
- The base class for all contexts in nyxx_commands.
- IInteractionContext
- Represents a context that originated from an interaction.
- IInteractionContextBase
- The base class for all interaction-triggered contexts in nyxx_ccommands.
- 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
- Represents a context in which a ChatCommand was invoked from an interaction.
- InteractionCommandCheck
- A check that succeeds if the context was created from an interaction.
- IOptions
- Represents an entity that supports command options.
- MessageChatCommandCheck
- A check that succeeds if the command being invoked is a ChatCommand and that the context was created from a text message.
- MessageChatContext
- Represents 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
- Representsa context in which a MessageCommand was executed.
- 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.
- PermissionsCheck
- A check that succeeds if the member invoking the command has a certain set of permissions.
- RoleCheck
- A check that checks that the user that executes a command has a specific role.
- 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
- Represents a context in which a UserCommand was executed.
Enums
- CommandType
- Indicates the ways a ChatCommand can be executed.
Constants
-
attachmentConverter
→ const Converter<
IAttachment> -
A converter that converts input to an
IAttachment
. -
boolConverter
→ const Converter<
bool> -
A Converter that converts input to a
bool
. -
categoryGuildChannelConverter
→ const GuildChannelConverter<
ICategoryGuildChannel> -
A converter that converts input to an
ICategoryGuildChannel
. -
doubleConverter
→ const Converter<
double> -
A Converter that converts input to a
double
. -
guildChannelConverter
→ const GuildChannelConverter<
IGuildChannel> -
A converter that converts input to an
IGuildChannel
. -
intConverter
→ const Converter<
int> -
A Converter that converts input to an
int
. -
memberConverter
→ const Converter<
IMember> -
A converter that converts input to an
IMember
. -
mentionableConverter
→ const Converter<
Mentionable> -
A converter that converts input to a
Mentionable
. -
roleConverter
→ const Converter<
IRole> -
A converter that converts input to an
IRole
. -
snowflakeConverter
→ const Converter<
Snowflake> -
A converter that converts input to a
Snowflake
. -
stageVoiceChannelConverter
→ const GuildChannelConverter<
IStageVoiceGuildChannel> -
A converter that converts input to an
IStageVoiceGuildChannel
. -
stringConverter
→ const Converter<
String> -
A Converter that converts input to a
String
. -
textGuildChannelConverter
→ const GuildChannelConverter<
ITextGuildChannel> -
A converter that converts input to an
ITextGuildChannel
. -
userConverter
→ const Converter<
IUser> -
A converter that converts input to an
IUser
. -
voiceGuildChannelConverter
→ const GuildChannelConverter<
IVoiceGuildChannel> -
A converter that converts input to an
IVoiceGuildChannel
.
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(
String defaultPrefix(IMessage)) → String Function(IMessage) - 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 funcion at compile time.
-
mentionOr(
String defaultPrefix(IMessage)) → String Function(IMessage) - A wrapper function for prefixes that allows commands to be invoked with a mention prefix.
-
parse(
CommandsPlugin commands, IChatContext context, StringView toParse, Type expectedType, {Converter? converterOverride}) → Future - Apply a converter to an input and return the result.
-
registerDefaultConverters(
CommandsPlugin commands) → void - Adds the default converters to an instance of CommandsPlugin.
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.
- NoConverterException
- An exception thrown when no Converter was found or created for a type.
- NotEnoughArgumentsException
- An exception thrown when the end of userr 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.
- UncaughtException
- A wrapper class for an exception that was thrown inside the ICommand.execute callback.