From d45bf6de55ba4580405ccf9550811b0ee4f9637b Mon Sep 17 00:00:00 2001 From: Master Kwoth Date: Fri, 12 Feb 2016 01:57:20 +0100 Subject: [PATCH] .commands and .modules (to work well with permissions) --- NadekoBot/Modules/Administration.cs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/NadekoBot/Modules/Administration.cs b/NadekoBot/Modules/Administration.cs index c81a2556..4a4a8a50 100644 --- a/NadekoBot/Modules/Administration.cs +++ b/NadekoBot/Modules/Administration.cs @@ -29,6 +29,8 @@ namespace NadekoBot.Modules { commands.ForEach(cmd => cmd.Init(cgb)); + cgb.AddCheck(Classes.Permissions.PermissionChecker.Instance); + cgb.CreateCommand(".sr").Alias(".setrole") .Description("Sets a role for a given user.\n**Usage**: .sr @User Guest") .Parameter("user_name", ParameterType.Required) @@ -144,6 +146,25 @@ namespace NadekoBot.Modules { await e.Send("`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.Send("`List of modules:` \n• " + string.Join("\n• ", NadekoBot.client.Modules().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.Commands().AllCommands + .Where(c => c.Category.ToLower() == e.GetArg("module").Trim().ToLower()); + if (commands == null || commands.Count() == 0) { + await e.Send("That module does not exist."); + return; + } + await e.Send("`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")