conversations and customreactions have old formating. Help command improvement done.

This commit is contained in:
Master Kwoth 2016-06-18 05:27:38 +02:00
parent d3d1781584
commit 485ee3108a
4 changed files with 49 additions and 42 deletions

View File

@ -41,8 +41,11 @@ namespace NadekoBot.Modules.Help
.Parameter("module", ParameterType.Unparsed) .Parameter("module", ParameterType.Unparsed)
.Do(async e => .Do(async e =>
{ {
var module = e.GetArg("module")?.Trim().ToLower();
if (string.IsNullOrWhiteSpace(module))
return;
var cmds = NadekoBot.Client.GetService<CommandService>().AllCommands var cmds = NadekoBot.Client.GetService<CommandService>().AllCommands
.Where(c => c.Category.ToLower() == e.GetArg("module").Trim().ToLower()); .Where(c => c.Category.ToLower() == module);
var cmdsArray = cmds as Command[] ?? cmds.ToArray(); var cmdsArray = cmds as Command[] ?? cmds.ToArray();
if (!cmdsArray.Any()) if (!cmdsArray.Any())
{ {
@ -50,11 +53,14 @@ namespace NadekoBot.Modules.Help
return; return;
} }
var i = 0; var i = 0;
await e.Channel.SendMessage("`List Of Commands:`\n```xl\n" + if (module != "customreactions" && module != "conversations")
string.Join("\n", cmdsArray.GroupBy(item => (i++) / 3) await e.Channel.SendMessage("`List Of Commands:`\n```xl\n" +
.Select(ig => string.Join("", ig.Select(el => $"{el.Text,-15}" + $"{"[" + el.Aliases.FirstOrDefault() + "]",-8}")))) string.Join("\n", cmdsArray.GroupBy(item => (i++) / 3)
+ $"\n```") .Select(ig => string.Join("", ig.Select(el => $"{el.Text,-15}" + $"{"[" + el.Aliases.FirstOrDefault() + "]",-8}"))))
.ConfigureAwait(false); + $"\n```")
.ConfigureAwait(false);
else
await e.Channel.SendMessage("`List Of Commands:`\n• " + string.Join("\n• ", cmdsArray.Select(c => $"{c.Text}")));
await e.Channel.SendMessage($"`You can type \"{Prefix}h command_name\" to see the help about that specific command.`").ConfigureAwait(false); await e.Channel.SendMessage($"`You can type \"{Prefix}h command_name\" to see the help about that specific command.`").ConfigureAwait(false);
}); });
}); });

View File

