color: fix some colornames logic with valid colors
This commit is contained in:
parent
6045d8406d
commit
1d991c93e0
1 changed files with 2 additions and 2 deletions
|
@ -24,10 +24,10 @@ color.callback = async function (msg, line, args, {truerandom, first}) {
|
|||
}
|
||||
|
||||
if (!color.isValid) {
|
||||
const search = `^([0-9a-f]{6}),${query},`;
|
||||
const search = `^([0-9a-f]{6}),${color.toHexString().substring(1)},`;
|
||||
if (!first) {
|
||||
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 random = hexes[Math.floor(Math.random() * hexes.length)];
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue