Esempio n. 1
0
        public async Task HelpCmd()
        {
            try
            {
                StringBuilder builder          = new StringBuilder();
                List <string> existingCommands = new List <string>();
                builder.Append(
                    $"```# Pootis-Bot Normal Commands```\nFor more help on a specific command do `{Global.BotPrefix}help [command]`.\n");

                //Basic Commands
                foreach (HelpModule helpModule in HelpModulesManager.GetHelpModules())
                {
                    builder.Append($"\n**{helpModule.Group}** - ");
                    foreach (CommandInfo command in helpModule.Modules.SelectMany(module =>
                                                                                  DiscordModuleManager.GetModule(module).Commands))
                    {
                        if (existingCommands.Contains(command.Name))
                        {
                            continue;
                        }

                        builder.Append($"`{command.Name}` ");
                        existingCommands.Add(command.Name);
                    }
                }

                await Context.Channel.SendMessageAsync(builder.ToString());
            }
            catch (NullReferenceException)
            {
                await Context.Channel.SendMessageAsync(
                    $"Sorry, but it looks like the bot owner doesn't have the help options configured correctly.\nVisit {Global.websiteCommands} for the command list.");

                Logger.Error("The help options are configured incorrectly!");
            }
        }
Esempio n. 2
0
 /// <summary>
 /// Checks all the help modules in the config
 /// </summary>
 public static void CheckHelpModules()
 {
     foreach (string module in _helpModules.SelectMany(helpModule =>
                                                       helpModule.Modules.Where(module => DiscordModuleManager.GetModule(module) == null)))
     {
         Logger.Log(
             $"There is no module called {module}! Reset the help modules or fix the help modules in the config file!",
             LogVerbosity.Error);
     }
 }