UserCommand class Null safety

Represents a Discord User Command.

UserCommands are commands that can be invoked on a target user from the Discord client.

For example, a simple command that mentions the target user:

test = UserCommand(
  'Test',
  (UserContext context) {
    context.respond(MessageBuilder.content('${context.targetMember?.mention} was the target!'));
  },
);

commands.addCommand(test);

You might also be interested in:

Implemented types

Constructors

UserCommand(String name, dynamic execute(UserContext), {Iterable<AbstractCheck> checks = const [], CommandOptions options = const CommandOptions(), Map<Locale, String>? localizedNames})
Create a new UserCommand.

Properties

checks Iterable<AbstractCheck>
The checks that should be applied to this entity.
read-only, inherited
execute → dynamic Function(UserContext)
The function called to execute this command.
final
hashCode int
The hash code for this object.
read-only, inherited
localizedNames Map<Locale, String>?
The localized names of this child. Since you cannot add descriptions to UserCommand and MessageCommand, can't set localized descriptions too.
final
name String
The name of this child.
final
onPostCall Stream<UserContext>
A stream that emits contexts after the command callback is executed.
late, final
onPreCall Stream<UserContext>
A stream that emits contexts before the command callback is executed.
late, final
options CommandOptions
The options to use for this entity.
final
parent ICommandGroup<IContext>?
The parent of this child.
read / write, inherited
resolvedOptions CommandOptions
Get the resolvec options for this child.
read-only, inherited
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited

Methods

check(AbstractCheck check) → void
Add a check to this entity.
inherited
invoke(IContext context) Future<void>
Parse arguments, verify checks, call execute and handle call hooks.
override
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