NadekoBot/NadekoBot.Core/Common/Attributes/Usage.cs

25 lines
609 B
C#
Raw Normal View History

2017-07-17 19:42:36 +00:00
using System.Runtime.CompilerServices;
using Discord.Commands;
using NadekoBot.Core.Services.Impl;
2017-09-18 07:24:42 +00:00
using System.Linq;
using Discord;
2017-07-17 19:42:36 +00:00
namespace NadekoBot.Common.Attributes
{
public class Usage : RemarksAttribute
{
2017-09-18 07:24:42 +00:00
public Usage([CallerMemberName] string memberName="") : base(Usage.GetUsage(memberName))
{
}
2017-09-18 07:24:42 +00:00
public static string GetUsage(string memberName)
{
var usage = Localization.LoadCommand(memberName.ToLowerInvariant()).Usage;
return string.Join(" or ", usage
.Select(x => Format.Code(x)));
}
}
}