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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/whatsapp-pi.ts +5 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "whatsapp-pi",
3
- "version": "1.0.35",
3
+ "version": "1.0.36",
4
4
  "type": "module",
5
5
  "description": "WhatsApp integration extension for Pi",
6
6
  "main": "whatsapp-pi.ts",
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 (_event, ctx) => {
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 = process.argv.includes("--whatsapp-pi-online");
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 (registered || isWhatsappPiOn) {
119
- ctx.ui.setStatus('whatsapp', registered ? '| WhatsApp: Reconnecting...' : '| WhatsApp: Auto-connecting...');
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;