Ejemplo n.º 1
0
 public async Task RemoveRole([Remainder] string text)
 {
     if (KrispySchedule.FindRoleIds(text).Count > 0)
     {
         var roles = KrispySchedule.FindRoles(text, Context.Guild);
         await((IGuildUser)Context.User).RemoveRolesAsync(roles);
         await ReplyAsync("Schedule updated! Your old classes have been removed.");
     }
     else
     {
         await KrispyGames.RemoveGamesContext(Context, text);
     }
 }
Ejemplo n.º 2
0
        public static async Task <bool> Fun(DiscordSocketClient client, SocketMessage msg, int msgLoc)
        {
            var text       = msg.ToString().ToLower().Substring(msgLoc);
            var components = text.Split(" ");

            if (components.Contains("hi"))
            {
                await msg.Channel.SendMessageAsync("Hello " + KrispyGenerator.PickLine(KrispyLines.Emoticon));
            }
            else if (components.Contains("hello"))
            {
                await msg.Channel.SendMessageAsync("Hi " + KrispyGenerator.PickLine(KrispyLines.Emoticon));
            }
            else if (text.Contains("what") && (components.Contains("time") ||
                                               components.Contains("day") ||
                                               components.Contains("date")))
            {
                await msg.Channel.SendMessageAsync("It is February " +
                                                   (int)(DateTime.Now - new DateTime(2018, 2, 1)).TotalDays +
                                                   ", 2018.");
            }
            else if (text.Contains("what") && components.Contains("love"))
            {
                await msg.Channel.SendMessageAsync("Baby don't hurt me.");
            }
            else if (components.Contains("donut") || components.Contains("doughnut"))
            {
                await msg.Channel.SendMessageAsync(":doughnut:");
            }
            else if (components.Contains("mispell"))
            {
                await msg.Channel.SendMessageAsync("I mean... that's how I spelled it. That's not actually right.");
            }
            else if (components.Contains("misspell"))
            {
                await msg.Channel.SendMessageAsync("Correct! Good job... Here's a doughnut: :doughnut:.");
            }
            else if (components.Contains("inspire"))
            {
                string inspiroBotUrl;
                var    request = (HttpWebRequest)WebRequest.Create("http://inspirobot.me/api?generate=true&oy=vey");
                using (var response = (HttpWebResponse)request.GetResponse())
                    using (var stream = response.GetResponseStream())
                        using (var reader = new StreamReader(stream)) {
                            inspiroBotUrl = reader.ReadToEnd();
                        }

                await msg.Channel.SendMessageAsync(inspiroBotUrl);
            }
            else if (components.Contains("bitch"))
            {
                await msg.Channel.SendMessageAsync("Look who's talking.");
            }
            else if (components.Contains("ur") && components.Contains("mom") && components.Contains("gay"))
            {
                await msg.Channel.SendMessageAsync("no u");
            }
            else if (KrispySchedule.FindRoleIds(components[0]).Count == 1)
            {
                var role = KrispySchedule.FindRoles(components[0],
                                                    (SocketGuild)((IGuildChannel)msg.Channel).Guild)[0];
                await((IGuildUser)msg.Author).AddRoleAsync(role);
                await msg.Channel.SendMessageAsync("Added " + role.Name + " to your schedule "
                                                   + KrispyGenerator.PickLine(KrispyLines.Emoticon));
            }
            else
            {
                return(false);
            }

            return(true);
        }