tgstation-server 6.17.0
The /tg/station 13 server suite
|
Represents a command made from DM code. More...
Public Member Functions | |||||||
CustomCommand (string name, string helpText, bool adminOnly) | |||||||
Initializes a new instance of the CustomCommand class. | |||||||
void | SetHandler (ICustomCommandHandler handler) | ||||||
Set a new handler . | |||||||
ValueTask< MessageContent > | Invoke (string arguments, ChatUser user, CancellationToken cancellationToken) | ||||||
Invoke the ICommand.
| |||||||
Properties | |
string | Name [get] |
The text to invoke the command. May not be "?" or "help" (case-insensitive). | |
string | HelpText [get] |
The help text to display when queires are made about the command. | |
bool | AdminOnly [get] |
If the command should only be available to ChatUsers who's ChatUser.Channel has ChannelRepresentation.IsAdminChannel set. | |
![]() |
Private Attributes | |
ICustomCommandHandler? | handler |
The ICustomCommandHandler for the CustomCommand. | |
Represents a command made from DM code.
Definition at line 12 of file CustomCommand.cs.
Tgstation.Server.Host.Components.Chat.Commands.CustomCommand.CustomCommand | ( | string | name, |
string | helpText, | ||
bool | adminOnly | ||
) |
Initializes a new instance of the CustomCommand class.
name | The value of Name. |
helpText | The value of HelpText. |
adminOnly | The value of AdminOnly. |
Definition at line 34 of file CustomCommand.cs.
References Tgstation.Server.Host.Components.Chat.Commands.CustomCommand.AdminOnly, Tgstation.Server.Host.Components.Chat.Commands.CustomCommand.HelpText, and Tgstation.Server.Host.Components.Chat.Commands.CustomCommand.Name.
ValueTask< MessageContent > Tgstation.Server.Host.Components.Chat.Commands.CustomCommand.Invoke | ( | string | arguments, |
ChatUser | user, | ||
CancellationToken | cancellationToken | ||
) |
Invoke the ICommand.
arguments | The text after Name with leading whitespace trimmed. |
user | The ChatUser who invoked the command. |
cancellationToken | The CancellationToken for the operation. |
Implements Tgstation.Server.Host.Components.Chat.Commands.ICommand.
Definition at line 53 of file CustomCommand.cs.
References Tgstation.Server.Host.Components.Chat.ICustomCommandHandler.HandleChatCommand(), Tgstation.Server.Host.Components.Chat.Commands.CustomCommand.handler, and Tgstation.Server.Host.Components.Chat.Commands.CustomCommand.Name.
void Tgstation.Server.Host.Components.Chat.Commands.CustomCommand.SetHandler | ( | ICustomCommandHandler | handler | ) |
Set a new handler .
handler | The value of handler. |
Definition at line 45 of file CustomCommand.cs.
References Tgstation.Server.Host.Components.Chat.Commands.CustomCommand.handler.
|
private |
The ICustomCommandHandler for the CustomCommand.
Definition at line 26 of file CustomCommand.cs.
Referenced by Tgstation.Server.Host.Components.Chat.Commands.CustomCommand.Invoke(), and Tgstation.Server.Host.Components.Chat.Commands.CustomCommand.SetHandler().
|
get |
If the command should only be available to ChatUsers who's ChatUser.Channel has ChannelRepresentation.IsAdminChannel set.
Implements Tgstation.Server.Host.Components.Chat.Commands.ICommand.
Definition at line 21 of file CustomCommand.cs.
Referenced by Tgstation.Server.Host.Components.Chat.Commands.CustomCommand.CustomCommand().
|
get |
The help text to display when queires are made about the command.
Implements Tgstation.Server.Host.Components.Chat.Commands.ICommand.
Definition at line 18 of file CustomCommand.cs.
Referenced by Tgstation.Server.Host.Components.Chat.Commands.CustomCommand.CustomCommand().
|
get |
The text to invoke the command. May not be "?" or "help" (case-insensitive).
Implements Tgstation.Server.Host.Components.Chat.Commands.ICommand.
Definition at line 15 of file CustomCommand.cs.
Referenced by Tgstation.Server.Host.Components.Chat.Commands.CustomCommand.CustomCommand(), and Tgstation.Server.Host.Components.Chat.Commands.CustomCommand.Invoke().