lookupUser debug
This commit is contained in:
parent
187f2d5a7f
commit
4208ca05db
1 changed files with 5 additions and 0 deletions
|
@ -2,6 +2,8 @@ const {Collection} = require("oceanic.js");
|
||||||
const murmurhash = require("murmurhash").v3;
|
const murmurhash = require("murmurhash").v3;
|
||||||
const {tinycolor} = require("@ctrl/tinycolor");
|
const {tinycolor} = require("@ctrl/tinycolor");
|
||||||
|
|
||||||
|
const logger = require("./logger.js");
|
||||||
|
|
||||||
function pastelize(id) {
|
function pastelize(id) {
|
||||||
const hue = murmurhash(id) % 360;
|
const hue = murmurhash(id) % 360;
|
||||||
const hex = tinycolor(`hsl(${hue},75%,60%)`).toHex();
|
const hex = tinycolor(`hsl(${hue},75%,60%)`).toHex();
|
||||||
|
@ -267,6 +269,7 @@ async function selectionMessage(
|
||||||
}
|
}
|
||||||
|
|
||||||
async function lookupUser(msg, str, filter) {
|
async function lookupUser(msg, str, filter) {
|
||||||
|
logger.debug("hf:utils:lookupUser", "starting lookup", msg, str, filter);
|
||||||
if (/[0-9]{17,21}/.test(str)) {
|
if (/[0-9]{17,21}/.test(str)) {
|
||||||
return await hf.bot.rest.authRequest({
|
return await hf.bot.rest.authRequest({
|
||||||
method: "GET",
|
method: "GET",
|
||||||
|
@ -325,12 +328,14 @@ async function lookupUser(msg, str, filter) {
|
||||||
selection.splice(20);
|
selection.splice(20);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
logger.debug("hf:utils:lookupUser", "sending selection message");
|
||||||
return await selectionMessage(
|
return await selectionMessage(
|
||||||
msg,
|
msg,
|
||||||
"Multiple users found, please pick from this list:",
|
"Multiple users found, please pick from this list:",
|
||||||
selection
|
selection
|
||||||
);
|
);
|
||||||
} catch (out) {
|
} catch (out) {
|
||||||
|
logger.debug("hf:utils:lookupUser", "selection message failed:", out);
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue