misc.colors: fix csv loading

This commit is contained in:
Cynthia Foxwell 2024-07-31 21:36:47 -06:00
parent e54f953fa1
commit d29be7a47f

View file

@ -14,6 +14,7 @@ const {tinycolor, random: randomColor} = require("@ctrl/tinycolor");
const sharp = require("sharp"); const sharp = require("sharp");
const net = require("node:net"); const net = require("node:net");
const fs = require("node:fs"); const fs = require("node:fs");
const {resolve} = require("node:path");
const imagesClient = new GoogleImages(hf.apikeys.gimg, hf.apikeys.google); const imagesClient = new GoogleImages(hf.apikeys.gimg, hf.apikeys.google);
@ -629,7 +630,7 @@ searchInteraction.callback = async function (interaction) {
}; };
hf.registerCommand(searchInteraction); hf.registerCommand(searchInteraction);
const colornamesRaw = fs.readFileSync("../../data/colornames.csv").split("\n"); const colornamesRaw = fs.readFileSync(resolve(__dirname, "../../data/colornames.csv")).split("\n");
colornamesRaw.shift(); colornamesRaw.shift();
const colornamesMapped = colornamesRaw.map((line) => { const colornamesMapped = colornamesRaw.map((line) => {
const [hex, name] = line.split(","); const [hex, name] = line.split(",");