feat(economy): add message flags and enhance component structure for improved display
This commit is contained in:
@@ -80,11 +80,14 @@ export const command: CommandMessage = {
|
|||||||
|
|
||||||
const channel = message.channel as TextBasedChannel & { send: Function };
|
const channel = message.channel as TextBasedChannel & { send: Function };
|
||||||
const msg = await (channel.send as any)({
|
const msg = await (channel.send as any)({
|
||||||
|
flags: 32768,
|
||||||
|
components: [
|
||||||
display,
|
display,
|
||||||
components: buttons.length > 0 ? [{
|
...(buttons.length > 0 ? [{
|
||||||
type: ComponentType.ActionRow,
|
type: ComponentType.ActionRow,
|
||||||
components: buttons
|
components: buttons
|
||||||
}] : []
|
}] : [])
|
||||||
|
]
|
||||||
});
|
});
|
||||||
|
|
||||||
const collector = msg.createMessageComponentCollector({
|
const collector = msg.createMessageComponentCollector({
|
||||||
|
|||||||
@@ -90,11 +90,14 @@ export const command: CommandMessage = {
|
|||||||
|
|
||||||
const channel = message.channel as TextBasedChannel & { send: Function };
|
const channel = message.channel as TextBasedChannel & { send: Function };
|
||||||
const msg = await (channel.send as any)({
|
const msg = await (channel.send as any)({
|
||||||
|
flags: 32768,
|
||||||
|
components: [
|
||||||
display,
|
display,
|
||||||
components: buttons.length > 0 ? [{
|
...(buttons.length > 0 ? [{
|
||||||
type: ComponentType.ActionRow,
|
type: ComponentType.ActionRow,
|
||||||
components: buttons
|
components: buttons
|
||||||
}] : []
|
}] : [])
|
||||||
|
]
|
||||||
});
|
});
|
||||||
|
|
||||||
const collector = msg.createMessageComponentCollector({
|
const collector = msg.createMessageComponentCollector({
|
||||||
|
|||||||
@@ -86,7 +86,20 @@ export const command: CommandMessage = {
|
|||||||
switch (i.customId) {
|
switch (i.customId) {
|
||||||
case 'ach_cancel':
|
case 'ach_cancel':
|
||||||
await i.deferUpdate();
|
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');
|
collector.stop('cancel');
|
||||||
return;
|
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({
|
await editorMsg.edit({
|
||||||
content: `✅ Logro \`${state.key}\` creado.`,
|
flags: 32768,
|
||||||
components: [],
|
components: [{
|
||||||
display: undefined
|
type: 17,
|
||||||
|
accent_color: 0x00FF00,
|
||||||
|
components: [{
|
||||||
|
type: 9,
|
||||||
|
components: [{
|
||||||
|
type: 10,
|
||||||
|
content: `**✅ Logro \`${state.key}\` creado exitosamente.**`
|
||||||
|
}]
|
||||||
|
}]
|
||||||
|
}]
|
||||||
});
|
});
|
||||||
collector.stop('saved');
|
collector.stop('saved');
|
||||||
return;
|
return;
|
||||||
@@ -143,7 +165,20 @@ export const command: CommandMessage = {
|
|||||||
collector.on('end', async (_c, r) => {
|
collector.on('end', async (_c, r) => {
|
||||||
if (r === 'time') {
|
if (r === 'time') {
|
||||||
try {
|
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 {}
|
} catch {}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -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]
|
||||||
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -95,11 +95,14 @@ export const command: CommandMessage = {
|
|||||||
|
|
||||||
const channel = message.channel as TextBasedChannel & { send: Function };
|
const channel = message.channel as TextBasedChannel & { send: Function };
|
||||||
const msg = await (channel.send as any)({
|
const msg = await (channel.send as any)({
|
||||||
|
flags: 32768,
|
||||||
|
components: [
|
||||||
display,
|
display,
|
||||||
components: buttons.length > 0 ? [{
|
...(buttons.length > 0 ? [{
|
||||||
type: ComponentType.ActionRow,
|
type: ComponentType.ActionRow,
|
||||||
components: buttons
|
components: buttons
|
||||||
}] : []
|
}] : [])
|
||||||
|
]
|
||||||
});
|
});
|
||||||
|
|
||||||
const collector = msg.createMessageComponentCollector({
|
const collector = msg.createMessageComponentCollector({
|
||||||
|
|||||||
@@ -84,7 +84,20 @@ export const command: CommandMessage = {
|
|||||||
switch (i.customId) {
|
switch (i.customId) {
|
||||||
case 'quest_cancel':
|
case 'quest_cancel':
|
||||||
await i.deferUpdate();
|
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');
|
collector.stop('cancel');
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -142,7 +155,20 @@ export const command: CommandMessage = {
|
|||||||
collector.on('end', async (_c, r) => {
|
collector.on('end', async (_c, r) => {
|
||||||
if (r === 'time') {
|
if (r === 'time') {
|
||||||
try {
|
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 {}
|
} catch {}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -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] });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -102,11 +102,14 @@ export const command: CommandMessage = {
|
|||||||
|
|
||||||
const channel = message.channel as TextBasedChannel & { send: Function };
|
const channel = message.channel as TextBasedChannel & { send: Function };
|
||||||
const msg = await (channel.send as any)({
|
const msg = await (channel.send as any)({
|
||||||
|
flags: 32768,
|
||||||
|
components: [
|
||||||
display,
|
display,
|
||||||
components: buttons.length > 0 ? [{
|
...(buttons.length > 0 ? [{
|
||||||
type: ComponentType.ActionRow,
|
type: ComponentType.ActionRow,
|
||||||
components: buttons
|
components: buttons
|
||||||
}] : []
|
}] : [])
|
||||||
|
]
|
||||||
});
|
});
|
||||||
|
|
||||||
const collector = msg.createMessageComponentCollector({
|
const collector = msg.createMessageComponentCollector({
|
||||||
|
|||||||
@@ -84,11 +84,14 @@ export const command: CommandMessage = {
|
|||||||
|
|
||||||
const channel = message.channel as TextBasedChannel & { send: Function };
|
const channel = message.channel as TextBasedChannel & { send: Function };
|
||||||
const msg = await (channel.send as any)({
|
const msg = await (channel.send as any)({
|
||||||
|
flags: 32768,
|
||||||
|
components: [
|
||||||
display,
|
display,
|
||||||
components: buttons.length > 0 ? [{
|
...(buttons.length > 0 ? [{
|
||||||
type: ComponentType.ActionRow,
|
type: ComponentType.ActionRow,
|
||||||
components: buttons
|
components: buttons
|
||||||
}] : []
|
}] : [])
|
||||||
|
]
|
||||||
});
|
});
|
||||||
|
|
||||||
const collector = msg.createMessageComponentCollector({
|
const collector = msg.createMessageComponentCollector({
|
||||||
|
|||||||
@@ -121,7 +121,20 @@ export const command: CommandMessage = {
|
|||||||
if (!i.isButton()) return;
|
if (!i.isButton()) return;
|
||||||
if (i.customId === 'it_cancel') {
|
if (i.customId === 'it_cancel') {
|
||||||
await i.deferUpdate();
|
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');
|
collector.stop('cancel');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -171,7 +184,20 @@ export const command: CommandMessage = {
|
|||||||
|
|
||||||
collector.on('end', async (_c, r) => {
|
collector.on('end', async (_c, r) => {
|
||||||
if (r === 'time') {
|
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 {}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -121,7 +121,20 @@ export const command: CommandMessage = {
|
|||||||
if (!i.isButton()) return;
|
if (!i.isButton()) return;
|
||||||
if (i.customId === 'it_cancel') {
|
if (i.customId === 'it_cancel') {
|
||||||
await i.deferUpdate();
|
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');
|
collector.stop('cancel');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -171,7 +184,20 @@ export const command: CommandMessage = {
|
|||||||
|
|
||||||
collector.on('end', async (_c, r) => {
|
collector.on('end', async (_c, r) => {
|
||||||
if (r === 'time') {
|
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 {}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user