Exemple #1
0
        public async Task ServerSetupHelp()
        {
            EmbedBuilder embed = new EmbedBuilder();

            embed.WithTitle("Server Setup Basic Help");

            StringBuilder info = new StringBuilder();

            info.Append(
                $"Here are all the commands related to setting up your Discord server with {Global.BotName}! For more information or help, read the setup docs [here]({Global.websiteServerSetup}).\n\n");

            foreach (string module in setupModules)
            {
                ModuleInfo moduleInfo = DiscordModuleManager.GetModule(module);
                if (moduleInfo == null)
                {
                    continue;
                }

                info.Append($"**{moduleInfo.Name}**\n");

                for (int i = 0; i < moduleInfo.Commands.Count; i++)
                {
                    info.Append($"`{moduleInfo.Commands[i].Name}` ");
                    if (i + 1 == moduleInfo.Commands.Count)
                    {
                        info.Append("\n");
                    }
                }
            }

            embed.WithDescription(info.ToString());

            await Context.Channel.SendMessageAsync("", false, embed.Build());
        }
Exemple #2
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 command list.");

                Logger.Log("The help options are configured incorrectly!", LogVerbosity.Error);
            }
        }
Exemple #3
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);
     }
 }