From 9c42552a0f59f44a264bf95c8ce68410913d2285 Mon Sep 17 00:00:00 2001 From: Madpeter <57852827+Madpeterz@users.noreply.github.com> Date: Sat, 1 Feb 2025 23:52:41 +0000 Subject: [PATCH] add debug support to interaction --- Dockerfile | 1 + SecondBotEvents/Config/InteractionConfig.cs | 6 ++++++ SecondBotEvents/Services/InteractionService.cs | 8 ++++++++ 3 files changed, 15 insertions(+) diff --git a/Dockerfile b/Dockerfile index 194de4f..dc90205 100644 --- a/Dockerfile +++ b/Dockerfile @@ -91,6 +91,7 @@ ENV basic_Username='' \ interaction_InventoryTransferLevel='Owner' \ interaction_GroupInviteLevel='Owner' \ interaction_TeleportRequestLevel='Owner' \ + interaction_EnableDebug='false' \ commands_HideStatusOutput='false' \ datastore_HideStatusOutput='false' \ discord_HideStatusOutput='false' \ diff --git a/SecondBotEvents/Config/InteractionConfig.cs b/SecondBotEvents/Config/InteractionConfig.cs index 991094a..9612224 100644 --- a/SecondBotEvents/Config/InteractionConfig.cs +++ b/SecondBotEvents/Config/InteractionConfig.cs @@ -22,6 +22,12 @@ namespace SecondBotEvents.Config settings.Add("TeleportRequestLevel"); settings.Add("Enabled"); settings.Add("HideStatusOutput"); + settings.Add("EnableDebug"); + } + + public bool GetEnableDebug() + { + return ReadSettingAsBool("EnableDebug", false); } public string GetFriendRequestLevel() diff --git a/SecondBotEvents/Services/InteractionService.cs b/SecondBotEvents/Services/InteractionService.cs index 1714132..ea57a26 100644 --- a/SecondBotEvents/Services/InteractionService.cs +++ b/SecondBotEvents/Services/InteractionService.cs @@ -114,6 +114,10 @@ namespace SecondBotEvents.Services protected void JsonOuput(bool status, string eventype, string from, string why="", Dictionary setMisc = null) { + if(myConfig.GetEnableDebug() == true) + { + LogFormater.Warn("Interaction debug:" + JsonConvert.SerializeObject(new InteractionEvent(from, eventype, status, why, setMisc))); + } if (myConfig.GetEnableJsonOutputEvents() == false) { return; @@ -134,6 +138,10 @@ namespace SecondBotEvents.Services protected void JsonOuputCleaner(Dictionary misc, string source) { + if (myConfig.GetEnableDebug() == true) + { + LogFormater.Warn("Interaction debug:" + JsonConvert.SerializeObject(misc)); + } if (myConfig.GetEnableJsonOutputEvents() == false) { return;