public CommandDescriptor(RegexCommandInstance command) { if (command == null) { throw new ArgumentNullException(nameof(command)); } this.DisplayName = GetAttribute <NameAttribute>(command)?.Text; this.Summary = GetAttribute <SummaryAttribute>(command)?.Text; this.HelpCategory = GetAttribute <HelpCategoryAttribute>(command); this.IsHidden = GetAttribute <HiddenAttribute>(command)?.Hide ?? false; this.Restrictions = GetAttribute <RestrictCommandAttribute>(command); this.Priority = command.Priority; }
private static T GetAttribute <T>(RegexCommandInstance command) where T : Attribute => GetAttribute <T>(command.Attributes);