[repo] desacoplamento e maior coesão
This commit is contained in:
synt-xerror
2026-03-13 11:30:34 -03:00
parent fe95e77a68
commit 88a7abba5d
19 changed files with 439 additions and 393 deletions

29
src/main.js Normal file
View File

@@ -0,0 +1,29 @@
console.log("Iniciando...");
import client from "./client/whatsappClient.js";
import { CHATS } from "./config.js";
import { processarComando } from "./commands/index.js";
import { processarJogo } from "./games/adivinhacao.js";
import { getChatId } from "./utils/getChatId.js";
client.on("message_create", async msg => {
try {
const chat = await msg.getChat();
const chatId = getChatId(chat);
if (!CHATS.includes(chatId)) return;
console.log("==================================");
console.log(`CHAT NAME : ${chat.name || chat.id.user}`);
console.log(`CHAT ID : ${chatId}`);
console.log(`FROM : ${msg.from}`);
console.log(`BODY : ${msg.body}`);
console.log("==================================\n");
await processarComando(msg, chat, chatId);
await processarJogo(msg, chat);
} catch(err) {
console.error("[ERRO]", err);
}
});
client.initialize();