utility: banner command
This commit is contained in:
parent
1cd8a6052f
commit
460f757933
1 changed files with 42 additions and 0 deletions
|
@ -87,6 +87,48 @@ avatar.callback = async function (msg, line) {
|
||||||
};
|
};
|
||||||
hf.registerCommand(avatar);
|
hf.registerCommand(avatar);
|
||||||
|
|
||||||
|
const banner = new Command("banner");
|
||||||
|
banner.category = CATEGORY;
|
||||||
|
banner.helpText = "Get banner of a user";
|
||||||
|
banner.usage = "<user>";
|
||||||
|
banner.callback = async function (msg, line) {
|
||||||
|
const color = getTopColor(msg, hf.bot.user.id, pastelize(hf.bot.user.id));
|
||||||
|
|
||||||
|
let id = msg.author.id;
|
||||||
|
|
||||||
|
if (line) {
|
||||||
|
const lookup = await lookupUser(msg, line);
|
||||||
|
if (
|
||||||
|
lookup == "No results" ||
|
||||||
|
lookup == "Canceled" ||
|
||||||
|
lookup == "Request timed out"
|
||||||
|
) {
|
||||||
|
return lookup;
|
||||||
|
} else {
|
||||||
|
id = lookup.id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const user = await hf.bot.requestHandler.request("GET", "/users/" + id, true);
|
||||||
|
|
||||||
|
if (!user.banner) return "This user does not have a banner.";
|
||||||
|
|
||||||
|
const url = `${BANNER_BASE}${user.id}/${user.banner}.${
|
||||||
|
user.banner.startsWith("a_") ? "gif?size=1024&_=.gif" : "png?size=1024"
|
||||||
|
}`;
|
||||||
|
return {
|
||||||
|
embed: {
|
||||||
|
color,
|
||||||
|
title: `Avatar for \`${user.username}#${user.discriminator}\``,
|
||||||
|
url,
|
||||||
|
image: {
|
||||||
|
url,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
};
|
||||||
|
hf.registerCommand(banner);
|
||||||
|
|
||||||
const lookupinvite = new Command("lookupinvite");
|
const lookupinvite = new Command("lookupinvite");
|
||||||
lookupinvite.category = CATEGORY;
|
lookupinvite.category = CATEGORY;
|
||||||
lookupinvite.helpText = "Lookup an invite";
|
lookupinvite.helpText = "Lookup an invite";
|
||||||
|
|
Loading…
Reference in a new issue