diff --git a/src/modules/misc.js b/src/modules/misc.js index baea6be..dc8d219 100644 --- a/src/modules/misc.js +++ b/src/modules/misc.js @@ -636,16 +636,17 @@ const color = new Command("color"); color.category = CATEGORY; color.helpText = "Show information on a color or get a random color"; color.callback = async function (msg, line, args, {truerandom, first}) { - let color = tinycolor(line), + const query = args.join(" "); + let color = tinycolor(query), random = false; - if (!line || line == "") { + if (!query || query == "") { color = truerandom ? tinycolor(Math.floor(Math.random() * 0xffffff)) : randomColor(); random = true; } if (!color.isValid) { - const search = `^([0-9a-f]{6}),${line},`; + const search = `^([0-9a-f]{6}),${query},`; if (!first) { const colornamesMatches = colornamesRaw.match(new RegExp(search, "img")); if (colornamesMatches.length > 1) { @@ -662,7 +663,7 @@ color.callback = async function (msg, line, args, {truerandom, first}) { text: `Picked #${random} for embed color \u2022 Use \`--first\` or the \`first\` option to bypass this`, }, fields: [ - {name: `Got ${colornamesMatches.length} matches for \`${safeString(line)}\``, value: left, inline: true}, + {name: `Got ${colornamesMatches.length} matches for \`${safeString(query)}\``, value: left, inline: true}, {name: "\u200b", value: right, inline: true}, ], },