@manybot/manybot 4.1.1 → 4.1.3

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/README.md CHANGED
@@ -2,8 +2,6 @@
2
2
 
3
3
  ![ManyBot Logo](logo.png)
4
4
 
5
- **Just a cool open source WhatsApp bot**
6
-
7
5
  ![Node.js 18+](https://img.shields.io/badge/Node.js-18+-339933?logo=node.js&logoColor=white)
8
6
  ![npm 9+](https://img.shields.io/badge/npm-9+-CB3837?logo=npm&logoColor=white)
9
7
  ![GPL v3](https://img.shields.io/badge/License-GPL--v3-blue.svg)
@@ -14,7 +12,7 @@
14
12
 
15
13
  ---
16
14
 
17
- ManyBot is a free, open source WhatsApp bot built around a modular plugin system. Instead of a monolithic bot with features baked in, ManyBot gives you a lightweight core and lets you pick exactly what you want through plugins - no cloud dependency, no subscription, no black box.
15
+ ManyBot is a free and open-source messaging automation ecosystem for online businesses and communities.
18
16
 
19
17
  ## Requirements
20
18
 
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "name": "SyntaxError!",
6
6
  "email": "me@stxerr.dev"
7
7
  },
8
- "version": "4.1.1",
8
+ "version": "4.1.3",
9
9
  "license": "GPL-3.0-only",
10
10
  "private": false,
11
11
  "engines": {
@@ -267,7 +267,8 @@ export function buildApi({ msg, chat, client, pluginRegistry }) {
267
267
 
268
268
  /** Check if message starts with a command. */
269
269
  is(cmd) {
270
- return msg.body?.trim().toLowerCase().startsWith(cmd.toLowerCase());
270
+ const command = msg.body?.trim().split(/\s+/)[0].toLowerCase();
271
+ return command === cmd.toLowerCase();
271
272
  },
272
273
 
273
274
  hasMedia: msg.hasMedia,
@@ -74,12 +74,32 @@ export async function setupPlugins(api) {
74
74
  }
75
75
  }
76
76
 
77
+ async function findPluginPath(name) {
78
+ // key direto: synt-xerror/figurinha
79
+ const direct = path.join(PLUGINS_DIR, name, "index.js");
80
+ if (fs.existsSync(direct)) return direct;
81
+
82
+ // nome simples em subdir: plugins/synt-xerror/figurinha
83
+ if (!fs.existsSync(PLUGINS_DIR)) return null;
84
+ for (const entry of fs.readdirSync(PLUGINS_DIR, { withFileTypes: true })) {
85
+ if (!entry.isDirectory()) continue;
86
+ const nested = path.join(PLUGINS_DIR, entry.name, name, "index.js");
87
+ if (fs.existsSync(nested)) return nested;
88
+ }
89
+
90
+ return null;
91
+ }
77
92
  /**
78
93
  * Carrega um único plugin pelo nome.
79
94
  * @param {string} name
80
95
  */
81
96
  async function loadPlugin(name) {
82
- const pluginPath = path.join(PLUGINS_DIR, name, "index.js");
97
+ const pluginPath = await findPluginPath(name);
98
+ if (!pluginPath) {
99
+ logger.warn(t("system.pluginNotFound", { name, path: path.join(PLUGINS_DIR, name) }));
100
+ pluginRegistry.set(name, { name, status: "disabled", run: null, exports: null, error: null });
101
+ return;
102
+ }
83
103
 
84
104
  if (!fs.existsSync(pluginPath)) {
85
105
  logger.warn(t("system.pluginNotFound", { name, path: pluginPath }));