@manybot/manybot 5.5.2 → 5.5.4

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.
@@ -36,6 +36,8 @@ export function createStore() {
36
36
  // Max messages kept per chat (prevents unbounded memory growth)
37
37
  const MAX_MSGS_PER_CHAT = 200;
38
38
  function upsertChat(chat) {
39
+ if (!chat.id)
40
+ return;
39
41
  const name = chat.name ?? chat.id.split("@")[0];
40
42
  chatsMap.set(chat.id, { id: chat.id, name });
41
43
  }
@@ -5,6 +5,7 @@
5
5
  * Handles auth state persistence, QR/pairing-code display, and reconnection.
6
6
  */
7
7
  import { makeWASocket, useMultiFileAuthState, fetchLatestBaileysVersion, Browsers, WAProto, } from "@whiskeysockets/baileys";
8
+ import { EventEmitter } from "events";
8
9
  import path from "path";
9
10
  import qrcode from "qrcode-terminal";
10
11
  import { CONFIG_DIR, CLIENT_ID } from "#config";
@@ -15,6 +16,10 @@ import { createStore } from "#client/store.js";
15
16
  import { CapabilitySet } from "#core/capabilities.js";
16
17
  import pino from "pino";
17
18
  // ── Auth path ─────────────────────────────────────────────────────────────────
19
+ // Baileys' sock.ev wraps an internal EventEmitter that no longer exposes
20
+ // setMaxListeners (see the comment in createSocket() below) — raised
21
+ // globally instead, before makeWASocket() ever constructs one.
22
+ EventEmitter.defaultMaxListeners = 50;
18
23
  export const AUTH_DIR = path.join(CONFIG_DIR, "sessions", CLIENT_ID);
19
24
  // ── Shared store (survives socket reconnects) ─────────────────────────────────
20
25
  export const store = createStore();
@@ -74,8 +79,12 @@ export async function createSocket(authDirName = CLIENT_ID) {
74
79
  // of plugins — it's expected, not a leak. Reconnects don't add to this:
75
80
  // createSocket() always returns a fresh emitter and the caller tears
76
81
  // down the previous one.
77
- const evAsEmitter = sock.ev;
78
- evAsEmitter.setMaxListeners?.(50);
82
+ //
83
+ // Baileys 7.x's sock.ev is a buffered-event wrapper (makeEventBuffer),
84
+ // not a raw EventEmitter — it has no setMaxListeners of its own, so
85
+ // calling it here is a silent no-op. The cap is raised globally instead,
86
+ // via EventEmitter.defaultMaxListeners set at module load (before any
87
+ // socket — and its internal emitter — is created).
79
88
  sock.ev.on("creds.update", saveCreds);
80
89
  // QR code — only if the chosen method was "qr" (intentionally ignores
81
90
  // PHONE_NUMBER even if one was saved from a previous choice).
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "name": "SyntaxError!",
6
6
  "email": "me@stxerr.dev"
7
7
  },
8
- "version": "5.5.2",
8
+ "version": "5.5.4",
9
9
  "license": "GPL-3.0-only",
10
10
  "private": false,
11
11
  "engines": {
@@ -37,7 +37,7 @@
37
37
  "dependencies": {
38
38
  "@clack/prompts": "^0.10.1",
39
39
  "@hapi/boom": "^10.0.1",
40
- "@whiskeysockets/baileys": "^6.6.0",
40
+ "@whiskeysockets/baileys": "6.7.23",
41
41
  "node-cron": "^4.6.0",
42
42
  "node-webpmux": "^3.2.1",
43
43
  "pino": "^10.3.1",