Class Command
Represents a command.
Namespace: DisCatSharp.CommandsNext
Assembly: DisCatSharp.CommandsNext.dll
Syntax
public class Command
Properties
| Improve this Doc View SourceAliases
Gets this command's aliases.
Declaration
public IReadOnlyList<string> Aliases { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IReadOnlyList<System.String> |
CustomAttributes
Gets the custom attributes defined on this command.
Declaration
public IReadOnlyList<Attribute> CustomAttributes { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IReadOnlyList<System.Attribute> |
Description
Gets this command's description.
Declaration
public string Description { get; }
Property Value
Type | Description |
---|---|
System.String |
ExecutionChecks
Gets a collection of pre-execution checks for this command.
Declaration
public IReadOnlyList<CheckBaseAttribute> ExecutionChecks { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IReadOnlyList<CheckBaseAttribute> |
IsHidden
Gets whether this command is hidden.
Declaration
public bool IsHidden { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Module
Gets the module in which this command is defined.
Declaration
public ICommandModule Module { get; }
Property Value
Type | Description |
---|---|
ICommandModule |
Name
Gets this command's name.
Declaration
public string Name { get; }
Property Value
Type | Description |
---|---|
System.String |
Overloads
Gets a collection of this command's overloads.
Declaration
public IReadOnlyList<CommandOverload> Overloads { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IReadOnlyList<CommandOverload> |
Parent
Gets this command's parent module, if any.
Declaration
public CommandGroup Parent { get; }
Property Value
Type | Description |
---|---|
CommandGroup |
QualifiedName
Gets this command's qualified name (i.e. one that includes all module names).
Declaration
public string QualifiedName { get; }
Property Value
Type | Description |
---|---|
System.String |
Methods
| Improve this Doc View SourceEquals(Object)
Checks whether this command equals another object.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
System.Object | obj | Object to compare to. |
Returns
Type | Description |
---|---|
System.Boolean | Whether this command is equal to another object. |
Overrides
ExecuteAsync(CommandContext)
Executes this command with specified context.
Declaration
public virtual async Task<CommandResult> ExecuteAsync(CommandContext ctx)
Parameters
Type | Name | Description |
---|---|---|
CommandContext | ctx | Context to execute the command in. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<CommandResult> | Command's execution results. |
GetHashCode()
Gets this command's hash code.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
System.Int32 | This command's hash code. |
Overrides
RunChecksAsync(CommandContext, Boolean)
Runs pre-execution checks for this command and returns any that fail for given context.
Declaration
public async Task<IEnumerable<CheckBaseAttribute>> RunChecksAsync(CommandContext ctx, bool help)
Parameters
Type | Name | Description |
---|---|---|
CommandContext | ctx | Context in which the command is executed. |
System.Boolean | help | Whether this check is being executed from help or not. This can be used to probe whether command can be run without setting off certain fail conditions (such as cooldowns). |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<CheckBaseAttribute>> | Pre-execution checks that fail for given context. |
ToString()
Returns a string representation of this command.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String | String representation of this command. |
Overrides
Operators
| Improve this Doc View SourceEquality(Command, Command)
Checks whether this command is equal to another one.
Declaration
public static bool operator ==(Command cmd1, Command cmd2)
Parameters
Type | Name | Description |
---|---|---|
Command | cmd1 | Command to compare to. |
Command | cmd2 | Command to compare. |
Returns
Type | Description |
---|---|
System.Boolean | Whether the two commands are equal. |
Inequality(Command, Command)
Checks whether this command is not equal to another one.
Declaration
public static bool operator !=(Command cmd1, Command cmd2)
Parameters
Type | Name | Description |
---|---|---|
Command | cmd1 | Command to compare to. |
Command | cmd2 | Command to compare. |
Returns
Type | Description |
---|---|
System.Boolean | Whether the two commands are not equal. |