Browse Source

Fix Synopsis/Description mix-up

tags/1.0-rc
Finite Reality 9 years ago
parent
commit
47089448dd
2 changed files with 9 additions and 4 deletions
  1. +4
    -4
      src/Discord.Net.Commands/Attributes/DescriptionAttribute.cs
  2. +5
    -0
      src/Discord.Net.Commands/Module.cs

+ 4
- 4
src/Discord.Net.Commands/Attributes/DescriptionAttribute.cs View File

@@ -2,8 +2,8 @@


namespace Discord.Commands namespace Discord.Commands
{ {
// Full summary of method/parameter
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Parameter)]
// Full summary of method
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class)]
public class DescriptionAttribute : Attribute public class DescriptionAttribute : Attribute
{ {
public string Text { get; } public string Text { get; }
@@ -13,8 +13,8 @@ namespace Discord.Commands
} }
} }


// Brief summary of method/module
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class)]
// Brief summary of method/module/parameter
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class | AttributeTargets.Parameter)]
public class SynopsisAttribute : Attribute public class SynopsisAttribute : Attribute
{ {
public string Text { get; } public string Text { get; }


+ 5
- 0
src/Discord.Net.Commands/Module.cs View File

@@ -10,6 +10,7 @@ namespace Discord.Commands
public CommandService Service { get; } public CommandService Service { get; }
public string Name { get; } public string Name { get; }
public string Synopsis { get; } public string Synopsis { get; }
public string Description { get; }
public IEnumerable<Command> Commands { get; } public IEnumerable<Command> Commands { get; }
internal object Instance { get; } internal object Instance { get; }


@@ -23,6 +24,10 @@ namespace Discord.Commands
if (synopsisAttr != null) if (synopsisAttr != null)
Synopsis = synopsisAttr.Text; Synopsis = synopsisAttr.Text;


var descriptionAttr = typeInfo.GetCustomAttribute<DescriptionAttribute>();
if (descriptionAttr != null)
Description = descriptionAttr.Text;

List<Command> commands = new List<Command>(); List<Command> commands = new List<Command>();
SearchClass(instance, commands, typeInfo, moduleAttr.Prefix ?? ""); SearchClass(instance, commands, typeInfo, moduleAttr.Prefix ?? "");
Commands = commands; Commands = commands;


Loading…
Cancel
Save