From 846a1746a2b26c07874bc40309513fe4ba5a2b87 Mon Sep 17 00:00:00 2001 From: Khionu Terabite Date: Sat, 30 Jul 2016 18:09:38 -0400 Subject: [PATCH] Added `Command.Synopsis` for seperation of short and long descriptions, this being intended for long. --- .../Attributes/DescriptionAttribute.cs | 10 ++++++++++ src/Discord.Net.Commands/Command.cs | 5 +++++ 2 files changed, 15 insertions(+) diff --git a/src/Discord.Net.Commands/Attributes/DescriptionAttribute.cs b/src/Discord.Net.Commands/Attributes/DescriptionAttribute.cs index 736e9720b..db9c57057 100644 --- a/src/Discord.Net.Commands/Attributes/DescriptionAttribute.cs +++ b/src/Discord.Net.Commands/Attributes/DescriptionAttribute.cs @@ -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; + } + } } diff --git a/src/Discord.Net.Commands/Command.cs b/src/Discord.Net.Commands/Command.cs index cdbdb1080..f62d6c928 100644 --- a/src/Discord.Net.Commands/Command.cs +++ b/src/Discord.Net.Commands/Command.cs @@ -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 Parameters { get; } @@ -31,6 +32,10 @@ namespace Discord.Commands if (description != null) Description = description.Text; + var synopsis = methodInfo.GetCustomAttribute(); + if (synopsis != null) + Synopsis = synopsis.Text; + Parameters = BuildParameters(methodInfo); _action = BuildAction(methodInfo); }