replace requestHandler references

This commit is contained in:
Cynthia Foxwell 2022-10-09 12:23:48 -06:00
parent ff6af3c90e
commit cdbae2c0be
2 changed files with 22 additions and 22 deletions

View file

@ -110,12 +110,11 @@ async function getImage(msg, str) {
const id = refMsg.content.match(/<a?:[a-zA-Z0-9_]*:([0-9]*)>/)[1];
return `https://cdn.discordapp.com/emojis/${id}.png?v=1`;
} else if (/<@!?([0-9]*)>/.test(refMsg.content)) {
const id = refMsg.content.match(/<@?!([0-9]*)>/)[1];
const user = await hf.bot.requestHandler.request(
"GET",
"/users/" + id,
true
);
const id = refMsg.content.match(/<@!?([0-9]*)>/)[1];
const user = await hf.bot.rest.authRequest({
method: "GET",
path: "/users/" + id,
});
if (user)
return `https://cdn.discordapp.com/avatars/${id}/${user.avatar}.png?size=1024`;
}
@ -134,12 +133,11 @@ async function getImage(msg, str) {
const id = str.match(/<a?:[a-zA-Z0-9_]*:([0-9]*)>/)[1];
return `https://cdn.discordapp.com/emojis/${id}.png?v=1`;
} else if (/<@!?([0-9]*)>/.test(str)) {
const id = str.match(/<@?!([0-9]*)>/)[1];
const user = await hf.bot.requestHandler.request(
"GET",
"/users/" + id,
true
);
const id = str.match(/<@!?([0-9]*)>/)[1];
const user = await hf.bot.rest.authRequest({
method: "GET",
path: "/users/" + id,
});
if (user)
return `https://cdn.discordapp.com/avatars/${id}/${user.avatar}.png?size=1024`;
} else if (img) {
@ -270,11 +268,10 @@ async function selectionMessage(
async function lookupUser(msg, str, filter) {
if (/[0-9]{17,21}/.test(str)) {
return await hf.bot.requestHandler.request(
"GET",
"/users/" + str.match(/([0-9]{17,21})/)[1],
true
);
return await hf.bot.rest.authRequest({
method: "GET",
path: "/users/" + str.match(/([0-9]{17,21})/)[1],
});
}
let users;

View file

@ -242,7 +242,10 @@ banner.callback = async function (msg, line) {
}
}
const user = await hf.bot.requestHandler.request("GET", "/users/" + id, true);
const user = await hf.bot.rest.authRequest({
method: "GET",
path: "/users/" + id,
});
if (!user.banner) return "This user does not have a banner.";
@ -275,10 +278,10 @@ lookupinvite.callback = async function (msg, line) {
line = line.replace(/(https?:\/\/)?discord\.gg\//, "");
const invite = await hf.bot.requestHandler.request(
"GET",
"/invites/" + line + "?with_counts=1"
);
const invite = await hf.bot.rest.request({
method: "GET",
path: "/invites/" + line + "?with_counts=1",
});
if (!invite) return ":warning: No data returned.";
if (invite.message) {