Add comprehensive documentation and improvement suggestions for Amayo bot
- Created README.md for static site documentation, detailing features, structure, local usage, and Heroku deployment. - Added RESUMEN_CAMBIOS.md summarizing critical bug fixes, command updates, and documentation enhancements. - Introduced SUGERENCIAS_Y_MEJORAS.md with a thorough analysis of the project, new feature suggestions, and technical improvements.
This commit is contained in:
@@ -1,42 +1,48 @@
|
|||||||
import type { CommandMessage } from '../../../core/types/commands';
|
import type { CommandMessage } from "../../../core/types/commands";
|
||||||
import type Amayo from '../../../core/client';
|
import type Amayo from "../../../core/client";
|
||||||
import { getStreakInfo, updateStreak } from '../../../game/streaks/service';
|
import { getStreakInfo, updateStreak } from "../../../game/streaks/service";
|
||||||
import type { TextBasedChannel } from 'discord.js';
|
import type { TextBasedChannel } from "discord.js";
|
||||||
import { fetchItemBasics, formatItemLabel } from './_helpers';
|
import { fetchItemBasics, formatItemLabel, sendDisplayReply } from "./_helpers";
|
||||||
|
|
||||||
export const command: CommandMessage = {
|
export const command: CommandMessage = {
|
||||||
name: 'racha',
|
name: "racha",
|
||||||
type: 'message',
|
type: "message",
|
||||||
aliases: ['streak', 'daily'],
|
aliases: ["streak", "daily"],
|
||||||
cooldown: 10,
|
cooldown: 10,
|
||||||
description: 'Ver tu racha diaria y reclamar recompensa',
|
description: "Ver tu racha diaria y reclamar recompensa",
|
||||||
usage: 'racha',
|
usage: "racha",
|
||||||
run: async (message, args, client: Amayo) => {
|
run: async (message, args, client: Amayo) => {
|
||||||
try {
|
try {
|
||||||
const userId = message.author.id;
|
const userId = message.author.id;
|
||||||
const guildId = message.guild!.id;
|
const guildId = message.guild!.id;
|
||||||
|
|
||||||
// Actualizar racha
|
// Actualizar racha
|
||||||
const { streak, newDay, rewards, daysIncreased } = await updateStreak(userId, guildId);
|
const { streak, newDay, rewards, daysIncreased } = await updateStreak(
|
||||||
|
userId,
|
||||||
|
guildId
|
||||||
|
);
|
||||||
|
|
||||||
// Construir componentes
|
// Construir componentes
|
||||||
const components: any[] = [
|
const components: any[] = [
|
||||||
{
|
{
|
||||||
type: 10,
|
type: 10,
|
||||||
content: `# 🔥 Racha Diaria de ${message.author.username}`
|
content: `# 🔥 Racha Diaria de ${message.author.username}`,
|
||||||
},
|
},
|
||||||
{ type: 14, divider: true },
|
{ type: 14, divider: true },
|
||||||
{
|
{
|
||||||
type: 9,
|
type: 9,
|
||||||
components: [{
|
components: [
|
||||||
|
{
|
||||||
type: 10,
|
type: 10,
|
||||||
content: `**📊 ESTADÍSTICAS**\n` +
|
content:
|
||||||
|
`**📊 ESTADÍSTICAS**\n` +
|
||||||
`🔥 Racha Actual: **${streak.currentStreak}** días\n` +
|
`🔥 Racha Actual: **${streak.currentStreak}** días\n` +
|
||||||
`⭐ Mejor Racha: **${streak.longestStreak}** días\n` +
|
`⭐ Mejor Racha: **${streak.longestStreak}** días\n` +
|
||||||
`📅 Días Activos: **${streak.totalDaysActive}** días`
|
`📅 Días Activos: **${streak.totalDaysActive}** días`,
|
||||||
}]
|
|
||||||
},
|
},
|
||||||
{ type: 14, spacing: 1 }
|
],
|
||||||
|
},
|
||||||
|
{ type: 14, spacing: 1 },
|
||||||
];
|
];
|
||||||
|
|
||||||
// Mensaje de estado
|
// Mensaje de estado
|
||||||
@@ -44,29 +50,41 @@ export const command: CommandMessage = {
|
|||||||
if (daysIncreased) {
|
if (daysIncreased) {
|
||||||
components.push({
|
components.push({
|
||||||
type: 9,
|
type: 9,
|
||||||
components: [{
|
components: [
|
||||||
|
{
|
||||||
type: 10,
|
type: 10,
|
||||||
content: `**✅ ¡RACHA INCREMENTADA!**\nHas mantenido tu racha por **${streak.currentStreak}** días seguidos.`
|
content: `**✅ ¡RACHA INCREMENTADA!**\nHas mantenido tu racha por **${streak.currentStreak}** días seguidos.`,
|
||||||
}]
|
},
|
||||||
|
],
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
components.push({
|
components.push({
|
||||||
type: 9,
|
type: 9,
|
||||||
components: [{
|
components: [
|
||||||
|
{
|
||||||
type: 10,
|
type: 10,
|
||||||
content: `**⚠️ RACHA REINICIADA**\nPasó más de un día sin actividad. Tu racha se ha reiniciado.`
|
content: `**⚠️ RACHA REINICIADA**\nPasó más de un día sin actividad. Tu racha se ha reiniciado.`,
|
||||||
}]
|
},
|
||||||
|
],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mostrar recompensas
|
// Mostrar recompensas
|
||||||
if (rewards) {
|
if (rewards) {
|
||||||
let rewardsText = '**🎁 RECOMPENSA DEL DÍA**\n';
|
let rewardsText = "**🎁 RECOMPENSA DEL DÍA**\n";
|
||||||
if (rewards.coins) rewardsText += `💰 **${rewards.coins.toLocaleString()}** monedas\n`;
|
if (rewards.coins)
|
||||||
|
rewardsText += `💰 **${rewards.coins.toLocaleString()}** monedas\n`;
|
||||||
if (rewards.items && rewards.items.length) {
|
if (rewards.items && rewards.items.length) {
|
||||||
const basics = await fetchItemBasics(guildId, rewards.items.map((item) => item.key));
|
const basics = await fetchItemBasics(
|
||||||
rewards.items.forEach(item => {
|
guildId,
|
||||||
const info = basics.get(item.key) ?? { key: item.key, name: null, icon: null };
|
rewards.items.map((item) => item.key)
|
||||||
|
);
|
||||||
|
rewards.items.forEach((item) => {
|
||||||
|
const info = basics.get(item.key) ?? {
|
||||||
|
key: item.key,
|
||||||
|
name: null,
|
||||||
|
icon: null,
|
||||||
|
};
|
||||||
const label = formatItemLabel(info, { bold: true });
|
const label = formatItemLabel(info, { bold: true });
|
||||||
rewardsText += `${label} ×${item.quantity}\n`;
|
rewardsText += `${label} ×${item.quantity}\n`;
|
||||||
});
|
});
|
||||||
@@ -75,53 +93,54 @@ export const command: CommandMessage = {
|
|||||||
components.push({ type: 14, spacing: 1 });
|
components.push({ type: 14, spacing: 1 });
|
||||||
components.push({
|
components.push({
|
||||||
type: 9,
|
type: 9,
|
||||||
components: [{
|
components: [
|
||||||
|
{
|
||||||
type: 10,
|
type: 10,
|
||||||
content: rewardsText
|
content: rewardsText,
|
||||||
}]
|
},
|
||||||
|
],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
components.push({
|
components.push({
|
||||||
type: 9,
|
type: 9,
|
||||||
components: [{
|
components: [
|
||||||
|
{
|
||||||
type: 10,
|
type: 10,
|
||||||
content: `**ℹ️ YA RECLAMASTE HOY**\nYa has reclamado tu recompensa diaria. Vuelve mañana para continuar tu racha.`
|
content: `**ℹ️ YA RECLAMASTE HOY**\nYa has reclamado tu recompensa diaria. Vuelve mañana para continuar tu racha.`,
|
||||||
}]
|
},
|
||||||
|
],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Próximos hitos
|
// Próximos hitos
|
||||||
const milestones = [3, 7, 14, 30, 60, 90, 180, 365];
|
const milestones = [3, 7, 14, 30, 60, 90, 180, 365];
|
||||||
const nextMilestone = milestones.find(m => m > streak.currentStreak);
|
const nextMilestone = milestones.find((m) => m > streak.currentStreak);
|
||||||
|
|
||||||
if (nextMilestone) {
|
if (nextMilestone) {
|
||||||
const remaining = nextMilestone - streak.currentStreak;
|
const remaining = nextMilestone - streak.currentStreak;
|
||||||
components.push({ type: 14, spacing: 1 });
|
components.push({ type: 14, spacing: 1 });
|
||||||
components.push({
|
components.push({
|
||||||
type: 9,
|
type: 9,
|
||||||
components: [{
|
components: [
|
||||||
|
{
|
||||||
type: 10,
|
type: 10,
|
||||||
content: `**🎯 PRÓXIMO HITO**\nFaltan **${remaining}** días para alcanzar el día **${nextMilestone}**`
|
content: `**🎯 PRÓXIMO HITO**\nFaltan **${remaining}** días para alcanzar el día **${nextMilestone}**`,
|
||||||
}]
|
},
|
||||||
|
],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const display = {
|
const display = {
|
||||||
type: 17,
|
type: 17,
|
||||||
accent_color: daysIncreased ? 0x00FF00 : 0xFFA500,
|
accent_color: daysIncreased ? 0x00ff00 : 0xffa500,
|
||||||
components
|
components,
|
||||||
};
|
};
|
||||||
|
|
||||||
const channel = message.channel as TextBasedChannel & { send: Function };
|
await sendDisplayReply(message, display);
|
||||||
await (channel.send as any)({
|
|
||||||
display,
|
|
||||||
flags: 32768,
|
|
||||||
reply: { messageReference: message.id }
|
|
||||||
});
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error en comando racha:', error);
|
console.error("Error en comando racha:", error);
|
||||||
await message.reply('❌ Error al obtener tu racha diaria.');
|
await message.reply("❌ Error al obtener tu racha diaria.");
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
'gradient': 'gradient 8s linear infinite',
|
'gradient': 'gradient 8s linear infinite',
|
||||||
'float': 'float 6s ease-in-out infinite',
|
'float': 'float 6s ease-in-out infinite',
|
||||||
'glow': 'glow 3s ease-in-out infinite',
|
'glow': 'glow 3s ease-in-out infinite',
|
||||||
|
'slide-in': 'slideIn 0.5s ease-out',
|
||||||
},
|
},
|
||||||
keyframes: {
|
keyframes: {
|
||||||
gradient: {
|
gradient: {
|
||||||
@@ -28,6 +29,10 @@
|
|||||||
'0%, 100%': { opacity: '0.4' },
|
'0%, 100%': { opacity: '0.4' },
|
||||||
'50%': { opacity: '0.8' },
|
'50%': { opacity: '0.8' },
|
||||||
},
|
},
|
||||||
|
slideIn: {
|
||||||
|
'0%': { transform: 'translateY(20px)', opacity: '0' },
|
||||||
|
'100%': { transform: 'translateY(0)', opacity: '1' },
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -44,6 +49,7 @@
|
|||||||
<div class="absolute bottom-0 left-1/3 w-96 h-96 bg-pink-500/15 rounded-full mix-blend-screen filter blur-3xl animate-float" style="animation-delay: 4s;"></div>
|
<div class="absolute bottom-0 left-1/3 w-96 h-96 bg-pink-500/15 rounded-full mix-blend-screen filter blur-3xl animate-float" style="animation-delay: 4s;"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="relative z-10">
|
<div class="relative z-10">
|
||||||
<!-- Hero Ultra Moderno -->
|
<!-- Hero Ultra Moderno -->
|
||||||
<header class="relative overflow-hidden ">
|
<header class="relative overflow-hidden ">
|
||||||
|
|||||||
Reference in New Issue
Block a user