3using System.Threading.Tasks;
15 public string Name {
get; }
36 Name = name ??
throw new ArgumentNullException(nameof(name));
37 HelpText = helpText ??
throw new ArgumentNullException(nameof(helpText));
47 if (this.handler !=
null)
48 throw new InvalidOperationException(
"SetHandler() already called!");
49 this.handler =
handler ??
throw new ArgumentNullException(nameof(
handler));
53 public ValueTask<MessageContent>
Invoke(
string arguments,
ChatUser user, CancellationToken cancellationToken)
56 throw new InvalidOperationException(
"SetHandler() has not been called!");
Represents a tgs_chat_user datum.
Represents a command made from DM code.
ICustomCommandHandler? handler
The ICustomCommandHandler for the CustomCommand.
bool AdminOnly
If the command should only be available to ChatUsers who's ChatUser.Channel has ChannelRepresentation...
CustomCommand(string name, string helpText, bool adminOnly)
Initializes a new instance of the CustomCommand class.
void SetHandler(ICustomCommandHandler handler)
Set a new handler .
string Name
The text to invoke the command. May not be "?" or "help" (case-insensitive).
string HelpText
The help text to display when queires are made about the command.
ValueTask< MessageContent > Invoke(string arguments, ChatUser user, CancellationToken cancellationToken)
Invoke the ICommand.A ValueTask<TResult> resulting in a MessageContent to send to the invoker.
Represents a command that can be invoked by talking to chat bots.
Handles Commands.ICommands that map to those defined in a IChatTrackingContext.
ValueTask< MessageContent > HandleChatCommand(string commandName, string arguments, ChatUser sender, CancellationToken cancellationToken)
Handle a chat command.