private void CombatEnded(bool isImport, CombatToggleEventArgs encounterInfo) { if (PluginUtil.IsPluginEnabled()) { try { Log Log = PluginUtil.ACTEncounterToModel(encounterInfo.encounter); if (Log != null) { string Json = PluginUtil.ToJson(Log); bool Sent = Service.PostDiscord(Json, PluginSettings.GetSetting <string>("Token")); if (Sent) { PluginControl.LogInfo("Parse sent to your Discord channel."); PluginControl.LogInfo("Waiting the next encounter..."); } else { PluginControl.LogInfo("Could not send the parse to your Discord channel. Check your token."); } } else { PluginControl.LogInfo("Nothing to be sent. Waiting the next encounter..."); } } catch (Exception ex) { PluginControl.LogInfo("Something went wrong. " + ex.Message); } } }
private void CombatEnded(bool isImport, CombatToggleEventArgs encounterInfo) { if (PluginUtil.IsPluginEnabled()) { try { Log Log = PluginUtil.ACTEncounterToModel(encounterInfo.encounter); if (Log != null) { if (PluginSettings.GetSetting <bool>("TimeEnabled") == true && PluginUtil.TimeBetween(DateTime.Now, DateTime.Parse(PluginSettings.GetSetting <string>("StartTime")).TimeOfDay, DateTime.Parse(PluginSettings.GetSetting <string>("EndTime")).TimeOfDay) == false) { PluginControl.LogInfo("Parse *not* sent to your Discord channel due to time lock rules."); PluginControl.LogInfo("Waiting for the next encounter..."); return; } string Json = PluginUtil.ToJson(Log); bool Sent = Service.PostDiscord(Json, PluginSettings.GetSetting <string>("Token")); if (Sent) { PluginControl.LogInfo("Parse sent to your Discord channel."); PluginControl.LogInfo("Waiting for the next encounter..."); } else { PluginControl.LogInfo("Could not send the parse to your Discord channel. Check your token and permissions."); } } else { PluginControl.LogInfo("Nothing to be sent. Waiting for the next encounter..."); } } catch (Exception e) { PluginControl.LogInfo("Something went wrong. Debug info:" + Environment.NewLine + e.ToString()); } } }