[repo] reorganization

This commit is contained in:
synt-xerror
2026-03-16 18:32:57 -03:00
parent 04765868db
commit e60c5819e2
34 changed files with 1023 additions and 829 deletions

View File

@@ -0,0 +1,44 @@
import { iniciarJogo, pararJogo } from "../logic/games/adivinhacao.js";
import { botMsg } from "../../utils/botMsg.js";
import { logger } from "../../logger/logger.js";
const SUBCOMANDOS = new Map([
["começar", async (chat) => {
iniciarJogo(chat.id._serialized);
await chat.sendMessage(botMsg(
"🎮 *Jogo iniciado!*\n\n" +
"Estou pensando em um número de 1 a 100.\n" +
"Tente adivinhar! 🤔"
));
logger.done("!adivinhação", "jogo iniciado");
}],
["parar", async (chat) => {
pararJogo(chat.id._serialized);
await chat.sendMessage(botMsg("🛑 Jogo encerrado."));
logger.done("!adivinhação", "jogo parado");
}],
]);
export async function cmdAdivinhacao(msg, chat, _chatId, args) {
if (!args[0]) {
await chat.sendMessage(botMsg(
"🎮 *Jogo de adivinhação:*\n\n" +
"`!adivinhação começar` — inicia o jogo\n" +
"`!adivinhação parar` — encerra o jogo"
));
return;
}
const subcomando = SUBCOMANDOS.get(args[0]);
if (!subcomando) {
await chat.sendMessage(botMsg(
`❌ Subcomando *${args[0]}* não existe.\n\n` +
"Use `!adivinhação começar` ou `!adivinhação parar`."
));
logger.warn(`!adivinhação — subcomando desconhecido: ${args[0]}`);
return;
}
await subcomando(chat);
}