feat(economy): add message flags and enhance component structure for improved display

This commit is contained in:
2025-10-05 06:28:42 -05:00
parent 54b203ce11
commit 70098988dc
11 changed files with 171 additions and 39 deletions

View File

@@ -80,11 +80,14 @@ export const command: CommandMessage = {
const channel = message.channel as TextBasedChannel & { send: Function };
const msg = await (channel.send as any)({
flags: 32768,
components: [
display,
components: buttons.length > 0 ? [{
...(buttons.length > 0 ? [{
type: ComponentType.ActionRow,
components: buttons
}] : []
}] : [])
]
});
const collector = msg.createMessageComponentCollector({

View File

@@ -90,11 +90,14 @@ export const command: CommandMessage = {
const channel = message.channel as TextBasedChannel & { send: Function };
const msg = await (channel.send as any)({
flags: 32768,
components: [
display,
components: buttons.length > 0 ? [{
...(buttons.length > 0 ? [{
type: ComponentType.ActionRow,
components: buttons
}] : []
}] : [])
]
});
const collector = msg.createMessageComponentCollector({

View File

@@ -86,7 +86,20 @@ export const command: CommandMessage = {
switch (i.customId) {
case 'ach_cancel':
await i.deferUpdate();
await editorMsg.edit({ content: '❌ Creación de logro cancelada.', components: [], display: undefined });
await editorMsg.edit({
flags: 32768,
components: [{
type: 17,
accent_color: 0xFF0000,
components: [{
type: 9,
components: [{
type: 10,
content: '**❌ Creación de logro cancelada.**'
}]
}]
}]
});
collector.stop('cancel');
return;
@@ -123,11 +136,20 @@ export const command: CommandMessage = {
}
});
await i.reply({ content: '✅ Logro creado exitosamente.', flags: 64 });
await i.reply({ content: '✅ Logro creado exitosamente!', flags: 64 });
await editorMsg.edit({
content: `✅ Logro \`${state.key}\` creado.`,
components: [],
display: undefined
flags: 32768,
components: [{
type: 17,
accent_color: 0x00FF00,
components: [{
type: 9,
components: [{
type: 10,
content: `**✅ Logro \`${state.key}\` creado exitosamente.**`
}]
}]
}]
});
collector.stop('saved');
return;
@@ -143,7 +165,20 @@ export const command: CommandMessage = {
collector.on('end', async (_c, r) => {
if (r === 'time') {
try {
await editorMsg.edit({ content: '⏰ Editor expirado.', components: [], display: undefined });
await editorMsg.edit({
flags: 32768,
components: [{
type: 17,
accent_color: 0xFFA500,
components: [{
type: 9,
components: [{
type: 10,
content: '**⏰ Editor expirado.**'
}]
}]
}]
});
} catch {}
}
});

View File

@@ -118,6 +118,10 @@ export const command: CommandMessage = {
});
}
const channel = message.channel as TextBasedChannel & { send: Function }; await (channel.send as any)({ display, reply: { messageReference: message.id } });
const channel = message.channel as TextBasedChannel & { send: Function };
await (channel.send as any)({
flags: 32768,
components: [display]
});
}
};

View File

@@ -95,11 +95,14 @@ export const command: CommandMessage = {
const channel = message.channel as TextBasedChannel & { send: Function };
const msg = await (channel.send as any)({
flags: 32768,
components: [
display,
components: buttons.length > 0 ? [{
...(buttons.length > 0 ? [{
type: ComponentType.ActionRow,
components: buttons
}] : []
}] : [])
]
});
const collector = msg.createMessageComponentCollector({

View File

@@ -84,7 +84,20 @@ export const command: CommandMessage = {
switch (i.customId) {
case 'quest_cancel':
await i.deferUpdate();
await editorMsg.edit({ content: '❌ Creación de misión cancelada.', components: [], display: undefined });
await editorMsg.edit({
flags: 32768,
components: [{
type: 17,
accent_color: 0xFF0000,
components: [{
type: 9,
components: [{
type: 10,
content: '**❌ Creación de misión cancelada.**'
}]
}]
}]
});
collector.stop('cancel');
return;
@@ -142,7 +155,20 @@ export const command: CommandMessage = {
collector.on('end', async (_c, r) => {
if (r === 'time') {
try {
await editorMsg.edit({ content: '⏰ Editor expirado.', components: [], display: undefined });
await editorMsg.edit({
flags: 32768,
components: [{
type: 17,
accent_color: 0xFFA500,
components: [{
type: 9,
components: [{
type: 10,
content: '**⏰ Editor expirado.**'
}]
}]
}]
});
} catch {}
}
});

View File

@@ -151,6 +151,6 @@ export const command: CommandMessage = {
});
}
const channel = message.channel as TextBasedChannel & { send: Function }; await (channel.send as any)({ display, reply: { messageReference: message.id } });
const channel = message.channel as TextBasedChannel & { send: Function }; await (channel.send as any)({ flags: 32768, components: [display] });
}
};

View File

@@ -102,11 +102,14 @@ export const command: CommandMessage = {
const channel = message.channel as TextBasedChannel & { send: Function };
const msg = await (channel.send as any)({
flags: 32768,
components: [
display,
components: buttons.length > 0 ? [{
...(buttons.length > 0 ? [{
type: ComponentType.ActionRow,
components: buttons
}] : []
}] : [])
]
});
const collector = msg.createMessageComponentCollector({

View File

@@ -84,11 +84,14 @@ export const command: CommandMessage = {
const channel = message.channel as TextBasedChannel & { send: Function };
const msg = await (channel.send as any)({
flags: 32768,
components: [
display,
components: buttons.length > 0 ? [{
...(buttons.length > 0 ? [{
type: ComponentType.ActionRow,
components: buttons
}] : []
}] : [])
]
});
const collector = msg.createMessageComponentCollector({

View File

@@ -121,7 +121,20 @@ export const command: CommandMessage = {
if (!i.isButton()) return;
if (i.customId === 'it_cancel') {
await i.deferUpdate();
await editorMsg.edit({ content: '❌ Editor cancelado.', components: [], display: undefined });
await editorMsg.edit({
flags: 32768,
components: [{
type: 17,
accent_color: 0xFF0000,
components: [{
type: 9,
components: [{
type: 10,
content: '**❌ Editor cancelado.**'
}]
}]
}]
});
collector.stop('cancel');
return;
}
@@ -171,7 +184,20 @@ export const command: CommandMessage = {
collector.on('end', async (_c, r) => {
if (r === 'time') {
try { await editorMsg.edit({ content: '⏰ Editor expirado.', components: [], display: undefined }); } catch {}
try { await editorMsg.edit({
flags: 32768,
components: [{
type: 17,
accent_color: 0xFFA500,
components: [{
type: 9,
components: [{
type: 10,
content: '**⏰ Editor expirado.**'
}]
}]
}]
}); } catch {}
}
});
},

View File

@@ -121,7 +121,20 @@ export const command: CommandMessage = {
if (!i.isButton()) return;
if (i.customId === 'it_cancel') {
await i.deferUpdate();
await editorMsg.edit({ content: '❌ Editor cancelado.', components: [], display: undefined });
await editorMsg.edit({
flags: 32768,
components: [{
type: 17,
accent_color: 0xFF0000,
components: [{
type: 9,
components: [{
type: 10,
content: '**❌ Editor cancelado.**'
}]
}]
}]
});
collector.stop('cancel');
return;
}
@@ -171,7 +184,20 @@ export const command: CommandMessage = {
collector.on('end', async (_c, r) => {
if (r === 'time') {
try { await editorMsg.edit({ content: '⏰ Editor expirado.', components: [], display: undefined }); } catch {}
try { await editorMsg.edit({
flags: 32768,
components: [{
type: 17,
accent_color: 0xFFA500,
components: [{
type: 9,
components: [{
type: 10,
content: '**⏰ Editor expirado.**'
}]
}]
}]
}); } catch {}
}
});
},