コード例 #1
0
ファイル: cmds.cs プロジェクト: n-oxy/MGX-Discord-Bot
        public static void INIT(SocketMessage arg, string CommandWant)
        {
            var AllCMDs = CommandInfoHolder.RetAllCMDInfoNEW();

            foreach (string CMD in AllCMDs.Keys.ToList())
            {
                if (AllCMDs[CMD].ToLower() != CommandWant.ToLower())
                {
                    AllCMDs.Remove(CMD);
                }
            }
            PrintOut.INIT(arg, AllCMDs.Keys.ToArray(), CommandWant);
        }
コード例 #2
0
ファイル: cmds.cs プロジェクト: n-oxy/MGX-Discord-Bot
        public static async Task Maindo(SocketMessage arg)
        {
            try
            {
                if (arg.Content.ToLower().Contains(" "))
                {
                    string OptArg = arg.Content.ToLower().Split(' ')[1].Trim();
                    grab.INIT(arg, OptArg);
                }
                else
                {
                    var Builder = new EmbedBuilder()
                    {
                        Color       = Color.DarkMagenta,
                        Description = "**MGX Commands**",
                        Footer      = new EmbedFooterBuilder()
                        {
                            Text = $"Use {Program.Prefix}setup for assistance!"
                        },
                        Timestamp = DateTime.UtcNow
                    };

                    List <string> Used  = new List <string>();
                    var           FList = CommandInfoHolder.RetAllCMDInfoNEW();
                    foreach (string TypeName in FList.Keys.ToList())
                    {
                        if (!Used.Contains(FList[TypeName]))
                        {
                            Used.Add(FList[TypeName]);
                            string CategoryFirstUpper = FList[TypeName].ToCharArray().First().ToString().ToUpper() + FList[TypeName].Substring(1);
                            Builder.AddField($"{CommandInfoHolder.ReturnEmojiAssociatedWithCategory(FList[TypeName])} {CategoryFirstUpper}", $"`{Program.Prefix}cmds {FList[TypeName].ToLower()}`", true);
                        }
                    }

                    await arg.Channel.SendMessageAsync("", false, Builder.Build());
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }