コード例 #1
0
            async Task Responce_Help(string Msg, MessageEventArgs e)
            {
                if (Msg == "")
                {
                    if (e.User.Roles.Count() == 1)
                    {
                        var Mesg = "Hello, " + e.User.Mention + ", it seems you do not have a Role yet.\n" +
                                   "Mention any of the following Roles *(@role)* based on the games you play:\n\n";
                        foreach (var R in Dictionaries.Roles.Where(x => CodeSEL.GetRole(x).Name.Contains("Buddy")))
                        {
                            Mesg += " • " + CodeSEL.GetRole(R).Mention + "\n";
                        }
                        await CodeSEL.DefaultChannel.SendMessage(Mesg);
                    }
                    else
                    {
                        var res = "Hey, " + e.User.Name + ". Here are the commands available:\n\n";
                        foreach (var c in Commands.OrderBy(o => o.Name))
                        {
                            res += $"**{c.Name}:** ";
                            foreach (var s in c.Triggers)
                            {
                                res += s + " - ";
                            }
                            res = res.Substring(0, res.Length - 3) + "\n";
                        }
                        res += "\nSay `-help <command>` for more info about a specific command";
                        await e.Channel.SendMessage(res);

                        WriteLine("Command: Sent full resume of all commands");
                    }
                }
                else
                {
                    foreach (var c in Commands)
                    {
                        if (("-" + Msg).CommandCheck(c.Triggers) || ("-" + Msg).CommandCheck(c.Name))
                        {
                            await e.Channel.SendMessage(c.ToString());

                            WriteLine("Command: Sent specific info about the " + c.Name + " command");
                            return;
                        }
                    }
                    var res = "Hey, " + e.User.Name + ". Here are the commands available:\n\n";
                    foreach (var c in Commands.OrderBy(o => o.Name))
                    {
                        res += $"**{c.Name}:** ";
                        foreach (var s in c.Triggers)
                        {
                            res += s + " - ";
                        }
                        res = res.Substring(0, res.Length - 3) + "\n";
                    }
                    res += "\nSay `-help <command>` for more info about a specific command";
                    await e.Channel.SendMessage(res);

                    WriteLine("Command: Sent full resume of all commands");
                }
            }
コード例 #2
0
            async Task Responce_Invite(string Msg, MessageEventArgs e)
            {
                await e.Channel.SendIsTyping();

                Invite Inv = await CodeSEL.CreateInvite();

                await e.Channel.SendMessage("Here's an invite for the Server: `https://discord.gg/" + Inv.Code + "`");

                WriteLine("Command: Created new Server Invite: https://discord.gg/" + Inv.Code);
            }
コード例 #3
0
            async Task Responce_ServerInfo(string Msg, MessageEventArgs e)
            {
                await e.Channel.SendIsTyping();

                var Out = "";

                Out += $"**{CodeSEL.Name}** - Server Info:\n\n";
                Out += $"**Owner:**  {CodeSEL.Owner.Mention}\n";
                Out += $"**Default Channel:**  {CodeSEL.DefaultChannel.Mention}\n";
                Out += $"**Online Users:**  {CodeSEL.Users.Where(x => x.Status != "offline").Count()} users online out of {CodeSEL.UserCount}\n";
                Out += $"**Server ID:**  `{CodeSEL.Id}`\n\n";
                Out += $"**Bot:** <:CodeSel2:318697839750545408>  <@{Dictionaries.Bot_ID}>\n";
                Out += $"**Commands proccessed:**  {BotData.CommandsProccessed}\n";
                Out += $"**Uptime:**  {TimeSpan.FromTicks(BotData.UpTime).ToReadableString()}\n\n";

                if (CodeSEL.GetInvites().Result.Count() > 0)
                {
                    Out += $"**Server Invites:**\n";
                    foreach (var Inv in CodeSEL.GetInvites().Result)
                    {
                        Out += $"`{Inv.Url}` > {CodeSEL.GetChannel(Inv.Channel.Id).Mention}\n";
                    }
                    Out += '\n';
                }

                if (Msg.Contains("#role"))
                {
                    Out += $"**Server Roles:**\n";
                    foreach (var Rol in CodeSEL.Roles.Where(x => x.Id != CodeSEL.EveryoneRole.Id).OrderByDescending(o => o.Position))
                    {
                        Out += $"**{CodeSEL.Roles.Count() - Rol.Position}** - {Rol.Mention}\n    • **User Count:**  {Rol.Members.Count()}\n    • **ID:**  `{Rol.Id}`\n";
                    }
                    Out += '\n';
                }
                else
                {
                    Out += $"For more info about the roles use `-serverinfo #roles`\n";
                }

                Out += $"For other info about the channels and permissions, go to <#{Dictionaries.Ch_T_Info}>";

                (await e.Channel.SendFile("../../Resources/Code.SEL Reborn Emoji 2.0.png")).WaitForIt();

                await e.Channel.SendMessage(Out);
            }