[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:
@@ -1,5 +1,5 @@
|
||||
import {
|
||||
c, SEP, now,
|
||||
c, now,
|
||||
formatType, formatContext, formatBody, formatReply,
|
||||
} from "./formatter.js";
|
||||
|
||||
@@ -8,7 +8,7 @@ import {
|
||||
* Cada método lida apenas com saída — sem lógica de negócio ou I/O externo.
|
||||
*/
|
||||
export const logger = {
|
||||
info: (...a) => console.log(`${SEP}\n${c.gray}[${now()}]${c.reset} ${c.cyan}INFO ${c.reset}`, ...a),
|
||||
info: (...a) => console.log(`${c.gray}[${now()}]${c.reset} ${c.cyan}INFO ${c.reset}`, ...a),
|
||||
success: (...a) => console.log(`${c.gray}[${now()}]${c.reset} ${c.green}OK ${c.reset}`, ...a),
|
||||
warn: (...a) => console.log(`${c.gray}[${now()}]${c.reset} ${c.yellow}WARN ${c.reset}`, ...a),
|
||||
error: (...a) => console.log(`${c.gray}[${now()}]${c.reset} ${c.red}ERROR ${c.reset}`, ...a),
|
||||
@@ -18,23 +18,10 @@ export const logger = {
|
||||
* @param {import("./messageContext.js").MessageContext} ctx
|
||||
*/
|
||||
msg(ctx) {
|
||||
const { chatName, isGroup, senderName, senderNumber, type, body, isCommand, quoted } = ctx;
|
||||
|
||||
const typeLabel = formatType(type);
|
||||
const context = formatContext(chatName, isGroup);
|
||||
const bodyText = formatBody(body, isCommand);
|
||||
const replyLine = quoted
|
||||
? formatReply(quoted.name, quoted.number, quoted.preview)
|
||||
: "";
|
||||
|
||||
console.log(
|
||||
`${SEP}\n` +
|
||||
`${c.gray}[${now()}]${c.reset} ${c.cyan}MSG ${c.reset}${context}\n` +
|
||||
`${c.gray} De: ${c.reset}${c.white}${senderName}${c.reset} ${c.dim}+${senderNumber}${c.reset}\n` +
|
||||
`${c.gray} Tipo: ${c.reset}${typeLabel}${isCommand ? ` ${c.yellow}(bot)${c.reset}` : ""}\n` +
|
||||
`${c.gray} Text: ${c.reset}${bodyText}` +
|
||||
replyLine
|
||||
);
|
||||
const { chatName, isGroup, senderName, senderNumber, type, body, quoted } = ctx;
|
||||
const context = isGroup ? `${chatName} (grupo)` : chatName;
|
||||
const reply = quoted ? ` → Responde ${quoted.name} +${quoted.number}: "${quoted.preview}"` : "";
|
||||
console.log(`\n${c.gray}[${now()}]${c.reset} ${c.cyan}MSG${c.reset} ${context} ${c.gray}— De:${c.reset} ${c.white}${senderName}${c.reset} ${c.dim}+${senderNumber}${c.reset} ${c.gray}— Tipo:${c.reset} ${type} — ${c.green}"${body}"${c.reset}${c.gray}${reply}${c.reset}`);
|
||||
},
|
||||
|
||||
cmd: (cmd, extra = "") =>
|
||||
|
||||
Reference in New Issue
Block a user