2017-07-17 19:42:36 +00:00
|
|
|
|
using System.Runtime.CompilerServices;
|
|
|
|
|
using Discord.Commands;
|
|
|
|
|
using NadekoBot.Services.Impl;
|
2017-09-18 07:24:42 +00:00
|
|
|
|
using System.Linq;
|
|
|
|
|
using Discord;
|
2016-10-05 03:09:44 +00:00
|
|
|
|
|
2017-07-17 19:42:36 +00:00
|
|
|
|
namespace NadekoBot.Common.Attributes
|
2016-10-05 03:09:44 +00:00
|
|
|
|
{
|
|
|
|
|
public class Usage : RemarksAttribute
|
|
|
|
|
{
|
2017-09-18 07:24:42 +00:00
|
|
|
|
public Usage([CallerMemberName] string memberName="") : base(Usage.GetUsage(memberName))
|
2016-10-05 03:09:44 +00:00
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
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)));
|
|
|
|
|
|
|
|
|
|
}
|
2016-10-05 03:09:44 +00:00
|
|
|
|
}
|
|
|
|
|
}
|