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
bool
s. -
categoryGuildChannelConverter
→ const Converter<
ICategoryGuildChannel> -
Converter to convert input to
ICategoryGuildChannel
s. -
doubleConverter
→ const Converter<
double> -
Converter to convert input to
double
s. -
guildChannelConverter
→ const Converter<
IGuildChannel> -
Converter to convert input to
IGuildChannel
s. -
intConverter
→ const Converter<
int> -
Converter to convert input to
int
s. -
memberConverter
→ const Converter<
IMember> -
Converter to convert input to
IMember
s. -
mentionableConverter
→ const Converter<
Mentionable> -
Converter to convert input to
Mentionable
s. -
roleConverter
→ const Converter<
IRole> -
Converter to convert input to
IRole
s. -
snowflakeConverter
→ const Converter<
Snowflake> -
Converter to convert input to
Snowflake
s. -
stageVoiceChannelConverter
→ const Converter<
IStageVoiceGuildChannel> -
Converter to convert input to
IStageVoiceGuildChannel
s. -
stringConverter
→ const Converter<
String> -
Converter to convert input to
String
s. -
textGuildChannelConverter
→ const Converter<
ITextGuildChannel> -
Converter to convert input to
ITextGuildChannel
s. -
userConverter
→ const Converter<
IUser> -
Converter to convert input to
IUser
s. -
voiceGuildChannelConverter
→ const Converter<
IVoiceGuildChannel> -
Converter to convert input to
IVoiceGuildChannel
s.
Properties
- commandNameRegexp → RegExp
-
A RegExp that all command names must match
final
-
discordTypes
→ Map<
Type, CommandOptionType> -
Mapping of Dart
Type
s 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.