Beispiel #1
0
        public override void Execute(IMessage message)
        {
            string[] split = message.Content.Split(new char[] { ' ', '\n' });
            if (split.Length == 1)
            {
                EmbedBuilder Embed = new EmbedBuilder();
                Embed.WithColor(0, 128, 255);
                foreach (PlaceCommand Pcommand in subCommands)
                {
                    Embed.AddFieldDirectly(Prefix + CommandLine + " " + Pcommand.command, Pcommand.desc);
                }
                Embed.WithDescription("Place Commands:");
                DiscordNETWrapper.SendEmbed(Embed, message.Channel).Wait();

                DiscordNETWrapper.SendFile(filePath, message.Channel).Wait();
            }
            else
            {
                foreach (PlaceCommand Pcommand in subCommands)
                {
                    if (split[1] == Pcommand.command && Pcommand.check(split, message.Channel))
                    {
                        Pcommand.execute(message, filePath, split);
                        break;
                    }
                }
            }
        }
Beispiel #2
0
        public static void Save()
        {
            lock (lockject)
            {
                if (File.Exists(configPath))
                {
                    File.Copy(configPath, configBackupPath, true);
                }
                File.WriteAllText(configPath, JsonConvert.SerializeObject(Data, Formatting.Indented));

                if (Program.ClientReady && File.Exists(configPath) && data.ServerList.Count > 0)
                {
                    DiscordNETWrapper.SendFile(configPath, (IMessageChannel)Program.GetChannelFromID(DiscordConfigChannelID), DiscordConfigMessage).Wait();
                }

                UnsavedChanges = false;
            }
        }
