userinfo: use lookupUser
This commit is contained in:
parent
3a864466cf
commit
a5da10b6aa
1 changed files with 8 additions and 6 deletions
|
@ -11,13 +11,11 @@ const {
|
||||||
ClanPlaystyle,
|
ClanPlaystyle,
|
||||||
UserFlags,
|
UserFlags,
|
||||||
} = require("@util/dconstants.js");
|
} = require("@util/dconstants.js");
|
||||||
const {
|
const {Icons} = require("@util/constants.js");
|
||||||
RegExp: {Snowflake: SNOWFLAKE_REGEX},
|
|
||||||
Icons,
|
|
||||||
} = require("@util/constants.js");
|
|
||||||
|
|
||||||
const {formatUsername, getDefaultAvatar, getTopColor, pastelize} = require("@util/misc.js");
|
const {formatUsername, getDefaultAvatar, getTopColor, pastelize} = require("@util/misc.js");
|
||||||
const {snowflakeToTimestamp} = require("@util/time.js");
|
const {snowflakeToTimestamp} = require("@util/time.js");
|
||||||
|
const {lookupUser} = require("@util/selection.js");
|
||||||
|
|
||||||
const ONE_MONTH = 2628000;
|
const ONE_MONTH = 2628000;
|
||||||
|
|
||||||
|
@ -35,8 +33,12 @@ userinfo.callback = async function (msg, line) {
|
||||||
if (!line || line == "") {
|
if (!line || line == "") {
|
||||||
id = msg.author?.id ?? msg.user?.id;
|
id = msg.author?.id ?? msg.user?.id;
|
||||||
} else {
|
} else {
|
||||||
if (!SNOWFLAKE_REGEX.test(line)) return "Not a snowflake.";
|
const lookup = await lookupUser(msg, user);
|
||||||
id = line.match(SNOWFLAKE_REGEX)[1];
|
if (lookup == "No results" || lookup == "Canceled" || lookup == "Request timed out") {
|
||||||
|
return lookup;
|
||||||
|
} else {
|
||||||
|
id = lookup.id;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!id) return "Failed to get ID somehow.";
|
if (!id) return "Failed to get ID somehow.";
|
||||||
|
|
Loading…
Reference in a new issue