Skip to content

Commit

Permalink
add debug support to interaction
Browse files Browse the repository at this point in the history
  • Loading branch information
Madpeterz committed Feb 1, 2025
1 parent 4aedf58 commit 9c42552
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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' \
Expand Down
6 changes: 6 additions & 0 deletions SecondBotEvents/Config/InteractionConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ protected override void MakeSettings()
settings.Add("TeleportRequestLevel");
settings.Add("Enabled");
settings.Add("HideStatusOutput");
settings.Add("EnableDebug");
}

public bool GetEnableDebug()
{
return ReadSettingAsBool("EnableDebug", false);
}

public string GetFriendRequestLevel()
Expand Down
8 changes: 8 additions & 0 deletions SecondBotEvents/Services/InteractionService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,10 @@ protected void BotClientRestart(object o, BotClientNotice e)

protected void JsonOuput(bool status, string eventype, string from, string why="", Dictionary<string, string> setMisc = null)
{
if(myConfig.GetEnableDebug() == true)
{
LogFormater.Warn("Interaction debug:" + JsonConvert.SerializeObject(new InteractionEvent(from, eventype, status, why, setMisc)));
}
if (myConfig.GetEnableJsonOutputEvents() == false)
{
return;
Expand All @@ -134,6 +138,10 @@ protected void JsonOuputCleaner(string misc, string source)

protected void JsonOuputCleaner(Dictionary<string, string> misc, string source)
{
if (myConfig.GetEnableDebug() == true)
{
LogFormater.Warn("Interaction debug:" + JsonConvert.SerializeObject(misc));
}
if (myConfig.GetEnableJsonOutputEvents() == false)
{
return;
Expand Down

0 comments on commit 9c42552

Please sign in to comment.