VpSharp/VpSharp.Commands/Command.cs

38 lines
935 B
C#
Raw Normal View History

using System.Collections.ObjectModel;
using System.Reflection;
2022-11-27 20:43:21 +00:00
namespace VpSharp.Commands;
/// <summary>
/// Represents a registered command.
/// </summary>
public sealed class Command
{
internal Command(string name, string[] aliases, MethodInfo method, CommandModule module)
{
Name = name;
Aliases = new ReadOnlyCollection<string>(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>
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; }
}