Adds response to .rh / .rolehoist

Also swaps to PermissionAction from bool
This commit is contained in:
snippet 2017-04-05 23:30:29 +10:00
parent 2869a60d6c
commit 80cb6e86c4
3 changed files with 16 additions and 2 deletions

View File

@ -12,6 +12,7 @@ using NadekoBot.Services.Database.Models;
using static NadekoBot.Modules.Permissions.Permissions;
using System.Collections.Concurrent;
using NLog;
using NadekoBot.Modules.Permissions;
namespace NadekoBot.Modules.Administration
{
@ -200,12 +201,13 @@ namespace NadekoBot.Modules.Administration
[RequireContext(ContextType.Guild)]
[RequireUserPermission(GuildPermission.ManageRoles)]
[RequireBotPermission(GuildPermission.ManageRoles)]
public async Task RoleHoist(string roleSearchName, bool targetState)
public async Task RoleHoist(string roleSearchName, PermissionAction targetState)
{
var roleName = roleSearchName.ToUpperInvariant();
var role = Context.Guild.Roles.FirstOrDefault(r => r.Name.ToUpperInvariant() == roleName);
await role.ModifyAsync(r => r.Hoist = targetState).ConfigureAwait(false);
await role.ModifyAsync(r => r.Hoist = targetState.Value).ConfigureAwait(false);
await ReplyConfirmLocalized("rh", Format.Bold(role.Name), Format.Bold(targetState.Value.ToString())).ConfigureAwait(false);
}
[NadekoCommand, Usage, Description, Aliases]

View File

@ -1168,6 +1168,15 @@ namespace NadekoBot.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Set the display of guild role {0} to {1}..
/// </summary>
public static string administration_rh {
get {
return ResourceManager.GetString("administration_rh", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Role {0} as been added to the list..
/// </summary>

View File

@ -2406,4 +2406,7 @@ Owner ID: {2}</value>
<value>Time in {0} is {1} - {2}</value>
<comment>Time in London, UK is 15:30 - Time Zone Name</comment>
</data>
<data name="administration_rh" xml:space="preserve">
<value>Set the display of guild role {0} to {1}.</value>
</data>
</root>