Beispiel #3
0
        public Place() : base("place", "Basically just r/place", false, true)
        {
            subCommands = new PlaceCommand[] {
                new PlaceCommand("print", "Prints the canvas without this annoying help message.",
                                 (string[] split, IMessageChannel Channel) => { return(true); },
                                 (IMessage commandmessage, string filePath, string[] split) => { DiscordNETWrapper.SendFile(filePath, commandmessage.Channel).Wait(); }),
                new PlaceCommand("drawPixel", "Draws the specified color to the specified place(0 - " + (placeSize / pixelSize - 1) + ", 0 - " + (placeSize / pixelSize - 1) +
                                 ")\neg. " + Prefix + CommandLine + " drawPixel 10,45 Red",
                                 (string[] split, IMessageChannel Channel) => {
                    int X, Y;
                    if (split.Length != 4)
                    {
                        DiscordNETWrapper.SendText("I need 3 arguments to draw!", Channel).Wait();
                        return(false);
                    }

                    try
                    {
                        string[] temp = split[2].Split(',');
                        X             = Convert.ToInt32(temp[0]);
                        Y             = Convert.ToInt32(temp[1]);
                    }
                    catch
                    {
                        DiscordNETWrapper.SendText("I don't understand those coordinates, fam!", Channel).Wait();
                        return(false);
                    }

                    if (X >= (placeSize / pixelSize) || Y >= (placeSize / pixelSize))
                    {
                        DiscordNETWrapper.SendText("The picture is only " + (placeSize / pixelSize) + "x" + (placeSize / pixelSize) + " big!\nTry smaller coordinates.", Channel).Wait();
                        return(false);
                    }

                    System.Drawing.Color brushColor = System.Drawing.Color.FromName(split[3]);

                    if (brushColor.R == 0 && brushColor.G == 0 && brushColor.B == 0 && split[3].ToLower() != "black")
                    {
                        DiscordNETWrapper.SendText("I dont think I know that color :thinking:", Channel).Wait();
                        return(false);
                    }

                    return(true);
                },
                                 (IMessage commandmessage, string filePath, string[] split) => {
                    string[] temps = split[2].Split(',');
                    int X          = Convert.ToInt32(temps[0]);
                    int Y          = Convert.ToInt32(temps[1]);

                    Bitmap temp;
                    System.Drawing.Color brushColor = System.Drawing.Color.FromName(split[3]);
                    using (FileStream stream = new FileStream(filePath, FileMode.Open))
                        temp = (Bitmap)Bitmap.FromStream(stream);

                    using (Graphics graphics = Graphics.FromImage(temp))
                    {
                        graphics.FillRectangle(new SolidBrush(brushColor), new Rectangle(X * pixelSize, Y * pixelSize, pixelSize, pixelSize));
                    }

                    using (FileStream stream = new FileStream(filePath, FileMode.Create))
                        temp.Save(stream, System.Drawing.Imaging.ImageFormat.Png);

                    DiscordNETWrapper.SendFile(filePath, commandmessage.Channel, "Succsessfully drawn!").Wait();
                }),
                new PlaceCommand("drawCircle", "Draws a circle in some color, in the given size and in the given coordinates(0 - " + (placeSize - 1) + ", 0 - " + (placeSize - 1) +
                                 ")\neg. " + Prefix + CommandLine + " drawCircle 100,450 Red 25",
                                 (string[] split, IMessageChannel Channel) => {
                    int X, Y, S;
                    if (split.Length != 5)
                    {
                        DiscordNETWrapper.SendText("I need 4 arguments to draw!", Channel).Wait();
                        return(false);
                    }

                    try
                    {
                        string[] temp = split[2].Split(',');
                        X             = Convert.ToInt32(temp[0]);
                        Y             = Convert.ToInt32(temp[1]);
                    }
                    catch
                    {
                        DiscordNETWrapper.SendText("I don't understand those coordinates, fam!", Channel).Wait();
                        return(false);
                    }

                    //if (X >= placeSize || Y >= placeSize)
                    //{
                    //    DiscordNETWrapper.SendText("The picture is only " + placeSize + "x" + placeSize + " big!\nTry smaller coordinates.", Channel);
                    //    return false;
                    //}

                    System.Drawing.Color brushColor = System.Drawing.Color.FromName(split[3]);

                    if (brushColor.R == 0 && brushColor.G == 0 && brushColor.B == 0 && split[3].ToLower() != "black")
                    {
                        DiscordNETWrapper.SendText("I dont think I know that color :thinking:", Channel).Wait();
                        return(false);
                    }

                    try
                    {
                        S = Convert.ToInt32(split[4]);
                    }
                    catch
                    {
                        DiscordNETWrapper.SendText("I don't understand that size, fam!", Channel).Wait();
                        return(false);
                    }

                    if (S > 100)
                    {
                        DiscordNETWrapper.SendText("Thats a little big, don't ya think?", Channel).Wait();
                        return(false);
                    }

                    return(true);
                },
                                 (IMessage commandmessage, string filePath, string[] split) => {
                    string[] temps = split[2].Split(',');
                    int X          = Convert.ToInt32(temps[0]);
                    int Y          = Convert.ToInt32(temps[1]);

                    int S = Convert.ToInt32(split[4]);

                    Bitmap temp;
                    System.Drawing.Color brushColor = System.Drawing.Color.FromName(split[3]);
                    using (FileStream stream = new FileStream(filePath, FileMode.Open))
                        temp = (Bitmap)Bitmap.FromStream(stream);

                    using (Graphics graphics = Graphics.FromImage(temp))
                    {
                        graphics.FillPie(new SolidBrush(brushColor), new Rectangle(X - S, Y - S, S * 2, S * 2), 0, 360);
                    }

                    using (FileStream stream = new FileStream(filePath, FileMode.Create))
                        temp.Save(stream, System.Drawing.Imaging.ImageFormat.Png);

                    DiscordNETWrapper.SendFile(filePath, commandmessage.Channel, "Succsessfully drawn!").Wait();
                }),
                new PlaceCommand("drawRekt", "Draws a rectangle in some color and in the given coordinates(0 - " + (placeSize - 1) + ", 0 - " + (placeSize - 1) +
                                 ") and size\neg. " + Prefix + CommandLine + " drawRekt 100,250 Red 200,100",
                                 (string[] split, IMessageChannel Channel) => {
                    int X, Y, W, H;
                    if (split.Length < 5)
                    {
                        DiscordNETWrapper.SendText("I need 4 arguments to draw!", Channel).Wait();
                        return(false);
                    }

                    try
                    {
                        string[] temp = split[2].Split(',');
                        X             = Convert.ToInt32(temp[0]);
                        Y             = Convert.ToInt32(temp[1]);
                    }
                    catch
                    {
                        DiscordNETWrapper.SendText("I don't understand those coordinates, fam!", Channel).Wait();
                        return(false);
                    }

                    try
                    {
                        string[] temp = split[4].Split(',');
                        W             = Convert.ToInt32(temp[0]);
                        H             = Convert.ToInt32(temp[1]);
                    }
                    catch
                    {
                        DiscordNETWrapper.SendText("I don't understand that size, fam!", Channel).Wait();
                        return(false);
                    }

                    if (W + H > 500)
                    {
                        DiscordNETWrapper.SendText("Thats a little big, don't ya think?", Channel).Wait();
                        return(false);
                    }

                    System.Drawing.Color brushColor = System.Drawing.Color.FromName(split[3]);

                    if (brushColor.R == 0 && brushColor.G == 0 && brushColor.B == 0 && split[3].ToLower() != "black")
                    {
                        DiscordNETWrapper.SendText("I dont think I know that color :thinking:", Channel).Wait();
                        return(false);
                    }

                    return(true);
                },
                                 (IMessage commandmessage, string filePath, string[] split) => {
                    string[] temps = split[2].Split(',');
                    int X          = Convert.ToInt32(temps[0]);
                    int Y          = Convert.ToInt32(temps[1]);
                    temps          = split[4].Split(',');
                    int W          = Convert.ToInt32(temps[0]);
                    int H          = Convert.ToInt32(temps[1]);

                    Bitmap temp;
                    System.Drawing.Color brushColor = System.Drawing.Color.FromName(split[3]);
                    using (FileStream stream = new FileStream(filePath, FileMode.Open))
                        temp = (Bitmap)Bitmap.FromStream(stream);

                    using (Graphics graphics = Graphics.FromImage(temp))
                    {
                        graphics.FillRectangle(new SolidBrush(brushColor), new Rectangle(X, Y, W, H));
                    }

                    using (FileStream stream = new FileStream(filePath, FileMode.Create))
                        temp.Save(stream, System.Drawing.Imaging.ImageFormat.Png);

                    DiscordNETWrapper.SendFile(filePath, commandmessage.Channel, "Succsessfully drawn!").Wait();
                }),
                new PlaceCommand("drawString", "Draws a string in some color and in the given coordinates(0 - " + (placeSize - 1) + ", 0 - " + (placeSize - 1) +
                                 ")\neg. " + Prefix + CommandLine + " drawString 100,250 Red OwO what dis",
                                 (string[] split, IMessageChannel Channel) => {
                    int X, Y;
                    if (split.Length < 5)
                    {
                        DiscordNETWrapper.SendText("I need 4 arguments to draw!", Channel).Wait();
                        return(false);
                    }

                    try
                    {
                        string[] temp = split[2].Split(',');
                        X             = Convert.ToInt32(temp[0]);
                        Y             = Convert.ToInt32(temp[1]);
                    }
                    catch
                    {
                        DiscordNETWrapper.SendText("I don't understand those coordinates, fam!", Channel).Wait();
                        return(false);
                    }

                    //if (X >= placeSize || Y >= placeSize)
                    //{
                    //    DiscordNETWrapper.SendText("The picture is only " + placeSize + "x" + placeSize + " big!\nTry smaller coordinates.", Channel);
                    //    return false;
                    //}

                    System.Drawing.Color brushColor = System.Drawing.Color.FromName(split[3]);

                    if (brushColor.R == 0 && brushColor.G == 0 && brushColor.B == 0 && split[3].ToLower() != "black")
                    {
                        DiscordNETWrapper.SendText("I dont think I know that color :thinking:", Channel).Wait();
                        return(false);
                    }

                    return(true);
                },
                                 (IMessage commandmessage, string filePath, string[] split) => {
                    string[] temps = split[2].Split(',');
                    int X          = Convert.ToInt32(temps[0]);
                    int Y          = Convert.ToInt32(temps[1]);

                    Bitmap temp;
                    System.Drawing.Color brushColor = System.Drawing.Color.FromName(split[3]);
                    using (FileStream stream = new FileStream(filePath, FileMode.Open))
                        temp = (Bitmap)Bitmap.FromStream(stream);

                    using (Graphics graphics = Graphics.FromImage(temp))
                    {
                        graphics.DrawString(string.Join(" ", split.Skip(4).ToArray()), new Font("Comic Sans", 16), new SolidBrush(brushColor), new PointF(X, Y));
                    }

                    using (FileStream stream = new FileStream(filePath, FileMode.Create))
                        temp.Save(stream, System.Drawing.Imaging.ImageFormat.Png);

                    DiscordNETWrapper.SendFile(filePath, commandmessage.Channel, "Succsessfully drawn!").Wait();
                })
            };
        }
