improved how .rh works
This commit is contained in:
parent
8f894e095b
commit
f6bdb98c41
@ -218,13 +218,10 @@ namespace NadekoBot.Modules.Administration
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[RequireUserPermission(GuildPermission.ManageRoles)]
|
||||
[RequireBotPermission(GuildPermission.ManageRoles)]
|
||||
public async Task RoleHoist(string roleSearchName, PermissionAction targetState)
|
||||
public async Task RoleHoist(IRole role)
|
||||
{
|
||||
var roleName = roleSearchName.ToUpperInvariant();
|
||||
var role = Context.Guild.Roles.FirstOrDefault(r => r.Name.ToUpperInvariant() == roleName);
|
||||
|
||||
await role.ModifyAsync(r => r.Hoist = targetState.Value).ConfigureAwait(false);
|
||||
await ReplyConfirmLocalized("rh", Format.Bold(role.Name), Format.Bold(targetState.Value.ToString())).ConfigureAwait(false);
|
||||
await role.ModifyAsync(r => r.Hoist = !role.IsHoisted).ConfigureAwait(false);
|
||||
await ReplyConfirmLocalized("rh", Format.Bold(role.Name), Format.Bold(role.IsHoisted.ToString())).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
[NadekoCommand, Usage, Description, Aliases]
|
||||
|
@ -3403,10 +3403,10 @@
|
||||
<value>rolehoist rh</value>
|
||||
</data>
|
||||
<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 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 name="buy_cmd" xml:space="preserve">
|
||||
<value>buy</value>
|
||||
|
@ -63,7 +63,10 @@ namespace NadekoBot.Services
|
||||
var guild = NadekoBot.Client.GetGuild(guildId.Value);
|
||||
var channel = guild?.GetChannel(channelId) as SocketTextChannel;
|
||||
if (channel == null)
|
||||
{
|
||||
_log.Warn("Channel for external execution not found.");
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user