utils: fix missed request handler calls

This commit is contained in:
Cynthia Foxwell 2023-03-06 18:21:57 -07:00
parent f52f14d3a3
commit 12289bbee9

View file

@ -113,10 +113,7 @@ 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.rest.authRequest({ const user = await hf.bot.requestHandler.request("GET", "/users/" + id);
method: "GET",
path: "/users/" + id,
});
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`;
} }
@ -136,10 +133,7 @@ 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.rest.authRequest({ const user = await hf.bot.requestHandler.request("GET", "/users/" + id);
method: "GET",
path: "/users/" + id,
});
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) {
@ -277,10 +271,10 @@ async function selectionMessage(
async function lookupUser(msg, str, filter) { async function lookupUser(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.requestHandler.request(
method: "GET", "GET",
path: "/users/" + str.match(/([0-9]{17,21})/)[1], "/users/" + str.match(/([0-9]{17,21})/)[1]
}); );
} }
let users; let users;