Beispiel #4
0
        public static async Task SendPostJsonToDiscordChannel(string postJson, string subUrl, IMessageChannel Channel, IUser Author)
        {
            // Resutls
            string ResultURL = "", ResultPicURL = "", ResultTitle = "", ResultTimestamp = "0", ResultPoints = "";
            bool   IsVideo;

            // Looking into the postjson
            ResultURL       = "https://www.reddit.com" + postJson.GetEverythingBetween("\"permalink\": \"", "\", ");
            ResultTitle     = WebUtility.HtmlDecode(postJson.GetEverythingBetween("\"title\": \"", "\", "));
            ResultTimestamp = postJson.GetEverythingBetween("\"created\": ", ", ");
            ResultPoints    = postJson.GetEverythingBetween("\"score\": ", ", ");
            string temp = postJson.GetEverythingBetween(", \"is_video\": ", "}");

            try { IsVideo = Convert.ToBoolean(temp); }
            catch { IsVideo = false; }

            // Getting full res image url from the post site html
            HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(ResultURL);

            req.KeepAlive = false;
            WebResponse W = req.GetResponse();

            using (StreamReader sr = new StreamReader(W.GetResponseStream()))
                ResultPicURL = sr.ReadToEnd().GetEverythingBetween("\"content\":\"", "\",\"");
            if (ResultPicURL == "" || !IsReachable(ResultPicURL))
            {
                ResultPicURL = postJson.GetEverythingBetween("\"images\": [{\"source\": {\"url\": \"", "\", ");
            }
            if (ResultPicURL == "" || !IsReachable(ResultPicURL))
            {
                ResultPicURL = postJson.GetEverythingBetween("\"variants\": {\"gif\": {\"source\": {\"url\": \"", "\"");
            }
            if (ResultPicURL == "" || !IsReachable(ResultPicURL))
            {
                ResultPicURL = postJson.GetEverythingBetween("\"thumbnail\": \"", "\", ");
            }
            if (ResultPicURL == "" || !IsReachable(ResultPicURL))
            {
                ResultPicURL = postJson.GetEverythingBetween("\"url\": \"", "\",");
            }
            if (ResultPicURL == "" || !IsReachable(ResultPicURL))
            {
                throw new Exception("Faulty URL: " + ResultURL, new Exception(postJson));
            }

            if (IsVideo)
            {
                await DiscordNETWrapper.SendText("Sending video post. Please wait...", Channel);

                // downlaod video
                string videofile = $"Downloads{Path.DirectorySeparatorChar}RedditVideo.mp4";
                Directory.CreateDirectory(Path.GetDirectoryName(videofile));
                if (File.Exists(videofile))
                {
                    File.Delete(videofile);
                }
                WebClient client = new WebClient();
                client.DownloadFile(postJson.GetEverythingBetween("\"media\": {\"reddit_video\": {\"fallback_url\": \"", "\","), videofile);

                if (new FileInfo(videofile).Length > 8 * 1024 * 1024)
                {
                    await DiscordNETWrapper.SendText("That video is too big for discords puny 8MB limit!", Channel);
                }
                else
                {
                    // send post
                    await DiscordNETWrapper.SendFile(videofile, Channel, ResultTitle);

                    await DiscordNETWrapper.SendText(ResultPoints + (ResultPoints == "1" ? " fake internet point" : " fake internet points on " + subUrl.Remove(0, "https://www.reddit.com".Length)), Channel);
                }

                // delete "Sending video post. Please wait..." message
                IEnumerable <IMessage> messages = await Channel.GetMessagesAsync().FlattenAsync();

                foreach (IMessage m in messages)
                {
                    if (m.Author.Id == Program.GetSelf().Id&& m.Content == "Sending video post. Please wait...")
                    {
                        await m.DeleteAsync();

                        break;
                    }
                }
            }
            else // Is Pic or Gif
            {
                EmbedBuilder Embed = new EmbedBuilder();

                if (Uri.IsWellFormedUriString(ResultURL, UriKind.RelativeOrAbsolute))
                {
                    Embed.WithUrl(ResultURL);
                }
                else
                {
                    throw new Exception("Faulty URL: " + ResultURL, new Exception(postJson));
                }
                Embed.WithTitle(ResultTitle);
                Embed.WithImageUrl(ResultPicURL);
                Embed.WithColor(0, 128, 255);
                if (ResultTimestamp != "0" && ResultTimestamp != "")
                {
                    DateTime dtDateTime = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc);
                    dtDateTime = dtDateTime.AddSeconds(Convert.ToDouble(ResultTimestamp.Replace('.', ','))).AddHours(-10);
                    Embed.WithTimestamp(new DateTimeOffset(dtDateTime));
                }
                Embed.WithFooter(ResultPoints + (ResultPoints == "1" ? " fake internet point on " : " fake internet points on ") + subUrl.Remove(0, "https://www.reddit.com".Length));

                await DiscordNETWrapper.SendEmbed(Embed, Channel);
            }
        }
