moved .commands and .modules to help, -h takes a command name optionaly. Fixes.

This commit is contained in:
Master Kwoth
2016-02-25 02:44:39 +01:00
parent c13eebb69d
commit b08e37f89d
8 changed files with 56 additions and 32 deletions

View File

@ -160,25 +160,6 @@ namespace NadekoBot.Modules {
await e.Channel.SendMessage("`List of roles:` \n• " + string.Join("\n• ", e.Server.Roles).Replace("@everyone", "මeveryone"));
});
cgb.CreateCommand(".modules")
.Description("List all bot modules.")
.Do(async e => {
await e.Channel.SendMessage("`List of modules:` \n• " + string.Join("\n• ", NadekoBot.client.GetService<ModuleService>().Modules.Select(m => m.Name)));
});
cgb.CreateCommand(".commands")
.Description("List all of the bot's commands from a certain module.")
.Parameter("module", ParameterType.Unparsed)
.Do(async e => {
var commands = NadekoBot.client.GetService<CommandService>().AllCommands
.Where(c => c.Category.ToLower() == e.GetArg("module").Trim().ToLower());
if (commands == null || commands.Count() == 0) {
await e.Channel.SendMessage("That module does not exist.");
return;
}
await e.Channel.SendMessage("`List of commands:` \n• " + string.Join("\n• ", commands.Select(c => c.Text)));
});
cgb.CreateCommand(".b").Alias(".ban")
.Parameter("everything", ParameterType.Unparsed)
.Description("Bans a mentioned user.")

View File

@ -4,6 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Discord.Modules;
using Discord.Commands;
namespace NadekoBot.Modules {
class Help : DiscordModule {
@ -16,6 +17,27 @@ namespace NadekoBot.Modules {
manager.CreateCommands("", cgb => {
cgb.AddCheck(Classes.Permissions.PermissionChecker.Instance);
commands.ForEach(com => com.Init(cgb));
cgb.CreateCommand(".modules")
.Alias("-modules")
.Description("List all bot modules.")
.Do(async e => {
await e.Channel.SendMessage("`List of modules:` \n• " + string.Join("\n• ", NadekoBot.client.GetService<ModuleService>().Modules.Select(m => m.Name)));
});
cgb.CreateCommand(".commands")
.Alias("-commands")
.Description("List all of the bot's commands from a certain module.")
.Parameter("module", ParameterType.Unparsed)
.Do(async e => {
var commands = NadekoBot.client.GetService<CommandService>().AllCommands
.Where(c => c.Category.ToLower() == e.GetArg("module").Trim().ToLower());
if (commands == null || commands.Count() == 0) {
await e.Channel.SendMessage("That module does not exist.");
return;
}
await e.Channel.SendMessage("`List of commands:` \n• " + string.Join("\n• ", commands.Select(c => c.Text)));
});
});
}
}