Example #1
0
        private async Task Help(CommandReplyEmbed embedrep, SocketMessage msg, List <string> args)
        {
            string arg = args[0];

            if (!string.IsNullOrWhiteSpace(arg))
            {
                bool retrieved = this.Handler.Commands.TryGetValue(arg.ToLower().Trim(), out Command cmd);
                if (retrieved)
                {
                    await embedrep.Warning(msg, "Help [ " + arg + " ]", cmd.GetHelp());
                }
                else
                {
                    await embedrep.Danger(msg, "Help", "Couldn't find documentation for \"" + arg + "\"");
                }
            }
            else
            {
                if (!(msg.Channel is IDMChannel))
                {
                    await embedrep.Good(msg, "Help", "Check your private messages " + msg.Author.Mention);
                }

                Dictionary <string, Command> cmds = this.Handler.Commands;
                string result = "``";
                uint   count  = 0;
                foreach (KeyValuePair <string, Command> cmd in cmds)
                {
                    result += cmd.Key + ",";
                    count++;
                    if (count > 5)
                    {
                        result += "\n";
                        count   = 0;
                    }
                }
                result  = result.Remove(result.Length - 2);
                result += "``";

                await embedrep.RespondByDM(msg, "Help [ all ]", result, new Color());
            }
        }