Merge pull request #163 from RogueException/khio-patch

Added `Command.Synopsis`
This commit is contained in:
Khionu Terabite
2016-07-30 18:16:10 -04:00
committed by GitHub
2 changed files with 15 additions and 0 deletions

View File

@@ -11,4 +11,14 @@ namespace Discord.Commands
Text = text;
}
}
[AttributeUsage(AttributeTargets.Method)]
public class SynopsisAttribute : Attribute
{
public string Text { get; }
public SynopsisAttribute(string text)
{
Text = text;
}
}
}

View File

@@ -15,6 +15,7 @@ namespace Discord.Commands
public string Name { get; }
public string Description { get; }
public string Synopsis { get; }
public string Text { get; }
public Module Module { get; }
public IReadOnlyList<CommandParameter> Parameters { get; }
@@ -31,6 +32,10 @@ namespace Discord.Commands
if (description != null)
Description = description.Text;
var synopsis = methodInfo.GetCustomAttribute<SynopsisAttribute>();
if (synopsis != null)
Synopsis = synopsis.Text;
Parameters = BuildParameters(methodInfo);
_action = BuildAction(methodInfo);
}