misc.color: attempt fix

This commit is contained in:
Cynthia Foxwell 2023-04-26 18:37:19 -06:00
parent f971240c03
commit 295369bbc9

View file

@ -628,20 +628,7 @@ color.callback = async function (msg, line, args, {truerandom}) {
.toBuffer(); .toBuffer();
const fileName = `${color.toHex()}.png`; const fileName = `${color.toHex()}.png`;
return { const fields = [
embeds: [
{
title: random ? "Random Color" : "",
color: color.toNumber(),
thumbnail: {
url: `attachment://${fileName}`,
},
fields: [
color.toName() && {
name: "Name",
value: color.toName(),
inline: true,
},
{ {
name: "Hex", name: "Hex",
value: color.toHexString(), value: color.toHexString(),
@ -667,7 +654,25 @@ color.callback = async function (msg, line, args, {truerandom}) {
value: color.toNumber(), value: color.toNumber(),
inline: true, inline: true,
}, },
].filter((f) => f != null), ];
if (color.toName() != false) {
fields.splice(0, 0, {
name: "Name",
value: color.toName(),
inline: true,
});
}
return {
embeds: [
{
title: random ? "Random Color" : "",
color: color.toNumber(),
thumbnail: {
url: `attachment://${fileName}`,
},
fields,
}, },
], ],
file: { file: {