Skip to content

Commit

Permalink
Merge pull request #14 from foldingcash/dev
Browse files Browse the repository at this point in the history
show text on usage command for additional attributes for UX
  • Loading branch information
StrungSafe authored Aug 5, 2024
2 parents 732c118 + ecdc6c5 commit 4af9e74
Showing 1 changed file with 19 additions and 5 deletions.
24 changes: 19 additions & 5 deletions DiscordBot/DiscordBot.Core/BaseModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,7 @@ private string Usage(SocketCommandContext context)
command.Attributes.FirstOrDefault(attribute => attribute is UsageAttribute) as UsageAttribute;

builder.Append("\t");

if(botConfigurationService.DisabledCommandsContains(command.Name))
{
builder.Append("(Disabled) ");
}
AppendAttributeText(command, builder);

if (usageAttribute is default(UsageAttribute))
{
Expand All @@ -153,5 +149,23 @@ private string Usage(SocketCommandContext context)

return builder.ToString();
}

private void AppendAttributeText(CommandInfo command, StringBuilder builder)
{
if (botConfigurationService.DisabledCommandsContains(command.Name))
{
builder.Append("(Disabled) ");
}

if (command.Attributes.Any(attribute => attribute is HiddenAttribute))
{
builder.Append("(Hidden) ");
}

if (command.Attributes.Any(attribute => attribute is AdminOnlyAttribute))
{
builder.Append("(Admin) ");
}
}
}
}

0 comments on commit 4af9e74

Please sign in to comment.