CommandType enum Null safety

Indicates the ways a ChatCommand can be executed.

For example, a command with type slashOnly cannot be executed with a text message:

ChatCommand test = ChatCommand.slashOnly(
  'test',
  'A test command',
  (IChatContext context) async {
    context.respond(MessageBuilder.content('Hi there!'));
  },
);

commands.addCommand(test);

Inheritance

Constructors

CommandType()
const

Values

textOnly → const CommandType

Indicates that a ChatCommand should only be executable through text messages (sent with the bot prefix).

If this is the type of a ChatCommand, then that command will not be registered as a Slash Command in the Discord API.

CommandType()
slashOnly → const CommandType

Indicates that a ChatCommand should only be executable through Slash Commands.

CommandType()
all → const CommandType

Indicates that a ChatCommand can be executed by both Slash Commands and text messages.

CommandType()
def → const CommandType

Indicates that a ChatCommand should use the default type provided by IOptions.options.

If the default type provided by the options is itself def, the behaviour is identical to all.

CommandType()

Properties

hashCode int
The hash code for this object.
read-only, inherited
index int
A numeric identifier for the enumerated value.
read-only, inherited
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Constants

values → const List<CommandType>
A constant List of the values in this enum, in order of their declaration.
[textOnly, slashOnly, all, def]