@ -51,8 +51,8 @@ namespace NadekoBot.Modules.Permissions.Commands
internal override void Init(CommandGroupBuilder cgb) internal override void Init(CommandGroupBuilder cgb)
{ {
cgb.CreateCommand(Module.Prefix + "cfi") cgb.CreateCommand(Module.Prefix + "chnlfilterinv")
.Alias(Module.Prefix + "channelfilterinvites") .Alias(Module.Prefix + "cfi")
.Description("Enables or disables automatic deleting of invites on the channel." + .Description("Enables or disables automatic deleting of invites on the channel." +
"If no channel supplied, it will default to current one. Use ALL to apply to all existing channels at once." + "If no channel supplied, it will default to current one. Use ALL to apply to all existing channels at once." +
"\n**Usage**: ;cfi enable #general-chat") "\n**Usage**: ;cfi enable #general-chat")
@ -93,8 +93,8 @@ namespace NadekoBot.Modules.Permissions.Commands
} }
}); });
cgb.CreateCommand(Module.Prefix + "sfi") cgb.CreateCommand(Module.Prefix + "srvrfilterinv")
.Alias(Module.Prefix + "serverfilterinvites") .Alias(Module.Prefix + "sfi")
.Description("Enables or disables automatic deleting of invites on the server.\n**Usage**: ;sfi disable") .Description("Enables or disables automatic deleting of invites on the server.\n**Usage**: ;sfi disable")
.Parameter("bool") .Parameter("bool")
.Do(async e => .Do(async e =>

View File

@ -49,8 +49,8 @@ namespace NadekoBot.Modules.Permissions.Commands
internal override void Init(CommandGroupBuilder cgb) internal override void Init(CommandGroupBuilder cgb)
{ {
cgb.CreateCommand(Module.Prefix + "cfw") cgb.CreateCommand(Module.Prefix + "chnlfilterwords")
.Alias(Module.Prefix + "channelfilterwords") .Alias(Module.Prefix + "cfw")
.Description("Enables or disables automatic deleting of messages containing banned words on the channel." + .Description("Enables or disables automatic deleting of messages containing banned words on the channel." +
"If no channel supplied, it will default to current one. Use ALL to apply to all existing channels at once." + "If no channel supplied, it will default to current one. Use ALL to apply to all existing channels at once." +
"\n**Usage**: ;cfw enable #general-chat") "\n**Usage**: ;cfw enable #general-chat")
@ -86,8 +86,8 @@ namespace NadekoBot.Modules.Permissions.Commands
} }
}); });
cgb.CreateCommand(Module.Prefix + "afw") cgb.CreateCommand(Module.Prefix + "addfilterword")
.Alias(Module.Prefix + "addfilteredword") .Alias(Module.Prefix + "afw")
.Description("Adds a new word to the list of filtered words" + .Description("Adds a new word to the list of filtered words" +
"\n**Usage**: ;afw poop") "\n**Usage**: ;afw poop")
.Parameter("word", ParameterType.Unparsed) .Parameter("word", ParameterType.Unparsed)
@ -108,8 +108,8 @@ namespace NadekoBot.Modules.Permissions.Commands
} }
}); });
cgb.CreateCommand(Module.Prefix + "rfw") cgb.CreateCommand(Module.Prefix + "rmvfilterword")
.Alias(Module.Prefix + "removefilteredword") .Alias(Module.Prefix + "rfw")
.Description("Removes the word from the list of filtered words" + .Description("Removes the word from the list of filtered words" +
"\n**Usage**: ;rw poop") "\n**Usage**: ;rw poop")
.Parameter("word", ParameterType.Unparsed) .Parameter("word", ParameterType.Unparsed)
@ -130,8 +130,8 @@ namespace NadekoBot.Modules.Permissions.Commands
} }
}); });
cgb.CreateCommand(Module.Prefix + "lfw") cgb.CreateCommand(Module.Prefix + "lstfilterwords")
.Alias(Module.Prefix + "listfilteredwords") .Alias(Module.Prefix + "lfw")
.Description("Shows a list of filtered words" + .Description("Shows a list of filtered words" +
"\n**Usage**: ;lfw") "\n**Usage**: ;lfw")
.Do(async e => .Do(async e =>
@ -150,8 +150,8 @@ namespace NadekoBot.Modules.Permissions.Commands
} }
}); });
cgb.CreateCommand(Module.Prefix + "sfw") cgb.CreateCommand(Module.Prefix + "srvrfilterwords")
.Alias(Module.Prefix + "serverfilterwords") .Alias(Module.Prefix + "sfw")
.Description("Enables or disables automatic deleting of messages containing forbidden words on the server.\n**Usage**: ;sfw disable") .Description("Enables or disables automatic deleting of messages containing forbidden words on the server.\n**Usage**: ;sfw disable")
.Parameter("bool") .Parameter("bool")
.Do(async e => .Do(async e =>

View File

@ -58,8 +58,8 @@ namespace NadekoBot.Modules.Permissions
await e.Channel.SendMessage($"Role `{role.Name}` is now required in order to change permissions.").ConfigureAwait(false); await e.Channel.SendMessage($"Role `{role.Name}` is now required in order to change permissions.").ConfigureAwait(false);
}); });
cgb.CreateCommand(Prefix + "rpc") cgb.CreateCommand(Prefix + "rolepermscopy")
.Alias(Prefix + "rolepermissionscopy") .Alias(Prefix + "rpc")
.Description($"Copies BOT PERMISSIONS (not discord permissions) from one role to another.\n**Usage**:`{Prefix}rpc Some Role ~ Some other role`") .Description($"Copies BOT PERMISSIONS (not discord permissions) from one role to another.\n**Usage**:`{Prefix}rpc Some Role ~ Some other role`")
.Parameter("from_to", ParameterType.Unparsed) .Parameter("from_to", ParameterType.Unparsed)
.Do(async e => .Do(async e =>
@ -86,8 +86,8 @@ namespace NadekoBot.Modules.Permissions
await e.Channel.SendMessage($"💢{ex.Message}"); await e.Channel.SendMessage($"💢{ex.Message}");
} }
}); });
cgb.CreateCommand(Prefix + "cpc") cgb.CreateCommand(Prefix + "chnlpermscopy")
.Alias(Prefix + "channelpermissionscopy") .Alias(Prefix + "cpc")
.Description($"Copies BOT PERMISSIONS (not discord permissions) from one channel to another.\n**Usage**:`{Prefix}cpc Some Channel ~ Some other channel`") .Description($"Copies BOT PERMISSIONS (not discord permissions) from one channel to another.\n**Usage**:`{Prefix}cpc Some Channel ~ Some other channel`")
.Parameter("from_to", ParameterType.Unparsed) .Parameter("from_to", ParameterType.Unparsed)
.Do(async e => .Do(async e =>
@ -114,8 +114,8 @@ namespace NadekoBot.Modules.Permissions
await e.Channel.SendMessage($"💢{ex.Message}"); await e.Channel.SendMessage($"💢{ex.Message}");
} }
}); });
cgb.CreateCommand(Prefix + "upc") cgb.CreateCommand(Prefix + "usrpermscopy")
.Alias(Prefix + "userpermissionscopy") .Alias(Prefix + "upc")
.Description($"Copies BOT PERMISSIONS (not discord permissions) from one role to another.\n**Usage**:`{Prefix}upc @SomeUser ~ @SomeOtherUser`") .Description($"Copies BOT PERMISSIONS (not discord permissions) from one role to another.\n**Usage**:`{Prefix}upc @SomeUser ~ @SomeOtherUser`")
.Parameter("from_to", ParameterType.Unparsed) .Parameter("from_to", ParameterType.Unparsed)
.Do(async e => .Do(async e =>
@ -155,7 +155,7 @@ namespace NadekoBot.Modules.Permissions
await e.Channel.SendMessage($"Verbosity set to {val}.").ConfigureAwait(false); await e.Channel.SendMessage($"Verbosity set to {val}.").ConfigureAwait(false);
}); });
cgb.CreateCommand(Prefix + "serverperms") cgb.CreateCommand(Prefix + "srvrperms")
.Alias(Prefix + "sp") .Alias(Prefix + "sp")
.Description("Shows banned permissions for this server.") .Description("Shows banned permissions for this server.")
.Do(async e => .Do(async e =>
@ -192,7 +192,7 @@ namespace NadekoBot.Modules.Permissions
await e.Channel.SendMessage(perms.ToString()).ConfigureAwait(false); await e.Channel.SendMessage(perms.ToString()).ConfigureAwait(false);
}); });
cgb.CreateCommand(Prefix + "channelperms") cgb.CreateCommand(Prefix + "chnlperms")
.Alias(Prefix + "cp") .Alias(Prefix + "cp")
.Description("Shows banned permissions for a certain channel. No argument means for this channel.\n**Usage**: ;cp #dev") .Description("Shows banned permissions for a certain channel. No argument means for this channel.\n**Usage**: ;cp #dev")
.Parameter("channel", ParameterType.Unparsed) .Parameter("channel", ParameterType.Unparsed)
@ -241,7 +241,8 @@ namespace NadekoBot.Modules.Permissions
await e.Channel.SendMessage(perms.ToString()).ConfigureAwait(false); await e.Channel.SendMessage(perms.ToString()).ConfigureAwait(false);
}); });
cgb.CreateCommand(Prefix + "sm").Alias(Prefix + "servermodule") cgb.CreateCommand(Prefix + "srvrmdl")
.Alias(Prefix + "sm")
.Parameter("module", ParameterType.Required) .Parameter("module", ParameterType.Required)
.Parameter("bool", ParameterType.Required) .Parameter("bool", ParameterType.Required)
.Description("Sets a module's permission at the server level.\n**Usage**: ;sm [module_name] enable") .Description("Sets a module's permission at the server level.\n**Usage**: ;sm [module_name] enable")
@ -265,7 +266,7 @@ namespace NadekoBot.Modules.Permissions
} }
}); });
cgb.CreateCommand(Prefix + "sc").Alias(Prefix + "servercommand") cgb.CreateCommand(Prefix + "srvrcmd").Alias(Prefix + "sc")
.Parameter("command", ParameterType.Required) .Parameter("command", ParameterType.Required)
.Parameter("bool", ParameterType.Required) .Parameter("bool", ParameterType.Required)
.Description("Sets a command's permission at the server level.\n**Usage**: ;sc [command_name] disable") .Description("Sets a command's permission at the server level.\n**Usage**: ;sc [command_name] disable")
@ -289,7 +290,7 @@ namespace NadekoBot.Modules.Permissions
} }
}); });
cgb.CreateCommand(Prefix + "rm").Alias(Prefix + "rolemodule") cgb.CreateCommand(Prefix + "rolemdl").Alias(Prefix + "rm")
.Parameter("module", ParameterType.Required) .Parameter("module", ParameterType.Required)
.Parameter("bool", ParameterType.Required) .Parameter("bool", ParameterType.Required)
.Parameter("role", ParameterType.Unparsed) .Parameter("role", ParameterType.Unparsed)
@ -327,7 +328,7 @@ namespace NadekoBot.Modules.Permissions
} }
}); });
cgb.CreateCommand(Prefix + "rc").Alias(Prefix + "rolecommand") cgb.CreateCommand(Prefix + "rolecmd").Alias(Prefix + "rc")
.Parameter("command", ParameterType.Required) .Parameter("command", ParameterType.Required)
.Parameter("bool", ParameterType.Required) .Parameter("bool", ParameterType.Required)
.Parameter("role", ParameterType.Unparsed) .Parameter("role", ParameterType.Unparsed)
@ -365,7 +366,7 @@ namespace NadekoBot.Modules.Permissions
} }
}); });
cgb.CreateCommand(Prefix + "cm").Alias(Prefix + "channelmodule") cgb.CreateCommand(Prefix + "chnlmdl").Alias(Prefix + "cm")
.Parameter("module", ParameterType.Required) .Parameter("module", ParameterType.Required)
.Parameter("bool", ParameterType.Required) .Parameter("bool", ParameterType.Required)
.Parameter("channel", ParameterType.Unparsed) .Parameter("channel", ParameterType.Unparsed)
@ -408,7 +409,7 @@ namespace NadekoBot.Modules.Permissions
} }
}); });
cgb.CreateCommand(Prefix + "cc").Alias(Prefix + "channelcommand") cgb.CreateCommand(Prefix + "chnlcmd").Alias(Prefix + "cc")
.Parameter("command", ParameterType.Required) .Parameter("command", ParameterType.Required)
.Parameter("bool", ParameterType.Required) .Parameter("bool", ParameterType.Required)
.Parameter("channel", ParameterType.Unparsed) .Parameter("channel", ParameterType.Unparsed)
@ -446,7 +447,7 @@ namespace NadekoBot.Modules.Permissions
} }
}); });
cgb.CreateCommand(Prefix + "um").Alias(Prefix + "usermodule") cgb.CreateCommand(Prefix + "usrmdl").Alias(Prefix + "um")
.Parameter("module", ParameterType.Required) .Parameter("module", ParameterType.Required)
.Parameter("bool", ParameterType.Required) .Parameter("bool", ParameterType.Required)
.Parameter("user", ParameterType.Unparsed) .Parameter("user", ParameterType.Unparsed)
@ -472,7 +473,7 @@ namespace NadekoBot.Modules.Permissions
} }
}); });
cgb.CreateCommand(Prefix + "uc").Alias(Prefix + "usercommand") cgb.CreateCommand(Prefix + "usrcmd").Alias(Prefix + "uc")
.Parameter("command", ParameterType.Required) .Parameter("command", ParameterType.Required)
.Parameter("bool", ParameterType.Required) .Parameter("bool", ParameterType.Required)
.Parameter("user", ParameterType.Unparsed) .Parameter("user", ParameterType.Unparsed)
@ -498,7 +499,7 @@ namespace NadekoBot.Modules.Permissions
} }
}); });
cgb.CreateCommand(Prefix + "asm").Alias(Prefix + "allservermodules") cgb.CreateCommand(Prefix + "allsrvrmdls").Alias(Prefix + "asm")
.Parameter("bool", ParameterType.Required) .Parameter("bool", ParameterType.Required)
.Description("Sets permissions for all modules at the server level.\n**Usage**: ;asm [enable/disable]") .Description("Sets permissions for all modules at the server level.\n**Usage**: ;asm [enable/disable]")
.Do(async e => .Do(async e =>
@ -523,7 +524,7 @@ namespace NadekoBot.Modules.Permissions
} }
}); });
cgb.CreateCommand(Prefix + "asc").Alias(Prefix + "allservercommands") cgb.CreateCommand(Prefix + "allsrvrcmds").Alias(Prefix + "asc")
.Parameter("module", ParameterType.Required) .Parameter("module", ParameterType.Required)
.Parameter("bool", ParameterType.Required) .Parameter("bool", ParameterType.Required)
.Description("Sets permissions for all commands from a certain module at the server level.\n**Usage**: ;asc [module_name] [enable/disable]") .Description("Sets permissions for all commands from a certain module at the server level.\n**Usage**: ;asc [module_name] [enable/disable]")
@ -550,7 +551,7 @@ namespace NadekoBot.Modules.Permissions
} }
}); });
cgb.CreateCommand(Prefix + "acm").Alias(Prefix + "allchannelmodules") cgb.CreateCommand(Prefix + "allchnlmdls").Alias(Prefix + "acm")
.Parameter("bool", ParameterType.Required) .Parameter("bool", ParameterType.Required)
.Parameter("channel", ParameterType.Unparsed) .Parameter("channel", ParameterType.Unparsed)
.Description("Sets permissions for all modules at the channel level.\n**Usage**: ;acm [enable/disable] [channel_name]") .Description("Sets permissions for all modules at the channel level.\n**Usage**: ;acm [enable/disable] [channel_name]")
@ -578,7 +579,7 @@ namespace NadekoBot.Modules.Permissions
} }
}); });
cgb.CreateCommand(Prefix + "acc").Alias(Prefix + "allchannelcommands") cgb.CreateCommand(Prefix + "allchnlcmds").Alias(Prefix + "acc")
.Parameter("module", ParameterType.Required) .Parameter("module", ParameterType.Required)
.Parameter("bool", ParameterType.Required) .Parameter("bool", ParameterType.Required)
.Parameter("channel", ParameterType.Unparsed) .Parameter("channel", ParameterType.Unparsed)
@ -606,7 +607,7 @@ namespace NadekoBot.Modules.Permissions
} }
}); });
cgb.CreateCommand(Prefix + "arm").Alias(Prefix + "allrolemodules") cgb.CreateCommand(Prefix + "allrolemdls").Alias(Prefix + "arm")
.Parameter("bool", ParameterType.Required) .Parameter("bool", ParameterType.Required)
.Parameter("role", ParameterType.Unparsed) .Parameter("role", ParameterType.Unparsed)
.Description("Sets permissions for all modules at the role level.\n**Usage**: ;arm [enable/disable] [role_name]") .Description("Sets permissions for all modules at the role level.\n**Usage**: ;arm [enable/disable] [role_name]")
@ -633,7 +634,7 @@ namespace NadekoBot.Modules.Permissions
} }
}); });
cgb.CreateCommand(Prefix + "arc").Alias(Prefix + "allrolecommands") cgb.CreateCommand(Prefix + "allrolecmds").Alias(Prefix + "arc")
.Parameter("module", ParameterType.Required) .Parameter("module", ParameterType.Required)
.Parameter("bool", ParameterType.Required) .Parameter("bool", ParameterType.Required)
.Parameter("channel", ParameterType.Unparsed) .Parameter("channel", ParameterType.Unparsed)