Skip to content

Commit

Permalink
add optional remarks, aliases and summary properties to the CommandAt…
Browse files Browse the repository at this point in the history
…tribute
  • Loading branch information
Cenngo committed Jun 9, 2023
1 parent 277c7af commit 3a8f405
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/Discord.Net.Commands/Attributes/CommandAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,30 @@ public class CommandAttribute : Attribute
public RunMode RunMode { get; set; } = RunMode.Default;
public bool? IgnoreExtraArgs { get; }

/// <summary>
/// Attaches a summary to your command.
/// </summary>
/// <remarks>
/// <see cref="Summay"/> overrides the value of this property if present.
/// </remarks>
public string Summay { get; set; }

This comment has been minimized.

Copy link
@Misha-133

Misha-133 Jun 9, 2023

Member

Summay

typo?

This comment has been minimized.

Copy link
@Cenngo

Cenngo Jun 13, 2023

Author Collaborator

yep, thanks


/// <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()
{
Expand Down
2 changes: 2 additions & 0 deletions src/Discord.Net.Commands/Builders/ModuleClassBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,8 @@ private static void BuildCommand(CommandBuilder builder, TypeInfo typeInfo, Meth
switch (attribute)
{
case CommandAttribute command:
builder.Summary ??= command.Summay;
builder.Remarks ??= command.Remarks;
builder.AddAliases(command.Text);
builder.RunMode = command.RunMode;
builder.Name ??= command.Text;
Expand Down

0 comments on commit 3a8f405

Please sign in to comment.