[repo] reorganization using plugins instead of built-in commands, [plugin] new game: forca, [dev] changes on log format, [config] removed botMsg, [plugin] on stickers, you can create just one sending an image or replying to one, [setup] exec permissions and comand to install Chrome

This commit is contained in:
synt-xerror
2026-03-23 21:25:09 -03:00
parent f9911f6cf3
commit c75b6249c1
44 changed files with 1589 additions and 786 deletions

View File

@@ -1,8 +1,30 @@
import client from "./client/whatsappClient.js";
import { handleMessage } from "./handlers/messageHandler.js";
import { logger } from "./logger/logger.js";
/**
* main.js
*
* Ponto de entrada do ManyBot.
* Inicializa o cliente WhatsApp e carrega os plugins.
*/
logger.info("Iniciando ManyBot...");
import client from "./client/whatsappClient.js";
import { handleMessage } from "./kernel/messageHandler.js";
import { loadPlugins } from "./kernel/pluginLoader.js";
import { logger } from "./logger/logger.js";
import { PLUGINS } from "./config.js";
logger.info("Iniciando ManyBot...\n");
// Rede de segurança global — nenhum erro deve derrubar o bot
process.on("uncaughtException", (err) => {
logger.error(`uncaughtException — ${err.message}`, `\n Stack: ${err.stack?.split("\n")[1]?.trim() ?? ""}`);
});
process.on("unhandledRejection", (reason) => {
const msg = reason instanceof Error ? reason.message : String(reason);
logger.error(`unhandledRejection — ${msg}`);
});
// Carrega plugins antes de conectar
await loadPlugins(PLUGINS);
client.on("message_create", async (msg) => {
try {
@@ -16,4 +38,5 @@ client.on("message_create", async (msg) => {
});
client.initialize();
console.log("\n");
logger.info("Cliente inicializado. Aguardando conexão com WhatsApp...");