lookupUser debug

This commit is contained in:
Cynthia Foxwell 2022-10-09 12:40:39 -06:00
parent 187f2d5a7f
commit 4208ca05db

View file

@ -2,6 +2,8 @@ const {Collection} = require("oceanic.js");
const murmurhash = require("murmurhash").v3;
const {tinycolor} = require("@ctrl/tinycolor");
const logger = require("./logger.js");
function pastelize(id) {
const hue = murmurhash(id) % 360;
const hex = tinycolor(`hsl(${hue},75%,60%)`).toHex();
@ -267,6 +269,7 @@ async function selectionMessage(
}
async function lookupUser(msg, str, filter) {
logger.debug("hf:utils:lookupUser", "starting lookup", msg, str, filter);
if (/[0-9]{17,21}/.test(str)) {
return await hf.bot.rest.authRequest({
method: "GET",
@ -325,12 +328,14 @@ async function lookupUser(msg, str, filter) {
selection.splice(20);
try {
logger.debug("hf:utils:lookupUser", "sending selection message");
return await selectionMessage(
msg,
"Multiple users found, please pick from this list:",
selection
);
} catch (out) {
logger.debug("hf:utils:lookupUser", "selection message failed:", out);
return out;
}
}