diff --git a/.vs/NadekoBot/NadekoBot.scgdat b/.vs/NadekoBot/NadekoBot.scgdat deleted file mode 100644 index e34ebe8d..00000000 Binary files a/.vs/NadekoBot/NadekoBot.scgdat and /dev/null differ diff --git a/NadekoBot/Modules/Conversations/Conversations.cs b/NadekoBot/Modules/Conversations/Conversations.cs index 458108ce..b8de0cea 100644 --- a/NadekoBot/Modules/Conversations/Conversations.cs +++ b/NadekoBot/Modules/Conversations/Conversations.cs @@ -1,7 +1,6 @@ using Discord; using Discord.Commands; using Discord.Modules; -using NadekoBot.Classes; using NadekoBot.Classes.Conversations.Commands; using NadekoBot.DataModels; using NadekoBot.Extensions; @@ -10,7 +9,6 @@ using NadekoBot.Properties; using System; using System.Diagnostics; using System.Drawing; -using System.Drawing.Drawing2D; using System.Drawing.Imaging; using System.IO; using System.Linq; @@ -196,15 +194,13 @@ namespace NadekoBot.Modules.Conversations return; var usr = e.Channel.FindUsers(e.GetArg("user")).FirstOrDefault(); var text = ""; - var avatar = await GetAvatar(usr.AvatarUrl); text = usr?.Name ?? e.GetArg("user"); await e.Channel.SendFile("ripzor_m8.png", - RipUser(text, avatar, string.IsNullOrWhiteSpace(e.GetArg("year")) + RipName(text, string.IsNullOrWhiteSpace(e.GetArg("year")) ? null : e.GetArg("year"))) .ConfigureAwait(false); }); - if (!NadekoBot.Config.DontJoinServers) { cgb.CreateCommand("j") @@ -355,7 +351,7 @@ namespace NadekoBot.Modules.Conversations { fontSize -= (name.Length - 10) / 2; } - + //TODO use measure string var g = Graphics.FromImage(bm); g.DrawString(name, new Font("Comic Sans MS", fontSize, FontStyle.Bold), Brushes.Black, 100 - offset, 200); @@ -366,56 +362,6 @@ namespace NadekoBot.Modules.Conversations return bm.ToStream(ImageFormat.Png); } - public Stream RipUser(string name, Image avatar, string year = null) - { - var bm = Resources.rip; - var offset = name.Length * 2; - - var fontSize = 20; - - if (name.Length > 10) - { - fontSize -= (name.Length - 10) / 2; - } - //var avatar = Image.FromStream(await SearchHelper.GetResponseStreamAsync(aviLink)); - - - - //TODO use measure string - var g = Graphics.FromImage(bm); - g.DrawString(name, new Font("Comic Sans MS", fontSize, FontStyle.Bold), Brushes.Black, 100 - offset, 220); - g.DrawString((year ?? "?") + " - " + DateTime.Now.Year, new Font("Consolas", 12, FontStyle.Bold), Brushes.Black, 80, 240); - - g.DrawImage(avatar, 80,135); - g.DrawImage((Image)Resources.rose_overlay, 0, 0); - g.Flush(); - g.Dispose(); - - return bm.ToStream(ImageFormat.Png); - - } - - - public static async Task GetAvatar(string url) - { - var stream = await SearchHelper.GetResponseStreamAsync(url); - Bitmap bmp = new Bitmap(100, 100); - using (GraphicsPath gp = new GraphicsPath()) - { - gp.AddEllipse(0,0, bmp.Width, bmp.Height); - using (Graphics gr = Graphics.FromImage(bmp)) - { - gr.SetClip(gp); - gr.DrawImage(Image.FromStream(stream), Point.Empty); - - } - } - return bmp; - - } - - - private static Func SayYes() => async e => await e.Channel.SendMessage("Yes. :)").ConfigureAwait(false); } diff --git a/NadekoBot/NadekoBot.csproj b/NadekoBot/NadekoBot.csproj index afbc37af..df37a039 100644 --- a/NadekoBot/NadekoBot.csproj +++ b/NadekoBot/NadekoBot.csproj @@ -492,7 +492,6 @@ -