nyxx_commands library

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

Classes

AbstractCheck
Represents a check executed on a Command.
Check
Represents a simple stateless check.
Choices
A decorator used to specify choices for Command arguments.
CombineConverter<R, T>
Object used to combine converters.
Command
A Command is a function bound to a name and arguments.
CommandsOptions
Optional commands options.
CommandsPlugin
The base plugin class. This is used to listen to and register commands.
Context
Contains data about a command's execution context.
Converter<T>
Object used to convert raw argument strings to the type required by the command using them.
CooldownCheck
A Check that checks that a Command is not on cooldown.
CooldownType
Represents different types of cooldown
Description
A decorator used to specify descriptions of Command arguments.
FallbackConverter<T>
Object used to successivly try similar Converters until a successful parsing is found.
Group
A Group is a simple class that allows GroupMixins to be instanciated.
GuildCheck
A Check that checks for a specific guild.
InteractionContext
Represents a Context triggered by a slash command (ISlashCommandInteraction).
MessageContext
Represents a Context triggered by a message sent in a text channel.
Name
A decorator used to specify the Discord name of Command arguments.
RoleCheck
A Check thats checks for a specific role or roles.
StringView
A wrapper class to facilitate operations on a String.
UseConverter
A decorator used to specify converter overrides for Command arguments.
UserCheck
A Check that checks for a specific user or users.

Enums

CommandType
An enum used to specify how a Command can be executed.

Mixins

GroupMixin
A Group is a collection of commands. This mixin implements that functionality.

Constants

boolConverter → const Converter<bool>
Converter to convert input to bools.
categoryGuildChannelConverter → const Converter<ICategoryGuildChannel>
Converter to convert input to ICategoryGuildChannels.
doubleConverter → const Converter<double>
Converter to convert input to doubles.
guildChannelConverter → const Converter<IGuildChannel>
Converter to convert input to IGuildChannels.
intConverter → const Converter<int>
Converter to convert input to ints.
memberConverter → const Converter<IMember>
Converter to convert input to IMembers.
mentionableConverter → const Converter<Mentionable>
Converter to convert input to Mentionables.
roleConverter → const Converter<IRole>
Converter to convert input to IRoles.
snowflakeConverter → const Converter<Snowflake>
Converter to convert input to Snowflakes.
stageVoiceChannelConverter → const Converter<IStageVoiceGuildChannel>
Converter to convert input to IStageVoiceGuildChannels.
stringConverter → const Converter<String>
Converter to convert input to Strings.
textGuildChannelConverter → const Converter<ITextGuildChannel>
Converter to convert input to ITextGuildChannels.
userConverter → const Converter<IUser>
Converter to convert input to IUsers.
voiceGuildChannelConverter → const Converter<IVoiceGuildChannel>
Converter to convert input to IVoiceGuildChannels.

Properties

commandNameRegexp RegExp
A RegExp that all command names must match
final
discordTypes Map<Type, CommandOptionType>
Mapping of Dart Types to their Discord API equivalents.
final

Functions

convertToKebabCase(String camelCase) String
The function used to convert camelCase identifiers to Discord compatible kebab-case names
dmOr(String defaultPrefix(IMessage)) String Function(IMessage)
A Function that can be used as an input to CommandsPlugin.prefix to allow users to optionally omit the prefix if the command is ran in a DM with the bot.
mentionOr(String defaultPrefix(IMessage)) String Function(IMessage)
A Function that can be used as an input to CommandsPlugin.prefix to allow invoking commands by mentioning the bot.
parse(CommandsPlugin commands, Context context, StringView toParse, Type expectedType, {Converter? converterOverride}) Future
Attempt to parse a single argument from an argument view.
registerDefaultConverters(CommandsPlugin commands) → void
Register default converters for a CommandsPlugin.

Exceptions / Errors

BadInputException
Base class for exceptions thrown during argument parsing.
CheckFailedException
Exception thrown when an AbstractCheck fails.
CommandInvocationException
Base class for exceptions thrown during command invocation.
CommandNotFoundException
Exception thrown when an unrecognised command is received.
CommandRegistrationError
Error thrown when an invalid command or command structure is registered.
CommandsError
Base class for all errors thrown by this library.
CommandsException
Base class for exceptions thrown by this library.
NoConverterException
Exception thrown when no converter is found for a command argument.
NotEnoughArgumentsException
Exception thrown when a command is invoked without the minimum amount of arguments required.
ParsingException
Exception thrown by StringView when an invalid input is found.
UncaughtException
Exception thrown when an uncaught Exception is thrown by a command callback.