nyxx_commands library Null safety

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. [...]

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. [...]
Converter<bool>(convertBool, type: CommandOptionType.boolean)
categoryGuildChannelConverter → const Converter<ICategoryGuildChannel>
Converter to convert input to ICategoryGuildChannels. [...]
FallbackConverter([CombineConverter<Snowflake, ICategoryGuildChannel>(snowflakeConverter, snowflakeToGuildChannel<ICategoryGuildChannel>), Converter<ICategoryGuildChannel>(convertGui…
doubleConverter → const Converter<double>
Converter to convert input to doubles. [...]
Converter<double>(convertDouble, type: CommandOptionType.number)
guildChannelConverter → const Converter<IGuildChannel>
Converter to convert input to IGuildChannels. [...]
FallbackConverter([CombineConverter<Snowflake, IGuildChannel>(snowflakeConverter, snowflakeToGuildChannel<IGuildChannel>), Converter<IGuildChannel>(convertGuildChannel<IGuildChann…
intConverter → const Converter<int>
Converter to convert input to ints. [...]
Converter<int>(convertInt, type: CommandOptionType.integer)
memberConverter → const Converter<IMember>
Converter to convert input to IMembers. [...]
FallbackConverter<IMember>([CombineConverter<Snowflake, IMember>(snowflakeConverter, snowflakeToMember), Converter<IMember>(convertMember)], type: CommandOptionType.user)
mentionableConverter → const Converter<Mentionable>
Converter to convert input to Mentionables. [...]
FallbackConverter([memberConverter, roleConverter], type: CommandOptionType.mentionable)
roleConverter → const Converter<IRole>
Converter to convert input to IRoles. [...]
FallbackConverter<IRole>([CombineConverter<Snowflake, IRole>(snowflakeConverter, snowflakeToRole), Converter<IRole>(convertRole)], type: CommandOptionType.role)
snowflakeConverter → const Converter<Snowflake>
Converter to convert input to Snowflakes. [...]
Converter<Snowflake>(convertSnowflake)
stageVoiceChannelConverter → const Converter<IStageVoiceGuildChannel>
Converter to convert input to IStageVoiceGuildChannels. [...]
FallbackConverter([CombineConverter<Snowflake, IStageVoiceGuildChannel>(snowflakeConverter, snowflakeToGuildChannel<IStageVoiceGuildChannel>), Converter<IStageVoiceGuildChannel>(conv…
stringConverter → const Converter<String>
Converter to convert input to Strings. [...]
Converter<String>(convertString, type: CommandOptionType.string)
textGuildChannelConverter → const Converter<ITextGuildChannel>
Converter to convert input to ITextGuildChannels. [...]
FallbackConverter([CombineConverter<Snowflake, ITextGuildChannel>(snowflakeConverter, snowflakeToGuildChannel<ITextGuildChannel>), Converter<ITextGuildChannel>(convertGuildChannel<…
userConverter → const Converter<IUser>
Converter to convert input to IUsers. [...]
FallbackConverter<IUser>([CombineConverter<Snowflake, IUser>(snowflakeConverter, snowflakeToUser), CombineConverter<IMember, IUser>(memberConverter, memberToUser), Converter<IUser…
voiceGuildChannelConverter → const Converter<IVoiceGuildChannel>
Converter to convert input to IVoiceGuildChannels. [...]
FallbackConverter([CombineConverter<Snowflake, IVoiceGuildChannel>(snowflakeConverter, snowflakeToGuildChannel<IVoiceGuildChannel>), Converter<IVoiceGuildChannel>(convertGuildChannel…

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. [...]
@Deprecated("Specify types in Converter constructors"), 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. [...]

Enums

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

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. [...]