[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:
31
src/main.js
31
src/main.js
@@ -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...");
|
||||
Reference in New Issue
Block a user