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