whatsapp-pi 1.0.35 → 1.0.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/whatsapp-pi.ts +5 -5
package/package.json
CHANGED
package/whatsapp-pi.ts
CHANGED
|
@@ -59,7 +59,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
59
59
|
};
|
|
60
60
|
|
|
61
61
|
// Initial status setup
|
|
62
|
-
pi.on("session_start", async (
|
|
62
|
+
pi.on("session_start", async (event, ctx) => {
|
|
63
63
|
_ctx = ctx;
|
|
64
64
|
// Check verbose mode
|
|
65
65
|
const isVerboseFlagSet = process.argv.includes("--verbose");
|
|
@@ -111,12 +111,12 @@ export default function (pi: ExtensionAPI) {
|
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
-
// Check whatsapp flag
|
|
115
|
-
const isWhatsappPiOn =
|
|
114
|
+
// Check whatsapp flag — only auto-connect on initial startup, not reloads/new sessions
|
|
115
|
+
const isWhatsappPiOn = event.reason === "startup" && pi.getFlag("whatsapp-pi-online") === true;
|
|
116
116
|
const registered = await sessionManager.isRegistered();
|
|
117
117
|
|
|
118
|
-
if (
|
|
119
|
-
ctx.ui.setStatus('whatsapp',
|
|
118
|
+
if (isWhatsappPiOn && registered) {
|
|
119
|
+
ctx.ui.setStatus('whatsapp', '| WhatsApp: Auto-connecting...');
|
|
120
120
|
|
|
121
121
|
// Retry logic (max 3 attempts, 3s delay)
|
|
122
122
|
let attempts = 0;
|