private CommandInfo(Type type) { if (!type.IsSubclassOf(typeof(Command))) { throw new InvalidOperationException($"Cannot create CommandInfo from {type}"); } CommandType = type; Group = GroupAttribute.GetFor(type); Name = NameAttribute.GetFor(type); Alias = AliasAttribute.GetFor(type); Description = DescriptionAttribute.GetFor(type); DefaultPermissions = DefaultPermissionAttribute.GetPermFor(type); RequiredContexts = RequireContextAttribute.GetFor(type); PermissionKey = DefaultPermissionAttribute.GetKeyFor(type); Note = NotesAttribute.GetFor(type); RequireOwner = RequireOwnerAttribute.ExistsOn(type); RequireGuild = RequireGuildAttribute.GetFor(type); Hidden = false; Calls = null; Calls = CallInfo.BuildFrom(this).ToList().AsReadOnly(); Hidden = HiddenAttribute.ExistsOn(type) || Calls.All(c => c.Hidden); }