diff --git a/src/commands/messages/game/areaCreate.ts b/src/commands/messages/game/areaCreate.ts index 10764b9..6031425 100644 --- a/src/commands/messages/game/areaCreate.ts +++ b/src/commands/messages/game/areaCreate.ts @@ -2,7 +2,7 @@ import type { CommandMessage } from '../../../core/types/commands'; import type Amayo from '../../../core/client'; import { hasManageGuildOrStaff } from '../../../core/lib/permissions'; import { prisma } from '../../../core/database/prisma'; -import { Message, MessageComponentInteraction, MessageFlags, ButtonInteraction } from 'discord.js'; +import { Message, MessageComponentInteraction, MessageFlags, ButtonInteraction, TextBasedChannel } from 'discord.js'; import { ComponentType, TextInputStyle, ButtonStyle } from 'discord-api-types/v10'; interface AreaState { @@ -33,7 +33,8 @@ export const command: CommandMessage = { const state: AreaState = { key, config: {}, metadata: {} }; - const editorMsg = await message.channel.send({ + const channel = message.channel as TextBasedChannel & { send: Function }; + const editorMsg = await channel.send({ content: `🗺️ Editor de Área: \`${key}\``, components: [ { type: 1, components: [ { type: 2, style: ButtonStyle.Primary, label: 'Base', custom_id: 'ga_base' }, diff --git a/src/commands/messages/game/areaEdit.ts b/src/commands/messages/game/areaEdit.ts index f6bc439..86aabbc 100644 --- a/src/commands/messages/game/areaEdit.ts +++ b/src/commands/messages/game/areaEdit.ts @@ -2,7 +2,7 @@ import type { CommandMessage } from '../../../core/types/commands'; import type Amayo from '../../../core/client'; import { hasManageGuildOrStaff } from '../../../core/lib/permissions'; import { prisma } from '../../../core/database/prisma'; -import { Message, MessageComponentInteraction, MessageFlags, ButtonInteraction } from 'discord.js'; +import { Message, MessageComponentInteraction, MessageFlags, ButtonInteraction, TextBasedChannel } from 'discord.js'; import { ComponentType, TextInputStyle, ButtonStyle } from 'discord-api-types/v10'; interface AreaState { @@ -33,7 +33,8 @@ export const command: CommandMessage = { const state: AreaState = { key, name: area.name, type: area.type, config: area.config ?? {}, metadata: area.metadata ?? {} }; - const editorMsg = await message.channel.send({ + const channel = message.channel as TextBasedChannel & { send: Function }; + const editorMsg = await channel.send({ content: `🗺️ Editor de Área (editar): \`${key}\``, components: [ { type: 1, components: [ { type: 2, style: ButtonStyle.Primary, label: 'Base', custom_id: 'ga_base' }, diff --git a/src/commands/messages/game/itemCreate.ts b/src/commands/messages/game/itemCreate.ts index be596d3..8ab549b 100644 --- a/src/commands/messages/game/itemCreate.ts +++ b/src/commands/messages/game/itemCreate.ts @@ -1,4 +1,4 @@ -import { Message, MessageFlags, MessageComponentInteraction, ButtonInteraction } from 'discord.js'; +import { Message, MessageFlags, MessageComponentInteraction, ButtonInteraction, TextBasedChannel } from 'discord.js'; import { ComponentType, TextInputStyle, ButtonStyle } from 'discord-api-types/v10'; import type { CommandMessage } from '../../../core/types/commands'; import { hasManageGuildOrStaff } from '../../../core/lib/permissions'; @@ -54,7 +54,8 @@ export const command: CommandMessage = { props: {}, }; - const editorMsg = await message.channel.send({ + const channel = message.channel as TextBasedChannel & { send: Function }; + const editorMsg = await channel.send({ content: `🛠️ Editor de Item: \`${key}\`\nUsa los botones para configurar los campos y luego guarda.`, components: [ { type: 1, components: [ diff --git a/src/commands/messages/game/itemEdit.ts b/src/commands/messages/game/itemEdit.ts index 177951b..2d17fb8 100644 --- a/src/commands/messages/game/itemEdit.ts +++ b/src/commands/messages/game/itemEdit.ts @@ -1,4 +1,4 @@ -import { Message, MessageFlags, MessageComponentInteraction, ButtonInteraction } from 'discord.js'; +import { Message, MessageFlags, MessageComponentInteraction, ButtonInteraction, TextBasedChannel } from 'discord.js'; import { ComponentType, TextInputStyle, ButtonStyle } from 'discord-api-types/v10'; import type { CommandMessage } from '../../../core/types/commands'; import { hasManageGuildOrStaff } from '../../../core/lib/permissions'; @@ -47,7 +47,8 @@ export const command: CommandMessage = { props: item.props ?? {}, }; - const editorMsg = await message.channel.send({ + const channel = message.channel as TextBasedChannel & { send: Function }; + const editorMsg = await channel.send({ content: `🛠️ Editor de Item (editar): \`${key}\``, components: [ { type: 1, components: [ { type: 2, style: ButtonStyle.Primary, label: 'Base', custom_id: 'it_base' }, diff --git a/src/commands/messages/game/mobCreate.ts b/src/commands/messages/game/mobCreate.ts index aa79526..60698c3 100644 --- a/src/commands/messages/game/mobCreate.ts +++ b/src/commands/messages/game/mobCreate.ts @@ -1,4 +1,4 @@ -import { Message, MessageFlags, MessageComponentInteraction, ButtonInteraction } from 'discord.js'; +import { Message, MessageFlags, MessageComponentInteraction, ButtonInteraction, TextBasedChannel } from 'discord.js'; import { ComponentType, TextInputStyle, ButtonStyle } from 'discord-api-types/v10'; import type { CommandMessage } from '../../../core/types/commands'; import { hasManageGuildOrStaff } from '../../../core/lib/permissions'; @@ -33,7 +33,8 @@ export const command: CommandMessage = { const state: MobEditorState = { key, stats: { attack: 5 }, drops: {} }; - const editorMsg = await message.channel.send({ + const channel = message.channel as TextBasedChannel & { send: Function }; + const editorMsg = await channel.send({ content: `👾 Editor de Mob: \`${key}\``, components: [ { type: 1, components: [ { type: 2, style: ButtonStyle.Primary, label: 'Base', custom_id: 'mb_base' }, diff --git a/src/commands/messages/game/mobEdit.ts b/src/commands/messages/game/mobEdit.ts index 5f3e54e..ccbf356 100644 --- a/src/commands/messages/game/mobEdit.ts +++ b/src/commands/messages/game/mobEdit.ts @@ -1,4 +1,4 @@ -import { Message, MessageFlags, MessageComponentInteraction, ButtonInteraction } from 'discord.js'; +import { Message, MessageFlags, MessageComponentInteraction, ButtonInteraction, TextBasedChannel } from 'discord.js'; import { ComponentType, TextInputStyle, ButtonStyle } from 'discord-api-types/v10'; import type { CommandMessage } from '../../../core/types/commands'; import { hasManageGuildOrStaff } from '../../../core/lib/permissions'; @@ -39,7 +39,8 @@ export const command: CommandMessage = { drops: mob.drops ?? {}, }; - const editorMsg = await message.channel.send({ + const channel = message.channel as TextBasedChannel & { send: Function }; + const editorMsg = await channel.send({ content: `👾 Editor de Mob (editar): \`${key}\``, components: [ { type: 1, components: [ { type: 2, style: ButtonStyle.Primary, label: 'Base', custom_id: 'mb_base' }, diff --git a/src/core/services/AIService.ts b/src/core/services/AIService.ts index f87f631..0d741a1 100644 --- a/src/core/services/AIService.ts +++ b/src/core/services/AIService.ts @@ -575,7 +575,7 @@ export class AIService { * Procesar imágenes adjuntas para análisis con Gemini Vision */ private async processImageAttachments(attachments: any[]): Promise { - const imageAttachments = []; + const imageAttachments: Array<{ inlineData: { data: string; mimeType: string } }> = []; for (const attachment of attachments) { if (this.hasImageAttachments([attachment])) { @@ -1121,7 +1121,7 @@ Responde de forma directa y útil:`; .filter((role: any) => role.id !== guild.id) // Excluir @everyone .sort((a: any, b: any) => b.position - a.position) .map((role: any) => { - const permissions = []; + const permissions: string[] = []; if (role.permissions.has('Administrator')) permissions.push('Admin'); if (role.permissions.has('ManageGuild')) permissions.push('Manage Server'); if (role.permissions.has('ManageChannels')) permissions.push('Manage Channels'); diff --git a/src/events/messageCreate.ts b/src/events/messageCreate.ts index addc243..c216558 100644 --- a/src/events/messageCreate.ts +++ b/src/events/messageCreate.ts @@ -136,7 +136,7 @@ async function handleAIReply(message: any) { // Enviar respuesta (dividir si es muy larga) const MAX_CONTENT = 2000; if (finalResponse.length > MAX_CONTENT) { - const chunks = []; + const chunks: string[] = []; let currentChunk = ''; const lines = finalResponse.split('\n'); @@ -158,13 +158,17 @@ async function handleAIReply(message: any) { if (i === 0) { await message.reply({ content: chunks[i] }); } else { - await message.channel.send({ content: chunks[i] }); - await new Promise(resolve => setTimeout(resolve, 500)); + if ('send' in message.channel) { + await message.channel.send({ content: chunks[i] }); + await new Promise(resolve => setTimeout(resolve, 500)); + } } } if (chunks.length > 3) { - await message.channel.send({ content: "⚠️ Respuesta truncada por longitud." }); + if ('send' in message.channel) { + await message.channel.send({ content: "⚠️ Respuesta truncada por longitud." }); + } } } else { await message.reply({ content: finalResponse }); diff --git a/src/game/minigames/seed.ts b/src/game/minigames/seed.ts index 772a8ba..fd087e6 100644 --- a/src/game/minigames/seed.ts +++ b/src/game/minigames/seed.ts @@ -1,7 +1,7 @@ import { prisma } from '../../core/database/prisma'; import { Prisma } from '@prisma/client'; -async function upsertEconomyItem(guildId: string | null, key: string, data: Omit[0]['data'], 'key' | 'guildId'>) { +async function upsertEconomyItem(guildId: string | null, key: string, data: Omit) { if (guildId) { return prisma.economyItem.upsert({ where: { guildId_key: { guildId, key } }, update: {}, create: { ...data, key, guildId } }); } @@ -10,7 +10,7 @@ async function upsertEconomyItem(guildId: string | null, key: string, data: Omit return prisma.economyItem.create({ data: { ...data, key, guildId: null } }); } -async function upsertGameArea(guildId: string | null, key: string, data: Omit[0]['data'], 'key' | 'guildId'>) { +async function upsertGameArea(guildId: string | null, key: string, data: Omit) { if (guildId) { return prisma.gameArea.upsert({ where: { guildId_key: { guildId, key } }, update: {}, create: { ...data, key, guildId } }); } @@ -19,7 +19,7 @@ async function upsertGameArea(guildId: string | null, key: string, data: Omit[0]['data'], 'key' | 'guildId'>) { +async function upsertMob(guildId: string | null, key: string, data: Omit) { if (guildId) { return prisma.mob.upsert({ where: { guildId_key: { guildId, key } }, update: { stats: (data as any).stats, drops: (data as any).drops, name: (data as any).name }, create: { ...data, key, guildId } }); } diff --git a/src/game/minigames/service.ts b/src/game/minigames/service.ts index 48835a8..978870d 100644 --- a/src/game/minigames/service.ts +++ b/src/game/minigames/service.ts @@ -64,7 +64,7 @@ async function validateRequirements(userId: string, guildId: string, req?: Level // Auto-select tool when required and not provided if (!toolKeyUsed && toolReq.required && toolReq.toolType) { - toolKeyUsed = await findBestToolKey(userId, guildId, toolReq.toolType, { minTier: toolReq.minTier, allowedKeys: toolReq.allowedKeys }); + toolKeyUsed = await findBestToolKey(userId, guildId, toolReq.toolType, { minTier: toolReq.minTier, allowedKeys: toolReq.allowedKeys }) ?? undefined; } // herramienta requerida