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,6 +628,42 @@ color.callback = async function (msg, line, args, {truerandom}) {
.toBuffer(); .toBuffer();
const fileName = `${color.toHex()}.png`; const fileName = `${color.toHex()}.png`;
const fields = [
{
name: "Hex",
value: color.toHexString(),
inline: true,
},
{
name: "RGB",
value: color.toRgbString(),
inline: true,
},
{
name: "HSL",
value: color.toHslString(),
inline: true,
},
{
name: "HSV",
value: color.toHsvString(),
inline: true,
},
{
name: "Integer",
value: color.toNumber(),
inline: true,
},
];
if (color.toName() != false) {
fields.splice(0, 0, {
name: "Name",
value: color.toName(),
inline: true,
});
}
return { return {
embeds: [ embeds: [
{ {
@ -636,38 +672,7 @@ color.callback = async function (msg, line, args, {truerandom}) {
thumbnail: { thumbnail: {
url: `attachment://${fileName}`, url: `attachment://${fileName}`,
}, },
fields: [ fields,
color.toName() && {
name: "Name",
value: color.toName(),
inline: true,
},
{
name: "Hex",
value: color.toHexString(),
inline: true,
},
{
name: "RGB",
value: color.toRgbString(),
inline: true,
},
{
name: "HSL",
value: color.toHslString(),
inline: true,
},
{
name: "HSV",
value: color.toHsvString(),
inline: true,
},
{
name: "Integer",
value: color.toNumber(),
inline: true,
},
].filter((f) => f != null),
}, },
], ],
file: { file: {