utility.linvite: try 3

This commit is contained in:
Cynthia Foxwell 2023-01-26 22:52:40 -07:00
parent ad3700bb82
commit 0834adf6e9

View file

@ -271,17 +271,14 @@ lookupinvite.category = CATEGORY;
lookupinvite.helpText = "Lookup an invite";
lookupinvite.usage = "<invite code>";
lookupinvite.addAlias("linvite");
lookupinvite.callback = async function (msg, line, [code]) {
if (!code) {
lookupinvite.callback = async function (msg, line) {
if (!line || line == "") {
return "No arguments passed.";
}
const invite = await hf.bot.requestHandler.request({
method: "GET",
path: `/invites/${code.replace(
/(https?:\/\/)?discord\.gg\//,
""
)}?with_counts=1`,
path: `/invites/${line}?with_counts=1`,
});
if (!invite) return ":warning: No data returned.";