From cc5e262ccb03b3b9c579bda8acf9f5af5207887a Mon Sep 17 00:00:00 2001 From: Tea Date: Thu, 9 Jul 2026 23:21:25 -0400 Subject: [PATCH] 1.12.4 --- main.ts | 21 ++++++++++++++++----- manifest.json | 2 +- package.json | 2 +- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/main.ts b/main.ts index 0a165b3..31daabc 100644 --- a/main.ts +++ b/main.ts @@ -60,6 +60,8 @@ interface SceneState { timestamp?: string | null; your_last_post?: string | null; posted_since_count?: number | null; + initializing?: boolean; + source?: string; } interface SceneQueryResponse { @@ -1116,14 +1118,23 @@ export default class MultimuseObsidian extends Plugin { // Use replied or is_from_character (API may send either) const repliedRaw = state.replied ?? state.is_from_character; if (repliedRaw === undefined || repliedRaw === null) { - console.log(`[MultimuseObsidian] ${file.basename}: state.replied/is_from_character is undefined/null - skipping update`); + if (state.initializing) { + console.log(`[MultimuseObsidian] ${file.basename}: API still initializing turn state - skipping update`); + } else { + console.log(`[MultimuseObsidian] ${file.basename}: state.replied/is_from_character is undefined/null - skipping update`); + } return false; } - // Check if the state looks suspicious (e.g., bot couldn't access channel) - // If timestamp is null and your_last_post is null, it might indicate the bot couldn't read the channel - // In this case, don't update the Replied? field to avoid incorrect updates - if (state.timestamp === null && state.your_last_post === null && state.posted_since_count === 0) { + // Legacy guard for uninitialized in-memory state without thread_tracker anchors. + // thread_tracker responses include DB anchors or source=thread_tracker — trust those. + const fromThreadTracker = state.source === 'thread_tracker'; + if ( + !fromThreadTracker && + state.timestamp === null && + state.your_last_post === null && + (state.posted_since_count ?? 0) === 0 + ) { console.log(`[MultimuseObsidian] ${file.basename}: State appears invalid (timestamp and your_last_post are null) - likely bot can't access channel. Skipping update to prevent incorrect "Replied?" value.`); return false; } diff --git a/manifest.json b/manifest.json index 9b47d3c..78bee14 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "multimuse-tracker", "name": "Multimuse Tracker", - "version": "1.12.3", + "version": "1.12.4", "minAppVersion": "1.4.0", "description": "Roleplay sync tool for use with the MultiMuse bot in discord.", "author": "BackstagePass Group", diff --git a/package.json b/package.json index 27db044..b3aa75c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "multimuse-tracker", - "version": "1.12.3", + "version": "1.12.4", "description": "MultiMuse bot integration for tracking Discord threads and sending messages as muses", "main": "main.js", "scripts": {