2 Commits
2.4.1 ... 2.4.2

Author SHA1 Message Date
synt-xerror
a6fda095d8 [fix] if CHATS is empty, the bot listen to all chats 2026-03-23 21:45:20 -03:00
synt-xerror
372f644995 Bump version to 2.4.1 2026-03-23 21:45:17 -03:00
3 changed files with 11 additions and 15 deletions

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{
"name": "manybot",
"version": "2.4.0",
"version": "2.4.1",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "manybot",
"version": "2.4.0",
"version": "2.4.1",
"dependencies": {
"node-addon-api": "^7",
"node-gyp": "^12.2.0",

View File

@@ -1,6 +1,6 @@
{
"name": "manybot",
"version": "2.4.0",
"version": "2.4.1",
"type": "module",
"dependencies": {
"node-addon-api": "^7",

View File

@@ -26,23 +26,19 @@ import { logger } from "../logger/logger.js";
export async function handleMessage(msg) {
const chat = await msg.getChat();
const chatId = getChatId(chat);
// Filtra chats não autorizados
if (!CHATS.includes(chatId)) return;
// Loga a mensagem recebida
// CHATS vazio = aceita todos os chats
if (CHATS.length > 0 && !CHATS.includes(chatId)) return;
const ctx = await buildMessageContext(msg, chat);
logger.msg(ctx);
// Monta a api que será passada para os plugins
const api = buildApi({ msg, chat, pluginRegistry });
// Distribui para todos os plugins ativos
const api = buildApi({ msg, chat, pluginRegistry });
const context = { msg: api.msg, chat: api.chat, api };
for (const plugin of pluginRegistry.values()) {
await runPlugin(plugin, context);
}
logger.done("message_create", `de +${ctx.senderNumber}`);
}