Browse Source

Merge pull request #275 from RogueException/issue/239

[breaking] Rename Cosmetic Command Attributes (Description/Summary) to Summary/Remarks (Short Description, Full Description)
tags/1.0-rc
Christopher F GitHub 8 years ago
parent
commit
32c5a4b2f9
4 changed files with 13 additions and 13 deletions
  1. +3
    -3
      src/Discord.Net.Commands/Attributes/RemarksAttribute.cs
  2. +1
    -1
      src/Discord.Net.Commands/Attributes/SummaryAttribute.cs
  3. +5
    -5
      src/Discord.Net.Commands/Command.cs
  4. +4
    -4
      src/Discord.Net.Commands/Module.cs

src/Discord.Net.Commands/Attributes/DescriptionAttribute.cs → src/Discord.Net.Commands/Attributes/RemarksAttribute.cs View File

@@ -2,13 +2,13 @@

namespace Discord.Commands
{
// Full summary of method
// Extension of the Cosmetic Summary, for Groups, Commands, and Parameters
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class)]
public class DescriptionAttribute : Attribute
public class RemarksAttribute : Attribute
{
public string Text { get; }

public DescriptionAttribute(string text)
public RemarksAttribute(string text)
{
Text = text;
}

+ 1
- 1
src/Discord.Net.Commands/Attributes/SummaryAttribute.cs View File

@@ -2,7 +2,7 @@

namespace Discord.Commands
{
// Brief summary of method/module/parameter
// Cosmetic Summary, for Groups and Commands
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class | AttributeTargets.Parameter)]
public class SummaryAttribute : Attribute
{


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

@@ -21,8 +21,8 @@ namespace Discord.Commands
public MethodInfo Source { get; }
public Module Module { get; }
public string Name { get; }
public string Description { get; }
public string Summary { get; }
public string Remarks { get; }
public string Text { get; }
public bool HasVarArgs { get; }
public IReadOnlyList<string> Aliases { get; }
@@ -62,14 +62,14 @@ namespace Discord.Commands
if (nameAttr != null)
Name = nameAttr.Text;

var description = source.GetCustomAttribute<DescriptionAttribute>();
if (description != null)
Description = description.Text;

var summary = source.GetCustomAttribute<SummaryAttribute>();
if (summary != null)
Summary = summary.Text;

var remarksAttr = source.GetCustomAttribute<RemarksAttribute>();
if (remarksAttr != null)
Remarks = remarksAttr.Text;

Parameters = BuildParameters(source);
HasVarArgs = Parameters.Count > 0 ? Parameters[Parameters.Count - 1].IsMultiple : false;
Preconditions = BuildPreconditions(source);


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

@@ -13,7 +13,7 @@ namespace Discord.Commands
public string Name { get; }
public string Prefix { get; }
public string Summary { get; }
public string Description { get; }
public string Remarks { get; }
public IEnumerable<Command> Commands { get; }
internal object Instance { get; }

@@ -35,9 +35,9 @@ namespace Discord.Commands
if (summaryAttr != null)
Summary = summaryAttr.Text;

var descriptionAttr = source.GetCustomAttribute<DescriptionAttribute>();
if (descriptionAttr != null)
Description = descriptionAttr.Text;
var remarksAttr = source.GetCustomAttribute<RemarksAttribute>();
if (remarksAttr != null)
Remarks = remarksAttr.Text;

List<Command> commands = new List<Command>();
SearchClass(source, instance, commands, Prefix, dependencyMap);


Loading…
Cancel
Save