private void GenerateStatusImage(object sender, EventArgs e) { if (!mainBotData.GenerateStatusAvatar) { return; } if (e is PlayInfoEventArgs startEvent) { var thumresult = FactoryManager.GetThumbnail(startEvent.PlayResource); if (!thumresult.Ok) { return; } using (var bmp = ImageUtil.BuildStringImage("Now playing: " + startEvent.ResourceData.ResourceTitle, thumresult.Value)) { using (var mem = new MemoryStream()) { bmp.Save(mem, System.Drawing.Imaging.ImageFormat.Jpeg); var result = QueryConnection.UploadAvatar(mem); if (!result.Ok) { Log.Warn("Could not save avatar: {0}", result.Error); } } } } else { using (var sleepPic = Util.GetEmbeddedFile("TS3AudioBot.Media.SleepingKitty.png")) { var result = QueryConnection.UploadAvatar(sleepPic); if (!result.Ok) { Log.Warn("Could not save avatar: {0}", result.Error); } } } }