Beispiel #5
0
        static void HandleConsoleCommandsLoop()
        {
            PrintConsoleStartup();

            while (true)
            {
                string input = "";
                if (RunningOnCI)
                {
                    CILimbo();
                }
                else
                {
                    try { input = Console.ReadLine(); }
                    catch (Exception e) { CILimbo(); e.ToString(); }
                }

                if (input == "exit")
                {
                    break;
                }

                try
                {
                    if (input.StartsWith(Prefix))
                    {
                        if (CurrentChannel == null)
                        {
                            ConsoleWrapper.WriteLine("No channel selected!");
                        }
                        else
                        {
                            try
                            {
                                SelfmadeMessage m = new SelfmadeMessage
                                {
                                    Channel = CurrentChannel,
                                    Content = input,
                                    Author  = Master
                                };
                                Task.Run(() => MessageReceived(m));
                            }
                            catch (Exception e)
                            {
                                ConsoleWrapper.WriteLine(e, ConsoleColor.Red);
                            }
                        }
                    }
                    else if (!input.StartsWith("/"))
                    {
                        if (CurrentChannel == null)
                        {
                            ConsoleWrapper.WriteLine("No channel selected!");
                        }
                        else if (!string.IsNullOrWhiteSpace(input))
                        {
                            try
                            {
                                DiscordNETWrapper.SendText(input, CurrentChannel).Wait();
                            }
                            catch (Exception e)
                            {
                                ConsoleWrapper.WriteLine(e, ConsoleColor.Red);
                            }
                        }
                    }
                    else if (input.StartsWith("/file "))
                    {
                        if (CurrentChannel == null)
                        {
                            ConsoleWrapper.WriteLine("No channel selected!");
                        }
                        else
                        {
                            string[] splits = input.Split(' ');
                            string   path   = splits.Skip(1).Aggregate((x, y) => x + " " + y);
                            DiscordNETWrapper.SendFile(path.Trim('\"'), CurrentChannel).Wait();
                        }
                    }
                    else if (input.StartsWith("/setchannel ") || input.StartsWith("/set "))
                    {
                        #region set channel code
                        try
                        {
                            string[] splits = input.Split(' ');

                            SocketChannel   channel     = client.GetChannel((ulong)Convert.ToInt64(splits[1]));
                            IMessageChannel textChannel = (IMessageChannel)channel;
                            if (textChannel != null)
                            {
                                CurrentChannel = (ISocketMessageChannel)textChannel;
                                ConsoleWrapper.WriteLine("Succsessfully set new channel!", ConsoleColor.Green);
                                ConsoleWrapper.Write("Current channel is: ");
                                ConsoleWrapper.WriteLine(CurrentChannel, ConsoleColor.Magenta);
                            }
                            else
                            {
                                ConsoleWrapper.WriteLine("Couldn't set new channel!", ConsoleColor.Red);
                            }
                        }
                        catch
                        {
                            ConsoleWrapper.WriteLine("Couldn't set new channel!", ConsoleColor.Red);
                        }
                        #endregion
                    }
                    else if (input.StartsWith("/del "))
                    {
                        #region deletion code
                        try
                        {
                            string[] splits           = input.Split(' ');
                            IMessage M                = null;
                            bool     DeletionComplete = false;

                            for (int i = 0; !DeletionComplete; i++)
                            {
                                try
                                {
                                    M = ((ISocketMessageChannel)GetChannelFromID(Config.Data.ChannelsWrittenOn[i])).
                                        GetMessageAsync(Convert.ToUInt64(splits[1])).GetAwaiter().GetResult();

                                    if (M != null)
                                    {
                                        M.DeleteAsync().Wait();
                                        DeletionComplete = true;
                                    }
                                }
                                catch { }
                            }
                        }
                        catch (Exception e)
                        {
                            ConsoleWrapper.WriteLine(e, ConsoleColor.Red);
                        }
                        #endregion
                    }
                    else if (input == "/PANIKDELETE")
                    {
                        foreach (ulong ChannelID in Config.Data.ChannelsWrittenOn)
                        {
                            IEnumerable <IMessage> messages = ((ISocketMessageChannel)client.GetChannel(ChannelID)).GetMessagesAsync(int.MaxValue).FlattenAsync().GetAwaiter().GetResult();
                            foreach (IMessage m in messages)
                            {
                                if (m.Author.Id == client.CurrentUser.Id)
                                {
                                    m.DeleteAsync().Wait();
                                }
                            }
                        }
                    }
                    else if (input == "/clear")
                    {
                        Console.CursorTop  = clearYcoords;
                        Console.CursorLeft = 0;
                        string large = "";
                        for (int i = 0; i < (Console.BufferHeight - clearYcoords - 2) * Console.BufferWidth; i++)
                        {
                            large += " ";
                        }
                        Console.WriteLine(large);
                        Console.CursorTop  = clearYcoords;
                        Console.CursorLeft = 0;
                    }
                    else if (input == "/config")
                    {
                        Console.WriteLine(Config.ToString());
                    }
                    else if (input == "/restart")
                    {
                        Process.Start("MEE7.exe");
                        break;
                    }
                    else if (input.StartsWith("/test"))
                    {
                        string[] split = input.Split(' ');
                        int      index = -1;
                        if (split.Length > 0)
                        {
                            try { index = Convert.ToInt32(split[1]); } catch { }
                        }
                        Tests.Run(index);
                    }
                    else if (input.StartsWith("/roles")) // ServerID
                    {
                        string[] split = input.Split(' ');
                        try
                        {
                            ConsoleWrapper.WriteLine(String.Join("\n", GetGuildFromID(Convert.ToUInt64(split[1])).Roles.Select(x => x.Name)), ConsoleColor.Cyan);
                        }
                        catch (Exception e) { ConsoleWrapper.WriteLine(e.ToString(), ConsoleColor.Red); }
                    }
                    else if (input.StartsWith("/rolePermissions")) // ServerID RoleName
                    {
                        string[] split = input.Split(' ');
                        try
                        {
                            ConsoleWrapper.WriteLine(GetGuildFromID(Convert.ToUInt64(split[1])).Roles.First(x => x.Name == split[2]).Permissions.ToList().
                                                     Select(x => x.ToString()).Aggregate((x, y) => x + "\n" + y), ConsoleColor.Cyan);
                        }
                        catch (Exception e) { ConsoleWrapper.WriteLine(e.ToString(), ConsoleColor.Red); }
                    }
                    else if (input.StartsWith("/assignRole")) // ServerID UserID RoleName
                    {
                        string[] split = input.Split(' ');
                        try
                        {
                            GetGuildFromID(Convert.ToUInt64(split[1])).GetUser(Convert.ToUInt64(split[2])).
                            AddRoleAsync(GetGuildFromID(Convert.ToUInt64(split[1])).Roles.First(x => x.Name == split[3])).Wait();
                            ConsoleWrapper.WriteLine("That worked!", ConsoleColor.Cyan);
                        }
                        catch (Exception e) { ConsoleWrapper.WriteLine(e.ToString(), ConsoleColor.Red); }
                    }
                    else if (input.StartsWith("/channels")) // ChannelID
                    {
                        string[] split = input.Split(' ');
                        try
                        {
                            ConsoleWrapper.WriteLine(String.Join("\n", GetGuildFromID(Convert.ToUInt64(split[1])).Channels.Select(x => x.Name + "\t" + x.Id + "\t" + x.GetType())), ConsoleColor.Cyan);
                        }
                        catch (Exception e) { ConsoleWrapper.WriteLine(e.ToString(), ConsoleColor.Red); }
                    }
                    else if (input.StartsWith("/read")) // ChannelID
                    {
                        string[] split = input.Split(' ');
                        try
                        {
                            var messages = (GetChannelFromID(Convert.ToUInt64(split[1])) as ISocketMessageChannel).GetMessagesAsync(100).FlattenAsync().GetAwaiter().GetResult();
                            ConsoleWrapper.WriteLine(String.Join("\n", messages.Reverse().Select(x => x.Author + ": " + x.Content)), ConsoleColor.Cyan);
                        }
                        catch (Exception e) { ConsoleWrapper.WriteLine(e.ToString(), ConsoleColor.Red); }
                    }
                    else if (input.StartsWith("/modifyto")) // ChannelID MessageID ChannelID MessageID
                    {
                        string[] split = input.Split(' ');
                        try
                        {
                            var message   = (IUserMessage)(GetChannelFromID(Convert.ToUInt64(split[1])) as ISocketMessageChannel).GetMessageAsync(Convert.ToUInt64(split[2])).Result;
                            var messageTo = (IUserMessage)(GetChannelFromID(Convert.ToUInt64(split[3])) as ISocketMessageChannel).GetMessageAsync(Convert.ToUInt64(split[4])).Result;
                            message.ModifyAsync(m => m.Content = messageTo.Content);
                        }
                        catch (Exception e) { ConsoleWrapper.WriteLine(e.ToString(), ConsoleColor.Red); }
                    }
                    else if (input.StartsWith("/modify")) // ChannelID MessageID
                    {
                        string[] split = input.Split(' ');
                        try
                        {
                            var message = (IUserMessage)(GetChannelFromID(Convert.ToUInt64(split[1])) as ISocketMessageChannel).GetMessageAsync(Convert.ToUInt64(split[2])).Result;
                            message.ModifyAsync(m => m.Content = split.Skip(3).Combine(" "));
                        }
                        catch (Exception e) { ConsoleWrapper.WriteLine(e.ToString(), ConsoleColor.Red); }
                    }
                    else
                    {
                        ConsoleWrapper.WriteLine("I dont know that command.", ConsoleColor.Red);
                    }
                }
                catch { }
                ConsoleWrapper.Write("$");
            }
        }