Optional Aliasses, Summary and Remarks Properties to CommandAttribute (#2700)
* add optional remarks, aliases and summary properties to the CommandAttribute * fix inline doc typo * add CommandAttribute Aliasses prop integration * add CommandAttribute Aliasses prop integration * add ctor with new params --------- Co-authored-by: Misha133 <mihagribkov133@gmail.com>
This commit is contained in:
@@ -18,6 +18,30 @@ namespace Discord.Commands
|
||||
public RunMode RunMode { get; set; } = RunMode.Default;
|
||||
public bool? IgnoreExtraArgs { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Attaches a summary to your command.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <see cref="Summary"/> overrides the value of this property if present.
|
||||
/// </remarks>
|
||||
public string Summary { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Marks the aliases for a command.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <see cref="AliasAttribute"/> extends the base value of this if present.
|
||||
/// </remarks>
|
||||
public string[] Aliases { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Attaches remarks to your commands.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <see cref="RemainderAttribute"/> overrides the value of this property if present.
|
||||
/// </remarks>
|
||||
public string Remarks { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public CommandAttribute()
|
||||
{
|
||||
@@ -32,10 +56,20 @@ namespace Discord.Commands
|
||||
{
|
||||
Text = text;
|
||||
}
|
||||
|
||||
public CommandAttribute(string text, bool ignoreExtraArgs)
|
||||
{
|
||||
Text = text;
|
||||
IgnoreExtraArgs = ignoreExtraArgs;
|
||||
}
|
||||
|
||||
public CommandAttribute(string text, bool ignoreExtraArgs, string summary = default, string[] aliases = default, string remarks = default)
|
||||
{
|
||||
Text = text;
|
||||
IgnoreExtraArgs = ignoreExtraArgs;
|
||||
Summary = summary;
|
||||
Aliases = aliases;
|
||||
Remarks = remarks;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -154,6 +154,9 @@ namespace Discord.Commands
|
||||
switch (attribute)
|
||||
{
|
||||
case CommandAttribute command:
|
||||
builder.Summary ??= command.Summary;
|
||||
builder.Remarks ??= command.Remarks;
|
||||
builder.AddAliases(command.Aliases ?? Array.Empty<string>());
|
||||
builder.AddAliases(command.Text);
|
||||
builder.RunMode = command.RunMode;
|
||||
builder.Name ??= command.Text;
|
||||
|
||||
Reference in New Issue
Block a user