2022-12-05 01:02:05 +00:00
|
|
|
|
using System.Reflection;
|
2022-11-27 20:43:21 +00:00
|
|
|
|
|
|
|
|
|
namespace VpSharp.Commands;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Represents a registered command.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public sealed class Command
|
|
|
|
|
{
|
2022-11-30 18:03:00 +00:00
|
|
|
|
internal Command(string name, IReadOnlyList<string> aliases, MethodInfo method, CommandModule module)
|
2022-11-27 20:43:21 +00:00
|
|
|
|
{
|
|
|
|
|
Name = name;
|
2022-11-30 18:03:00 +00:00
|
|
|
|
Aliases = aliases;
|
2022-11-27 20:43:21 +00:00
|
|
|
|
Method = method;
|
|
|
|
|
Module = module;
|
|
|
|
|
Parameters = method.GetParameters()[1..];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets the aliases for this command.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <value>The aliases.</value>
|
2022-11-29 19:06:15 +00:00
|
|
|
|
public IReadOnlyList<string> Aliases { get; }
|
2022-11-27 20:43:21 +00:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets the name of this command.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <value>The name.</value>
|
|
|
|
|
public string Name { get; }
|
|
|
|
|
|
|
|
|
|
internal MethodInfo Method { get; }
|
|
|
|
|
|
|
|
|
|
internal CommandModule Module { get; }
|
|
|
|
|
|
|
|
|
|
internal ParameterInfo[] Parameters { get; }
|
|
|
|
|
}
|