Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a6fda095d8 | ||
|
|
372f644995 |
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "manybot",
|
"name": "manybot",
|
||||||
"version": "2.4.0",
|
"version": "2.4.1",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "manybot",
|
"name": "manybot",
|
||||||
"version": "2.4.0",
|
"version": "2.4.1",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"node-addon-api": "^7",
|
"node-addon-api": "^7",
|
||||||
"node-gyp": "^12.2.0",
|
"node-gyp": "^12.2.0",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "manybot",
|
"name": "manybot",
|
||||||
"version": "2.4.0",
|
"version": "2.4.1",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"node-addon-api": "^7",
|
"node-addon-api": "^7",
|
||||||
|
|||||||
@@ -27,17 +27,13 @@ export async function handleMessage(msg) {
|
|||||||
const chat = await msg.getChat();
|
const chat = await msg.getChat();
|
||||||
const chatId = getChatId(chat);
|
const chatId = getChatId(chat);
|
||||||
|
|
||||||
// Filtra chats não autorizados
|
// CHATS vazio = aceita todos os chats
|
||||||
if (!CHATS.includes(chatId)) return;
|
if (CHATS.length > 0 && !CHATS.includes(chatId)) return;
|
||||||
|
|
||||||
// Loga a mensagem recebida
|
|
||||||
const ctx = await buildMessageContext(msg, chat);
|
const ctx = await buildMessageContext(msg, chat);
|
||||||
logger.msg(ctx);
|
logger.msg(ctx);
|
||||||
|
|
||||||
// Monta a api que será passada para os plugins
|
|
||||||
const api = buildApi({ msg, chat, pluginRegistry });
|
const api = buildApi({ msg, chat, pluginRegistry });
|
||||||
|
|
||||||
// Distribui para todos os plugins ativos
|
|
||||||
const context = { msg: api.msg, chat: api.chat, api };
|
const context = { msg: api.msg, chat: api.chat, api };
|
||||||
|
|
||||||
for (const plugin of pluginRegistry.values()) {
|
for (const plugin of pluginRegistry.values()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user