utils: forgor auth

This commit is contained in:
Cynthia Foxwell 2023-03-06 18:26:41 -07:00
parent 0e66994ea4
commit 44d6d91459

View file

@ -113,7 +113,11 @@ async function getImage(msg, str) {
return `https://cdn.discordapp.com/emojis/${id}.png?v=1`; return `https://cdn.discordapp.com/emojis/${id}.png?v=1`;
} else if (/<@!?([0-9]*)>/.test(refMsg.content)) { } else if (/<@!?([0-9]*)>/.test(refMsg.content)) {
const id = refMsg.content.match(/<@!?([0-9]*)>/)[1]; const id = refMsg.content.match(/<@!?([0-9]*)>/)[1];
const user = await hf.bot.requestHandler.request("GET", "/users/" + id); const user = await hf.bot.requestHandler.request(
"GET",
"/users/" + id,
true
);
if (user) if (user)
return `https://cdn.discordapp.com/avatars/${id}/${user.avatar}.png?size=1024`; return `https://cdn.discordapp.com/avatars/${id}/${user.avatar}.png?size=1024`;
} }
@ -133,7 +137,11 @@ async function getImage(msg, str) {
return `https://cdn.discordapp.com/emojis/${id}.png?v=1`; return `https://cdn.discordapp.com/emojis/${id}.png?v=1`;
} else if (/<@!?([0-9]*)>/.test(str)) { } else if (/<@!?([0-9]*)>/.test(str)) {
const id = str.match(/<@!?([0-9]*)>/)[1]; const id = str.match(/<@!?([0-9]*)>/)[1];
const user = await hf.bot.requestHandler.request("GET", "/users/" + id); const user = await hf.bot.requestHandler.request(
"GET",
"/users/" + id,
true
);
if (user) if (user)
return `https://cdn.discordapp.com/avatars/${id}/${user.avatar}.png?size=1024`; return `https://cdn.discordapp.com/avatars/${id}/${user.avatar}.png?size=1024`;
} else if (img) { } else if (img) {
@ -273,7 +281,8 @@ async function lookupUser(msg, str, filter) {
if (/[0-9]{17,21}/.test(str)) { if (/[0-9]{17,21}/.test(str)) {
return await hf.bot.requestHandler.request( return await hf.bot.requestHandler.request(
"GET", "GET",
"/users/" + str.match(/([0-9]{17,21})/)[1] "/users/" + str.match(/([0-9]{17,21})/)[1],
true
); );
} }