Beispiel #1
0
        private List <Command> ParseCommands(ulong ChannelId)
        {
            List <Command> ChannelCommands = new List <Command>();

            foreach (KeyValuePair <string, Command[]> CommandCategory in CommandParser.Categories)
            {
                if (!Db.ChannelDisabledCategory(ChannelId, CommandCategory.Key))
                {
                    ChannelCommands.AddRange(CommandCategory.Value);
                }
            }

            return(ChannelCommands);
        }
Beispiel #2
0
        public static async void Help(object s, MessageEventArgs e)
        {
            foreach (KeyValuePair <string, Command[]> Cat in Categories)
            {
                string CatInfo = string.Empty;

                foreach (Command Cmd in Cat.Value)
                {
                    string Start = CmdPrefix;

                    if (Cmd.Prefix == Command.PrefixType.None)
                    {
                        continue;
                    }
                    else if (Cmd.Prefix == Command.PrefixType.Mention)
                    {
                        Start = Bot.Mention + " ";
                    }

                    if (Db.HasPermission(e.User.Id, Cmd.Keys[0]))
                    {
                        if (e.User.Id == Bot.Owner)
                        {
                            CatInfo += "(" + Db.PermissionRank(Cmd.Keys[0]) + ") ";
                        }

                        CatInfo += Start + string.Join("/", Cmd.Keys) + " ~ `" + Cmd.Description + "`\n";
                    }
                }

                if (CatInfo != string.Empty)
                {
                    if (Db.ChannelDisabledCategory(e.Channel.Id, Cat.Key))
                    {
                        if (e.User.Id == Bot.Owner)
                        {
                            CatInfo = "Disabled";
                        }
                        else
                        {
                            continue;
                        }
                    }

                    e.Respond((Cat.Key == string.Empty ? "**Main**" : "**" + Cat.Key + "**") + "\n" + CatInfo);
                    await Task.Delay(250);
                }
            }
        }