refactor(economy): enhance type definitions and improve channel message handling

This commit is contained in:
2025-10-05 05:19:16 -05:00
parent 68f629d637
commit c868e3bf80
10 changed files with 32 additions and 22 deletions

View File

@@ -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' },

View File

@@ -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' },

View File

@@ -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: [

View File

@@ -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' },

View File

@@ -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' },

View File

@@ -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' },