Browse Source

Revert 3856d43 & rename CommandParameter.Description to Summary

pull/178/head
Finite Reality 9 years ago
parent
commit
f7633ea3d7
3 changed files with 7 additions and 6 deletions
  1. +2
    -2
      src/Discord.Net.Commands/Command.cs
  2. +3
    -3
      src/Discord.Net.Commands/CommandParameter.cs
  3. +2
    -1
      src/Discord.Net.Commands/CommandService.cs

+ 2
- 2
src/Discord.Net.Commands/Command.cs View File

@@ -103,11 +103,11 @@ namespace Discord.Commands
throw new InvalidOperationException("Remainder parameters must be the last parameter in a command."); throw new InvalidOperationException("Remainder parameters must be the last parameter in a command.");


string name = parameter.Name; string name = parameter.Name;
string description = parameter.GetCustomAttribute<DescriptionAttribute>()?.Text;
string summary = parameter.GetCustomAttribute<DescriptionAttribute>()?.Text;
bool isOptional = parameter.IsOptional; bool isOptional = parameter.IsOptional;
object defaultValue = parameter.HasDefaultValue ? parameter.DefaultValue : null; object defaultValue = parameter.HasDefaultValue ? parameter.DefaultValue : null;


paramBuilder.Add(new CommandParameter(name, description, type, reader, isOptional, isRemainder, isMultiple, defaultValue));
paramBuilder.Add(new CommandParameter(name, summary, type, reader, isOptional, isRemainder, isMultiple, defaultValue));
} }
return paramBuilder.ToImmutable(); return paramBuilder.ToImmutable();
} }


+ 3
- 3
src/Discord.Net.Commands/CommandParameter.cs View File

@@ -10,17 +10,17 @@ namespace Discord.Commands
private readonly TypeReader _reader; private readonly TypeReader _reader;


public string Name { get; } public string Name { get; }
public string Description { get; }
public string Summary { get; }
public bool IsOptional { get; } public bool IsOptional { get; }
public bool IsRemainder { get; } public bool IsRemainder { get; }
public bool IsMultiple { get; } public bool IsMultiple { get; }
public Type Type { get; } public Type Type { get; }
internal object DefaultValue { get; } internal object DefaultValue { get; }


public CommandParameter(string name, string description, Type type, TypeReader reader, bool isOptional, bool isRemainder, bool isMultiple, object defaultValue)
public CommandParameter(string name, string summary, Type type, TypeReader reader, bool isOptional, bool isRemainder, bool isMultiple, object defaultValue)
{ {
Name = name; Name = name;
Description = description;
Summary = summary;
Type = type; Type = type;
_reader = reader; _reader = reader;
IsOptional = isOptional; IsOptional = isOptional;


+ 2
- 1
src/Discord.Net.Commands/CommandService.cs View File

@@ -16,7 +16,8 @@ namespace Discord.Commands
private readonly ConcurrentDictionary<Type, TypeReader> _typeReaders; private readonly ConcurrentDictionary<Type, TypeReader> _typeReaders;
private readonly CommandMap _map; private readonly CommandMap _map;


public ILookup<Module, Command> Commands => _modules.SelectMany(x => x.Value.Commands).ToLookup(x => x.Module);
public IEnumerable<Module> Modules => _modules.Select(x => x.Value);
public IEnumerable<Command> Commands => _modules.SelectMany(x => x.Value.Commands);


public CommandService() public CommandService()
{ {


Loading…
Cancel
Save