improved how .rh works

This commit is contained in:
Master Kwoth 2017-05-03 09:49:35 +02:00
parent 8f894e095b
commit f6bdb98c41
3 changed files with 22 additions and 22 deletions

View File

@ -218,13 +218,10 @@ namespace NadekoBot.Modules.Administration
[RequireContext(ContextType.Guild)] [RequireContext(ContextType.Guild)]
[RequireUserPermission(GuildPermission.ManageRoles)] [RequireUserPermission(GuildPermission.ManageRoles)]
[RequireBotPermission(GuildPermission.ManageRoles)] [RequireBotPermission(GuildPermission.ManageRoles)]
public async Task RoleHoist(string roleSearchName, PermissionAction targetState) public async Task RoleHoist(IRole role)
{ {
var roleName = roleSearchName.ToUpperInvariant(); await role.ModifyAsync(r => r.Hoist = !role.IsHoisted).ConfigureAwait(false);
var role = Context.Guild.Roles.FirstOrDefault(r => r.Name.ToUpperInvariant() == roleName); await ReplyConfirmLocalized("rh", Format.Bold(role.Name), Format.Bold(role.IsHoisted.ToString())).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] [NadekoCommand, Usage, Description, Aliases]

View File

@ -3403,10 +3403,10 @@
<value>rolehoist rh</value> <value>rolehoist rh</value>
</data> </data>
<data name="rolehoist_desc" xml:space="preserve"> <data name="rolehoist_desc" xml:space="preserve">
<value>Toggles if this role is displayed in the sidebar or not</value> <value>Toggles whether this role is displayed in the sidebar or not.</value>
</data> </data>
<data name="rolehoist_usage" xml:space="preserve"> <data name="rolehoist_usage" xml:space="preserve">
<value>`{0}rh Guests true` or `{0}rh "Space Wizards" true</value> <value>`{0}rh Guests` or `{0}rh "Space Wizards"</value>
</data> </data>
<data name="buy_cmd" xml:space="preserve"> <data name="buy_cmd" xml:space="preserve">
<value>buy</value> <value>buy</value>

View File

@ -63,7 +63,10 @@ namespace NadekoBot.Services
var guild = NadekoBot.Client.GetGuild(guildId.Value); var guild = NadekoBot.Client.GetGuild(guildId.Value);
var channel = guild?.GetChannel(channelId) as SocketTextChannel; var channel = guild?.GetChannel(channelId) as SocketTextChannel;
if (channel == null) if (channel == null)
{
_log.Warn("Channel for external execution not found.");
return; return;
}
try try
{ {