Merge pull request #163 from RogueException/khio-patch
Added `Command.Synopsis`
This commit is contained in:
@@ -11,4 +11,14 @@ namespace Discord.Commands
|
|||||||
Text = text;
|
Text = text;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[AttributeUsage(AttributeTargets.Method)]
|
||||||
|
public class SynopsisAttribute : Attribute
|
||||||
|
{
|
||||||
|
public string Text { get; }
|
||||||
|
public SynopsisAttribute(string text)
|
||||||
|
{
|
||||||
|
Text = text;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ namespace Discord.Commands
|
|||||||
|
|
||||||
public string Name { get; }
|
public string Name { get; }
|
||||||
public string Description { get; }
|
public string Description { get; }
|
||||||
|
public string Synopsis { get; }
|
||||||
public string Text { get; }
|
public string Text { get; }
|
||||||
public Module Module { get; }
|
public Module Module { get; }
|
||||||
public IReadOnlyList<CommandParameter> Parameters { get; }
|
public IReadOnlyList<CommandParameter> Parameters { get; }
|
||||||
@@ -31,6 +32,10 @@ namespace Discord.Commands
|
|||||||
if (description != null)
|
if (description != null)
|
||||||
Description = description.Text;
|
Description = description.Text;
|
||||||
|
|
||||||
|
var synopsis = methodInfo.GetCustomAttribute<SynopsisAttribute>();
|
||||||
|
if (synopsis != null)
|
||||||
|
Synopsis = synopsis.Text;
|
||||||
|
|
||||||
Parameters = BuildParameters(methodInfo);
|
Parameters = BuildParameters(methodInfo);
|
||||||
_action = BuildAction(methodInfo);
|
_action = BuildAction(methodInfo);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user