NadekoBot/NadekoBot.Core/Common/Attributes/Usage.cs
2017-09-30 00:46:33 +02:00

25 lines
604 B
C#

using System.Runtime.CompilerServices;
using Discord.Commands;
using NadekoBot.Services.Impl;
using System.Linq;
using Discord;
namespace NadekoBot.Common.Attributes
{
public class Usage : RemarksAttribute
{
public Usage([CallerMemberName] string memberName="") : base(Usage.GetUsage(memberName))
{
}
public static string GetUsage(string memberName)
{
var usage = Localization.LoadCommand(memberName.ToLowerInvariant()).Usage;
return string.Join(" or ", usage
.Select(x => Format.Code(x)));
}
}
}