improved how .rh works
This commit is contained in:
parent
8f894e095b
commit
f6bdb98c41
@ -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]
|
||||||
|
@ -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>
|
||||||
|
@ -58,22 +58,25 @@ namespace NadekoBot.Services
|
|||||||
|
|
||||||
public async Task ExecuteExternal(ulong? guildId, ulong channelId, string commandText)
|
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);
|
_log.Warn("Channel for external execution not found.");
|
||||||
var channel = guild?.GetChannel(channelId) as SocketTextChannel;
|
return;
|
||||||
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 { }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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()
|
public Task StartHandling()
|
||||||
|
Loading…
Reference in New Issue
Block a user