Auto adding requirements to help description
This commit is contained in:
parent
b69f416295
commit
19d67e3c2f
@ -484,6 +484,7 @@ namespace NadekoBot.Modules.Administration
|
||||
|
||||
[NadekoCommand, Usage, Description, Aliases]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[RequirePermission(GuildPermission.Administrator)]
|
||||
[OwnerOnly]
|
||||
public async Task LogServer(IUserMessage msg)
|
||||
{
|
||||
@ -507,6 +508,7 @@ namespace NadekoBot.Modules.Administration
|
||||
|
||||
[NadekoCommand, Usage, Description, Aliases]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[RequirePermission(GuildPermission.Administrator)]
|
||||
[OwnerOnly]
|
||||
public async Task LogIgnore(IUserMessage imsg)
|
||||
{
|
||||
@ -602,6 +604,7 @@ namespace NadekoBot.Modules.Administration
|
||||
|
||||
[NadekoCommand, Usage, Description, Aliases]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[RequirePermission(GuildPermission.Administrator)]
|
||||
public async Task UserPresence(IUserMessage imsg)
|
||||
{
|
||||
var channel = (ITextChannel)imsg.Channel;
|
||||
@ -624,6 +627,7 @@ namespace NadekoBot.Modules.Administration
|
||||
|
||||
[NadekoCommand, Usage, Description, Aliases]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[RequirePermission(GuildPermission.Administrator)]
|
||||
public async Task VoicePresence(IUserMessage imsg)
|
||||
{
|
||||
var channel = (ITextChannel)imsg.Channel;
|
||||
|
@ -109,10 +109,25 @@ namespace NadekoBot.Modules.Help
|
||||
if (alias != null)
|
||||
str += $" / `{ alias }`";
|
||||
if (com != null)
|
||||
await channel.SendMessageAsync(str + $@"{Environment.NewLine}**Desc:** {com.Summary}
|
||||
await channel.SendMessageAsync(str + $@"{Environment.NewLine}**Desc:** {com.Summary} {GetCommandRequirements(com)}
|
||||
**Usage:** {com.Remarks}").ConfigureAwait(false);
|
||||
}
|
||||
|
||||
private string GetCommandRequirements(Command cmd)
|
||||
{
|
||||
return String.Join(" ", cmd.Source.CustomAttributes
|
||||
.Where(ca => ca.AttributeType == typeof(OwnerOnlyAttribute) || ca.AttributeType == typeof(RequirePermissionAttribute))
|
||||
.Select(ca =>
|
||||
{
|
||||
if (ca.AttributeType == typeof(OwnerOnlyAttribute))
|
||||
return "**Bot owner only.**";
|
||||
else if (ca.AttributeType == typeof(RequirePermissionAttribute))
|
||||
return $"**Requires {(GuildPermission)ca.ConstructorArguments.FirstOrDefault().Value} server permission.**".Replace("Guild", "Server");
|
||||
else
|
||||
return $"**Requires {(GuildPermission)ca.ConstructorArguments.FirstOrDefault().Value} channel permission.**".Replace("Guild", "Server");
|
||||
}));
|
||||
}
|
||||
|
||||
[NadekoCommand, Usage, Description, Aliases]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[OwnerOnly]
|
||||
|
@ -5802,7 +5802,7 @@ namespace NadekoBot.Resources {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to `.send sid.
|
||||
/// Looks up a localized string similar to `.send sid`.
|
||||
/// </summary>
|
||||
public static string send_usage {
|
||||
get {
|
||||
|
@ -763,7 +763,7 @@
|
||||
<value>Send a message to someone on a different server through the bot. </value>
|
||||
</data>
|
||||
<data name="send_usage" xml:space="preserve">
|
||||
<value>`.send sid</value>
|
||||
<value>`.send sid`</value>
|
||||
</data>
|
||||
<data name="mentionrole_cmd" xml:space="preserve">
|
||||
<value>mentionrole menro</value>
|
||||
|
Loading…
Reference in New Issue
Block a user