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>
|
||||
|
@ -58,22 +58,25 @@ namespace NadekoBot.Services
|
||||
|
||||
public async Task ExecuteExternal(ulong? guildId, ulong channelId, string commandText)
|
||||
{
|
||||
if (guildId != null)
|
||||
if (guildId != null)
|
||||
{
|
||||
var guild = NadekoBot.Client.GetGuild(guildId.Value);
|
||||
var channel = guild?.GetChannel(channelId) as SocketTextChannel;
|
||||
if (channel == null)
|
||||
{
|
||||
var guild = NadekoBot.Client.GetGuild(guildId.Value);
|
||||
var channel = guild?.GetChannel(channelId) as SocketTextChannel;
|
||||
if (channel == null)
|
||||
return;
|
||||
|
||||
try
|
||||
{
|
||||
IUserMessage msg = await channel.SendMessageAsync(commandText).ConfigureAwait(false);
|
||||
msg = (IUserMessage)await channel.GetMessageAsync(msg.Id).ConfigureAwait(false);
|
||||
await TryRunCommand(guild, channel, msg).ConfigureAwait(false);
|
||||
//msg.DeleteAfter(5);
|
||||
}
|
||||
catch { }
|
||||
_log.Warn("Channel for external execution not found.");
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
IUserMessage msg = await channel.SendMessageAsync(commandText).ConfigureAwait(false);
|
||||
msg = (IUserMessage)await channel.GetMessageAsync(msg.Id).ConfigureAwait(false);
|
||||
await TryRunCommand(guild, channel, msg).ConfigureAwait(false);
|
||||
//msg.DeleteAfter(5);
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
}
|
||||
|
||||
public Task StartHandling()
|
||||
|
Loading…
Reference in New Issue
Block a user