From cdbae2c0be39c366e2b13e2e790afeb9de2e53ea Mon Sep 17 00:00:00 2001 From: Cynthia Foxwell Date: Sun, 9 Oct 2022 12:23:48 -0600 Subject: [PATCH] replace requestHandler references --- src/lib/utils.js | 31 ++++++++++++++----------------- src/modules/utility.js | 13 ++++++++----- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/lib/utils.js b/src/lib/utils.js index 16be28d..0cea28e 100644 --- a/src/lib/utils.js +++ b/src/lib/utils.js @@ -110,12 +110,11 @@ async function getImage(msg, str) { const id = refMsg.content.match(//)[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(//)[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; diff --git a/src/modules/utility.js b/src/modules/utility.js index 6aada23..963626b 100644 --- a/src/modules/utility.js +++ b/src/modules/utility.js @@ -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) {