;cm defaults to current channel
This commit is contained in:
parent
4e249533b0
commit
234a94e5fc
@ -372,12 +372,12 @@ namespace NadekoBot.Modules.Permissions
|
||||
.Description("Sets a module's permission at the channel level.\n**Usage**: ;cm [module_name] enable [channel_name]")
|
||||
.Do(async e =>
|
||||
{
|
||||
try
|
||||
try
|
||||
{
|
||||
var module = PermissionHelper.ValidateModule(e.GetArg("module"));
|
||||
var state = PermissionHelper.ValidateBool(e.GetArg("bool"));
|
||||
|
||||
if (e.GetArg("channel")?.ToLower() == "all")
|
||||
var channelArg = e.GetArg("channel");
|
||||
if (channelArg?.ToLower() == "all")
|
||||
{
|
||||
foreach (var channel in e.Server.TextChannels)
|
||||
{
|
||||
@ -385,9 +385,14 @@ namespace NadekoBot.Modules.Permissions
|
||||
}
|
||||
await e.Channel.SendMessage($"Module **{module}** has been **{(state ? "enabled" : "disabled")}** on **ALL** channels.").ConfigureAwait(false);
|
||||
}
|
||||
else
|
||||
else if (string.IsNullOrWhiteSpace(channelArg))
|
||||
{
|
||||
var channel = PermissionHelper.ValidateChannel(e.Server, e.GetArg("channel"));
|
||||
PermissionsHandler.SetChannelModulePermission(e.Channel, module, state);
|
||||
await e.Channel.SendMessage($"Module **{module}** has been **{(state ? "enabled" : "disabled")}** for **{e.Channel.Name}** channel.").ConfigureAwait(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
var channel = PermissionHelper.ValidateChannel(e.Server, channelArg);
|
||||
|
||||
PermissionsHandler.SetChannelModulePermission(channel, module, state);
|
||||
await e.Channel.SendMessage($"Module **{module}** has been **{(state ? "enabled" : "disabled")}** for **{channel.Name}** channel.").ConfigureAwait(false);
|
||||
|
Loading…
Reference in New Issue
Block a user