misc.color: make colornames dupes list an embed
This commit is contained in:
parent
c7c7cfa75c
commit
c9c2c99b10
1 changed files with 17 additions and 1 deletions
|
@ -650,7 +650,23 @@ color.callback = async function (msg, line, args, {truerandom, first}) {
|
||||||
const colornamesMatches = colornamesRaw.match(new RegExp(search, "img"));
|
const colornamesMatches = colornamesRaw.match(new RegExp(search, "img"));
|
||||||
if (colornamesMatches.length > 1) {
|
if (colornamesMatches.length > 1) {
|
||||||
const hexes = colornamesMatches.map((m) => m.split(",")[0]);
|
const hexes = colornamesMatches.map((m) => m.split(",")[0]);
|
||||||
return `Got ${colornamesMatches.length} matches for \`${safeString(line)}\`\n- ${hexes.join("\n- ")}`;
|
const random = hexes[Math.floor(Math.random() * hexes.length)];
|
||||||
|
|
||||||
|
const left = "- #" + hexes.slice(0, Math.ceil(hexes.length / 2)).join("\n- #");
|
||||||
|
const right = "- #" + hexes.slice(Math.ceil(hexes.length / 2), hexes.length).join("\n- #");
|
||||||
|
|
||||||
|
return {
|
||||||
|
embed: {
|
||||||
|
color: parseInt(`0x${random}`),
|
||||||
|
footer: {
|
||||||
|
text: `Picked #${random} for embed color \u2022 Use \`--first\` or the \`first\` option to bypass this`,
|
||||||
|
},
|
||||||
|
fields: [
|
||||||
|
{name: `Got ${colornamesMatches.length} matches for`, value: left, inline: true},
|
||||||
|
{name: `\`${safeString(line)}\``, value: right, inline: true},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue