From 29994e938352715da8b90a5da1229033523acb12 Mon Sep 17 00:00:00 2001 From: Plenyx Date: Fri, 7 Jun 2019 00:57:42 +0200 Subject: [PATCH] Build n. 41 --- App.config | 12 +++++ DPSReport/Bosses.cs | 2 +- DPSReport/DPSReportJSON.cs | 1 + DPSReport/DPSReportJSONExtraJSON.cs | 9 ++++ Forms/FormDiscordWebhooks.cs | 27 +++++++---- Forms/FormLogSession.Designer.cs | 74 +++++++++++++++++++++++++---- Forms/FormLogSession.cs | 24 +++++++++- Forms/FormMain.Designer.cs | 2 +- Forms/FormMain.cs | 38 ++++++++++----- PlenBotLogUploader.csproj | 1 + Properties/Settings.Designer.cs | 48 +++++++++++++++++++ Properties/Settings.settings | 12 +++++ VERSION | 2 +- 13 files changed, 220 insertions(+), 32 deletions(-) create mode 100644 DPSReport/DPSReportJSONExtraJSON.cs diff --git a/App.config b/App.config index 8b45fd7..84ad263 100644 --- a/App.config +++ b/App.config @@ -82,6 +82,18 @@ True + + Log session + + + True + + + True + + + + diff --git a/DPSReport/Bosses.cs b/DPSReport/Bosses.cs index 70aef2c..47ed7e8 100644 --- a/DPSReport/Bosses.cs +++ b/DPSReport/Bosses.cs @@ -131,7 +131,7 @@ public static string GetWingName(int wingNumber) case 6: return "Mythwright Gambit"; case 7: - return "The Key of Ahdashim"; + return "Key of Ahdashim"; default: return "Unknown wing"; } diff --git a/DPSReport/DPSReportJSON.cs b/DPSReport/DPSReportJSON.cs index f05facd..6398e38 100644 --- a/DPSReport/DPSReportJSON.cs +++ b/DPSReport/DPSReportJSON.cs @@ -13,6 +13,7 @@ public class DPSReportJSON public DPSReportJSONEvtc Evtc { get; set; } public DPSReportJSONEncounter Encounter { get; set; } public Dictionary Players { get; set; } = new Dictionary(); + public DPSReportJSONExtraJSON ExtraJSON { get; set; } public string GetUrlId() => Permalink.Substring(Permalink.IndexOf("dps.report/") + 11); } diff --git a/DPSReport/DPSReportJSONExtraJSON.cs b/DPSReport/DPSReportJSONExtraJSON.cs new file mode 100644 index 0000000..0b080f3 --- /dev/null +++ b/DPSReport/DPSReportJSONExtraJSON.cs @@ -0,0 +1,9 @@ +namespace PlenBotLogUploader.DPSReport +{ + public class DPSReportJSONExtraJSON + { + public string EliteInsightsVersion { get; set; } + public string RecordedBy { get; set; } + public string Duration { get; set; } + } +} diff --git a/Forms/FormDiscordWebhooks.cs b/Forms/FormDiscordWebhooks.cs index 5dfdf3c..5a1d004 100644 --- a/Forms/FormDiscordWebhooks.cs +++ b/Forms/FormDiscordWebhooks.cs @@ -100,7 +100,8 @@ public void AddWebhook(DiscordWebhookData data) public async Task ExecuteAllActiveWebhooksAsync(DPSReportJSON reportJSON, Dictionary allBosses) { string bossName = reportJSON.Encounter.Boss; - string successString = (reportJSON.Encounter.Success ?? false) ? "success" : "fail"; + string successString = (reportJSON.Encounter.Success ?? false) ? ":white_check_mark:" : "❌"; + string extraJSON = (reportJSON.ExtraJSON == null) ? "" : $"Recorded by: {reportJSON.ExtraJSON.RecordedBy}\nDuration: {reportJSON.ExtraJSON.Duration}\nElite Insights version: {reportJSON.ExtraJSON.EliteInsightsVersion}\n"; string icon = ""; var bossDataRef = allBosses .Where(anon => anon.Value.BossId.Equals(reportJSON.Encounter.BossId)) @@ -119,7 +120,7 @@ public async Task ExecuteAllActiveWebhooksAsync(DPSReportJSON reportJSON, Dictio { Title = bossName, Url = reportJSON.Permalink, - Description = $"Result: {successString}\narcdps version: {reportJSON.Evtc.Type}{reportJSON.Evtc.Version}", + Description = $"{extraJSON}Result: {successString}\narcdps version: {reportJSON.Evtc.Type}{reportJSON.Evtc.Version}", Color = color, Thumbnail = discordContentEmbedThumbnail }; @@ -131,7 +132,7 @@ public async Task ExecuteAllActiveWebhooksAsync(DPSReportJSON reportJSON, Dictio { Title = bossName, Url = reportJSON.Permalink, - Description = $"Result: {successString}\narcdps version: {reportJSON.Evtc.Type}{reportJSON.Evtc.Version}", + Description = $"{extraJSON}Result: {successString}\narcdps version: {reportJSON.Evtc.Type}{reportJSON.Evtc.Version}", Color = color, Thumbnail = discordContentEmbedThumbnail }; @@ -188,7 +189,7 @@ public async Task ExecuteAllActiveWebhooksAsync(DPSReportJSON reportJSON, Dictio } } - public async Task ExecuteSessionAllActiveWebhooksAsync(List reportsJSON, Dictionary allBosses, bool showSuccess) + public async Task ExecuteSessionAllActiveWebhooksAsync(List reportsJSON, Dictionary allBosses, string sessionName, string contentText, bool showSuccess, string elapsedTime) { var RaidLogs = reportsJSON .Where(anon => Bosses.GetWingForBoss(anon.Evtc.BossId) > 0) @@ -207,6 +208,7 @@ public async Task ExecuteSessionAllActiveWebhooksAsync(List repor .Where(anon => Bosses.IsWvW(anon.Evtc.BossId)) .ToList(); StringBuilder builder = new StringBuilder(); + builder.Append($"Session duration: {elapsedTime}\n\n"); if (RaidLogs.Count > 0) { builder.Append("***Raid logs:***\n"); @@ -226,8 +228,9 @@ public async Task ExecuteSessionAllActiveWebhooksAsync(List repor { bossName = bossDataRef.First().Name; } - string successText = (showSuccess) ? ((data.LogData.Encounter.Success ?? false) ? " (kill)" : "") : ""; - builder.Append($"[{bossName}]({data.LogData.Permalink}){successText}\n"); + string duration = (data.LogData.ExtraJSON == null) ? "" : $" {data.LogData.ExtraJSON.Duration}"; + string successText = (showSuccess) ? ((data.LogData.Encounter.Success ?? false) ? " :white_check_mark:" : " ❌") : ""; + builder.Append($"[{bossName}]({data.LogData.Permalink}){duration}{successText}\n"); } } if (FractalLogs.Count > 0) @@ -280,20 +283,21 @@ public async Task ExecuteSessionAllActiveWebhooksAsync(List repor }; var discordContentEmbed = new DiscordAPIJSONContentEmbed() { - Title = "Log session", + Title = sessionName, Description = builder.ToString(), Color = 32768, Thumbnail = discordContentEmbedThumbnail }; var discordContent = new DiscordAPIJSONContent() { + Content = contentText, Embeds = new List() { discordContentEmbed } }; try { var serialiser = new JavaScriptSerializer(); serialiser.RegisterConverters(new[] { new DiscordAPIJSONContentConverter() }); - string jsonContentWithoutPlayers = serialiser.Serialize(discordContent); + string jsonContent = serialiser.Serialize(discordContent); foreach (var key in AllWebhooks.Keys) { var webhook = AllWebhooks[key]; @@ -302,7 +306,7 @@ public async Task ExecuteSessionAllActiveWebhooksAsync(List repor continue; } var uri = new Uri(webhook.URL); - using (var content = new StringContent(jsonContentWithoutPlayers, Encoding.UTF8, "application/json")) + using (var content = new StringContent(jsonContent, Encoding.UTF8, "application/json")) { using (await mainLink.HttpClientController.MainHttpClient.PostAsync(uri, content)) { } } @@ -316,6 +320,11 @@ public async Task ExecuteSessionAllActiveWebhooksAsync(List repor { mainLink.AddToText(">:> Unable to execute active webhooks with finished log session."); } + RaidLogs = null; + FractalLogs = null; + WvWLogs = null; + GolemLogs = null; + discordContent = null; } private void toolStripMenuItemAdd_Click(object sender, EventArgs e) diff --git a/Forms/FormLogSession.Designer.cs b/Forms/FormLogSession.Designer.cs index c0e6576..49bb513 100644 --- a/Forms/FormLogSession.Designer.cs +++ b/Forms/FormLogSession.Designer.cs @@ -32,6 +32,12 @@ private void InitializeComponent() this.checkBoxSupressWebhooks = new System.Windows.Forms.CheckBox(); this.checkBoxOnlySuccess = new System.Windows.Forms.CheckBox(); this.buttonUnPauseSession = new System.Windows.Forms.Button(); + this.textBoxSessionName = new System.Windows.Forms.TextBox(); + this.labelSessionName = new System.Windows.Forms.Label(); + this.groupBoxSessionSettings = new System.Windows.Forms.GroupBox(); + this.labelSessionContent = new System.Windows.Forms.Label(); + this.textBoxSessionContent = new System.Windows.Forms.TextBox(); + this.groupBoxSessionSettings.SuspendLayout(); this.SuspendLayout(); // // buttonSessionStarter @@ -49,7 +55,7 @@ private void InitializeComponent() this.checkBoxSupressWebhooks.AutoSize = true; this.checkBoxSupressWebhooks.Checked = true; this.checkBoxSupressWebhooks.CheckState = System.Windows.Forms.CheckState.Checked; - this.checkBoxSupressWebhooks.Location = new System.Drawing.Point(12, 41); + this.checkBoxSupressWebhooks.Location = new System.Drawing.Point(9, 58); this.checkBoxSupressWebhooks.Name = "checkBoxSupressWebhooks"; this.checkBoxSupressWebhooks.Size = new System.Drawing.Size(271, 17); this.checkBoxSupressWebhooks.TabIndex = 1; @@ -61,7 +67,7 @@ private void InitializeComponent() this.checkBoxOnlySuccess.AutoSize = true; this.checkBoxOnlySuccess.Checked = true; this.checkBoxOnlySuccess.CheckState = System.Windows.Forms.CheckState.Checked; - this.checkBoxOnlySuccess.Location = new System.Drawing.Point(12, 64); + this.checkBoxOnlySuccess.Location = new System.Drawing.Point(9, 81); this.checkBoxOnlySuccess.Name = "checkBoxOnlySuccess"; this.checkBoxOnlySuccess.Size = new System.Drawing.Size(141, 17); this.checkBoxOnlySuccess.TabIndex = 2; @@ -73,30 +79,77 @@ private void InitializeComponent() this.buttonUnPauseSession.Enabled = false; this.buttonUnPauseSession.Location = new System.Drawing.Point(181, 12); this.buttonUnPauseSession.Name = "buttonUnPauseSession"; - this.buttonUnPauseSession.Size = new System.Drawing.Size(102, 23); + this.buttonUnPauseSession.Size = new System.Drawing.Size(116, 23); this.buttonUnPauseSession.TabIndex = 3; this.buttonUnPauseSession.Text = "Pause session"; this.buttonUnPauseSession.UseVisualStyleBackColor = true; this.buttonUnPauseSession.Click += new System.EventHandler(this.ButtonUnPauseSession_Click); // + // textBoxSessionName + // + this.textBoxSessionName.Location = new System.Drawing.Point(9, 32); + this.textBoxSessionName.Name = "textBoxSessionName"; + this.textBoxSessionName.Size = new System.Drawing.Size(270, 20); + this.textBoxSessionName.TabIndex = 4; + // + // labelSessionName + // + this.labelSessionName.AutoSize = true; + this.labelSessionName.Location = new System.Drawing.Point(6, 16); + this.labelSessionName.Name = "labelSessionName"; + this.labelSessionName.Size = new System.Drawing.Size(106, 13); + this.labelSessionName.TabIndex = 5; + this.labelSessionName.Text = "Name of the session:"; + // + // groupBoxSessionSettings + // + this.groupBoxSessionSettings.Controls.Add(this.textBoxSessionContent); + this.groupBoxSessionSettings.Controls.Add(this.labelSessionContent); + this.groupBoxSessionSettings.Controls.Add(this.textBoxSessionName); + this.groupBoxSessionSettings.Controls.Add(this.labelSessionName); + this.groupBoxSessionSettings.Controls.Add(this.checkBoxOnlySuccess); + this.groupBoxSessionSettings.Controls.Add(this.checkBoxSupressWebhooks); + this.groupBoxSessionSettings.Location = new System.Drawing.Point(12, 41); + this.groupBoxSessionSettings.Name = "groupBoxSessionSettings"; + this.groupBoxSessionSettings.Size = new System.Drawing.Size(285, 146); + this.groupBoxSessionSettings.TabIndex = 6; + this.groupBoxSessionSettings.TabStop = false; + this.groupBoxSessionSettings.Text = "Session settings"; + // + // labelSessionContent + // + this.labelSessionContent.AutoSize = true; + this.labelSessionContent.Location = new System.Drawing.Point(6, 101); + this.labelSessionContent.Name = "labelSessionContent"; + this.labelSessionContent.Size = new System.Drawing.Size(91, 13); + this.labelSessionContent.TabIndex = 6; + this.labelSessionContent.Text = "Discord message:"; + // + // textBoxSessionContent + // + this.textBoxSessionContent.Location = new System.Drawing.Point(9, 117); + this.textBoxSessionContent.Name = "textBoxSessionContent"; + this.textBoxSessionContent.Size = new System.Drawing.Size(270, 20); + this.textBoxSessionContent.TabIndex = 7; + // // FormLogSession // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(295, 91); + this.ClientSize = new System.Drawing.Size(309, 196); + this.Controls.Add(this.groupBoxSessionSettings); this.Controls.Add(this.buttonUnPauseSession); - this.Controls.Add(this.checkBoxOnlySuccess); - this.Controls.Add(this.checkBoxSupressWebhooks); this.Controls.Add(this.buttonSessionStarter); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; this.MaximizeBox = false; this.MinimizeBox = false; this.Name = "FormLogSession"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; - this.Text = "Log session settings"; + this.Text = "Log sessions"; this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FormLogSession_FormClosing); + this.groupBoxSessionSettings.ResumeLayout(false); + this.groupBoxSessionSettings.PerformLayout(); this.ResumeLayout(false); - this.PerformLayout(); } @@ -106,5 +159,10 @@ private void InitializeComponent() public System.Windows.Forms.CheckBox checkBoxSupressWebhooks; public System.Windows.Forms.CheckBox checkBoxOnlySuccess; private System.Windows.Forms.Button buttonUnPauseSession; + private System.Windows.Forms.Label labelSessionName; + private System.Windows.Forms.GroupBox groupBoxSessionSettings; + public System.Windows.Forms.TextBox textBoxSessionName; + private System.Windows.Forms.Label labelSessionContent; + public System.Windows.Forms.TextBox textBoxSessionContent; } } \ No newline at end of file diff --git a/Forms/FormLogSession.cs b/Forms/FormLogSession.cs index c152ff7..9711a15 100644 --- a/Forms/FormLogSession.cs +++ b/Forms/FormLogSession.cs @@ -1,4 +1,5 @@ using System; +using System.Diagnostics; using System.Windows.Forms; namespace PlenBotLogUploader @@ -12,6 +13,7 @@ public partial class FormLogSession : Form // fields private FormMain mainLink; private bool sessionPaused = false; + private readonly Stopwatch stopWatch = new Stopwatch(); #endregion public FormLogSession(FormMain mainLink) @@ -25,6 +27,8 @@ private void FormLogSession_FormClosing(object sender, FormClosingEventArgs e) { e.Cancel = true; Hide(); + Properties.Settings.Default.SessionName = textBoxSessionName.Text; + Properties.Settings.Default.SessionMessage = textBoxSessionContent.Text; } private async void ButtonSessionStarter_Click(object sender, EventArgs e) @@ -36,7 +40,19 @@ private async void ButtonSessionStarter_Click(object sender, EventArgs e) buttonUnPauseSession.Enabled = false; SessionRunning = false; sessionPaused = false; - await mainLink.ExecuteSessionLogWebhooksAsync(!checkBoxOnlySuccess.Checked); + groupBoxSessionSettings.Enabled = true; + stopWatch.Stop(); + var elapsed = stopWatch.Elapsed; + string elapsedTime = $"{elapsed.Seconds}s"; + if (elapsed.Hours > 0 || elapsed.Days > 0) + { + elapsedTime = $"{elapsed.Days * 24 + elapsed.Hours}h {elapsed.Minutes}m {elapsed.Seconds}s"; + } + else if (elapsed.Minutes > 0) + { + elapsedTime = $"{elapsed.Minutes}m {elapsed.Seconds}s"; + } + await mainLink.ExecuteSessionLogWebhooksAsync(textBoxSessionName.Text, textBoxSessionContent.Text, !checkBoxOnlySuccess.Checked, elapsedTime); mainLink.SessionLogs.Clear(); } else @@ -46,6 +62,8 @@ private async void ButtonSessionStarter_Click(object sender, EventArgs e) buttonUnPauseSession.Enabled = true; SessionRunning = true; sessionPaused = false; + groupBoxSessionSettings.Enabled = false; + stopWatch.Start(); } } @@ -64,5 +82,9 @@ private void ButtonUnPauseSession_Click(object sender, EventArgs e) buttonUnPauseSession.Text = "Pause session"; } } + + public void CheckBoxSupressWebhooks_CheckedChanged(object sender, EventArgs e) => Properties.Settings.Default.SessionSuppressWebhooks = checkBoxSupressWebhooks.Checked; + + public void CheckBoxOnlySuccess_CheckedChanged(object sender, EventArgs e) => Properties.Settings.Default.SessionOnlySuccess = checkBoxOnlySuccess.Checked; } } diff --git a/Forms/FormMain.Designer.cs b/Forms/FormMain.Designer.cs index aa73fbf..59e0e10 100644 --- a/Forms/FormMain.Designer.cs +++ b/Forms/FormMain.Designer.cs @@ -239,7 +239,7 @@ private void InitializeComponent() this.buttonSession.Name = "buttonSession"; this.buttonSession.Size = new System.Drawing.Size(188, 23); this.buttonSession.TabIndex = 13; - this.buttonSession.Text = "Log session settings"; + this.buttonSession.Text = "Log sessions"; this.buttonSession.UseVisualStyleBackColor = true; this.buttonSession.Click += new System.EventHandler(this.ButtonSession_Click); // diff --git a/Forms/FormMain.cs b/Forms/FormMain.cs index bcde6de..1cce6f7 100644 --- a/Forms/FormMain.cs +++ b/Forms/FormMain.cs @@ -22,7 +22,7 @@ public partial class FormMain : Form { #region definitions // properties - public DPSReportJSON LastLog { get; set; } + public string LastLogLocation { get; set; } = ""; public List SessionLogs { get; set; } = new List(); public bool ChannelJoined { get; set; } = false; public string DPSReportServer { get; set; } = ""; @@ -48,7 +48,7 @@ public partial class FormMain : Form // constants private const int minFileSize = 12288; - private const int uploaderBuild = 40; + private const int uploaderBuild = 41; #endregion #region constructor @@ -175,6 +175,10 @@ public FormMain() twitchCommandsLink.textBoxUploaderCommand.Text = Properties.Settings.Default.TwitchCommandUploader; twitchCommandsLink.checkBoxLastLogEnable.Checked = Properties.Settings.Default.TwitchCommandLastLogEnabled; twitchCommandsLink.textBoxLastLogCommand.Text = Properties.Settings.Default.TwitchCommandLastLog; + logSessionLink.textBoxSessionName.Text = Properties.Settings.Default.SessionName; + logSessionLink.checkBoxSupressWebhooks.Checked = Properties.Settings.Default.SessionSuppressWebhooks; + logSessionLink.checkBoxOnlySuccess.Checked = Properties.Settings.Default.SessionOnlySuccess; + logSessionLink.textBoxSessionContent.Text = Properties.Settings.Default.SessionMessage; if (Properties.Settings.Default.FirstRun) { MessageBox.Show("It looks like this is the first time you are running this program.\nIf you have any issues feel free to contact me directly by Twitch, Discord (@Plenyx#1029) or on GitHub!\n\nPlenyx", "Thank you for using PlenBotLogUploader", MessageBoxButtons.OK, MessageBoxIcon.Information); @@ -226,6 +230,8 @@ public FormMain() checkBoxTwitchOnlySuccess.CheckedChanged += new EventHandler(checkBoxTwitchOnlySuccess_CheckedChanged); checkBoxStartWhenWindowsStarts.CheckedChanged += new EventHandler(checkBoxStartWhenWindowsStarts_CheckedChanged); raidarLink.checkBoxEnableRaidar.CheckedChanged += new EventHandler(raidarLink.checkBoxEnableRaidar_CheckedChanged); + logSessionLink.checkBoxSupressWebhooks.CheckedChanged += new EventHandler(logSessionLink.CheckBoxSupressWebhooks_CheckedChanged); + logSessionLink.checkBoxOnlySuccess.CheckedChanged += new EventHandler(logSessionLink.CheckBoxOnlySuccess_CheckedChanged); } catch { @@ -270,13 +276,13 @@ private void FormMain_DragEnter(object sender, DragEventArgs e) } } - private async void FormMain_DragDrop(object sender, DragEventArgs e) + private void FormMain_DragDrop(object sender, DragEventArgs e) { - string[] files = (string[])e.Data.GetData(DataFormats.FileDrop); - await Task.Run(() => DoDragDropFiles(files)); + var files = ((string[])e.Data.GetData(DataFormats.FileDrop)).ToList(); + Task.Run(() => DoDragDropFiles(files)); } - protected void DoDragDropFiles(string[] files) + protected void DoDragDropFiles(List files) { Dictionary postData = new Dictionary { @@ -532,7 +538,7 @@ public async Task SendLogToTwitchChatAsync(DPSReportJSON reportJSON, bool bypass if (ChannelJoined && checkBoxPostToTwitch.Checked && !bypassMessage) { AddToText($">:> {reportJSON.Permalink}"); - LastLog = reportJSON; + LastLogLocation = reportJSON.Permalink; var bossDataRef = bossDataLink.AllBosses .Where(anon => anon.Value.BossId.Equals(reportJSON.Encounter.BossId)) .Select(anon => anon.Value); @@ -618,6 +624,14 @@ public async void HttpUploadLogAsync(string file, Dictionary pos DPSReportJSON reportJSON = new JavaScriptSerializer().Deserialize(response); bossId = reportJSON.Encounter.BossId; string success = (reportJSON.Encounter.Success ?? false) ? "true" : "false"; + // extra JSON from Elite Insights + if (reportJSON.Encounter.JsonAvailable ?? false) + { + string jsonString = await HttpClientController.DownloadFileToStringAsync($"https://{DPSReportServer}/getJson?permalink={reportJSON.Permalink}"); + JavaScriptSerializer serilizer = new JavaScriptSerializer() { MaxJsonLength = 5000000 }; + DPSReportJSONExtraJSON extraJSON = serilizer.Deserialize(jsonString); + reportJSON.ExtraJSON = extraJSON; + } // log file File.AppendAllText($"{LocalDir}logs.csv", $"{reportJSON.Encounter.Boss};{reportJSON.Encounter.BossId};{success};{reportJSON.Evtc.Type}{reportJSON.Evtc.Version};{reportJSON.Permalink}\n"); // Twitch chat @@ -655,10 +669,12 @@ public async void HttpUploadLogAsync(string file, Dictionary pos } // remote server ping await pingsLink.ExecuteAllPingsAsync(reportJSON); + // dispose + reportJSON = null; } catch { - AddToText($">:> Unable to upload file {Path.GetFileName(file)}, dps.report responded with invalid permanent link"); + AddToText($">:> Unable to process file {Path.GetFileName(file)}, dps.report responded with invalid permanent link"); } } } @@ -695,7 +711,7 @@ public async void HttpUploadLogAsync(string file, Dictionary pos } } - public async Task ExecuteSessionLogWebhooksAsync(bool showSuccess) => await discordWebhooksLink.ExecuteSessionAllActiveWebhooksAsync(SessionLogs, bossDataLink.AllBosses, showSuccess); + public async Task ExecuteSessionLogWebhooksAsync(string sessionName, string contentText, bool showSuccess, string elapsedTime) => await discordWebhooksLink.ExecuteSessionAllActiveWebhooksAsync(SessionLogs, bossDataLink.AllBosses, sessionName, contentText, showSuccess, elapsedTime); #endregion #region Twitch bot methods @@ -849,10 +865,10 @@ protected async void ReadMessagesAsync(object sender, IrcMessageEventArgs e) } else if (command.Equals(twitchCommandsLink.textBoxLastLogCommand.Text.ToLower()) && twitchCommandsLink.checkBoxLastLogEnable.Checked) { - if (LastLog != null) + if (LastLogLocation != "") { AddToText("> LAST LOG COMMAND USED"); - await chatConnect.SendChatMessageAsync(Properties.Settings.Default.TwitchChannelName, $"Link to the last {LastLog.Encounter.Boss} log: {LastLog.Permalink}"); + await chatConnect.SendChatMessageAsync(Properties.Settings.Default.TwitchChannelName, $"Link to the last log: {LastLogLocation}"); } } } diff --git a/PlenBotLogUploader.csproj b/PlenBotLogUploader.csproj index 06e834f..b64c286 100644 --- a/PlenBotLogUploader.csproj +++ b/PlenBotLogUploader.csproj @@ -92,6 +92,7 @@ + diff --git a/Properties/Settings.Designer.cs b/Properties/Settings.Designer.cs index 956fe16..3513692 100644 --- a/Properties/Settings.Designer.cs +++ b/Properties/Settings.Designer.cs @@ -310,5 +310,53 @@ public bool FirstUpdate { this["FirstUpdate"] = value; } } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("Log session")] + public string SessionName { + get { + return ((string)(this["SessionName"])); + } + set { + this["SessionName"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("True")] + public bool SessionSuppressWebhooks { + get { + return ((bool)(this["SessionSuppressWebhooks"])); + } + set { + this["SessionSuppressWebhooks"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("True")] + public bool SessionOnlySuccess { + get { + return ((bool)(this["SessionOnlySuccess"])); + } + set { + this["SessionOnlySuccess"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("")] + public string SessionMessage { + get { + return ((string)(this["SessionMessage"])); + } + set { + this["SessionMessage"] = value; + } + } } } diff --git a/Properties/Settings.settings b/Properties/Settings.settings index 938ce9a..2c3f899 100644 --- a/Properties/Settings.settings +++ b/Properties/Settings.settings @@ -74,5 +74,17 @@ True + + Log session + + + True + + + True + + + + \ No newline at end of file diff --git a/VERSION b/VERSION index 86ee83a..aaa6442 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -40 \ No newline at end of file +41 \ No newline at end of file