replace requestHandler references
This commit is contained in:
parent
ff6af3c90e
commit
cdbae2c0be
2 changed files with 22 additions and 22 deletions
|
@ -110,12 +110,11 @@ async function getImage(msg, str) {
|
||||||
const id = refMsg.content.match(/<a?:[a-zA-Z0-9_]*:([0-9]*)>/)[1];
|
const id = refMsg.content.match(/<a?:[a-zA-Z0-9_]*:([0-9]*)>/)[1];
|
||||||
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(
|
const user = await hf.bot.rest.authRequest({
|
||||||
"GET",
|
method: "GET",
|
||||||
"/users/" + id,
|
path: "/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`;
|
||||||
}
|
}
|
||||||
|
@ -134,12 +133,11 @@ async function getImage(msg, str) {
|
||||||
const id = str.match(/<a?:[a-zA-Z0-9_]*:([0-9]*)>/)[1];
|
const id = str.match(/<a?:[a-zA-Z0-9_]*:([0-9]*)>/)[1];
|
||||||
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(
|
const user = await hf.bot.rest.authRequest({
|
||||||
"GET",
|
method: "GET",
|
||||||
"/users/" + id,
|
path: "/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) {
|
||||||
|
@ -270,11 +268,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.requestHandler.request(
|
return await hf.bot.rest.authRequest({
|
||||||
"GET",
|
method: "GET",
|
||||||
"/users/" + str.match(/([0-9]{17,21})/)[1],
|
path: "/users/" + str.match(/([0-9]{17,21})/)[1],
|
||||||
true
|
});
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let users;
|
let users;
|
||||||
|
|
|
@ -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.";
|
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\//, "");
|
line = line.replace(/(https?:\/\/)?discord\.gg\//, "");
|
||||||
|
|
||||||
const invite = await hf.bot.requestHandler.request(
|
const invite = await hf.bot.rest.request({
|
||||||
"GET",
|
method: "GET",
|
||||||
"/invites/" + line + "?with_counts=1"
|
path: "/invites/" + line + "?with_counts=1",
|
||||||
);
|
});
|
||||||
if (!invite) return ":warning: No data returned.";
|
if (!invite) return ":warning: No data returned.";
|
||||||
|
|
||||||
if (invite.message) {
|
if (invite.message) {
|
||||||
|
|
Loading…
Reference in a new issue