utility.linvite: attempt replace fix

This commit is contained in:
Cynthia Foxwell 2023-01-26 22:46:19 -07:00
parent 660ab272c5
commit 26fb765387

View file

@ -276,11 +276,12 @@ lookupinvite.callback = async function (msg, line) {
return "No arguments passed."; return "No arguments passed.";
} }
line = line.replace(/(https?:\/\/)?discord\.gg\//, "");
const invite = await hf.bot.requestHandler.request({ const invite = await hf.bot.requestHandler.request({
method: "GET", method: "GET",
path: "/invites/" + line + "?with_counts=1", path: `/invites/${line.replace(
/(https?:\/\/)?discord\.gg\//,
""
)}?with_counts=1`,
}); });
if (!invite) return ":warning: No data returned."; if (!invite) return ":warning: No data returned.";
@ -501,16 +502,16 @@ flagdump.callback = async function (msg, line, [numOrMention], {id}) {
if (!user) { if (!user) {
return "User not cached."; return "User not cached.";
} else { } else {
return `\`${user.username}#${user.discriminator}\`'s public flags:\n\`\`\`${flagFromInt( return `\`${user.username}#${
user.publicFlags user.discriminator
)}\`\`\``; }\`'s public flags:\n\`\`\`${flagFromInt(user.publicFlags)}\`\`\``;
} }
} else if (!isNaN(num)) { } else if (!isNaN(num)) {
return `\`\`\`\n${flagFromInt(num)}\`\`\``; return `\`\`\`\n${flagFromInt(num)}\`\`\``;
} else { } else {
return `\`${msg.author.username}#${msg.author.discriminator}\`'s public flags:\n\`\`\`${flagFromInt( return `\`${msg.author.username}#${
msg.author.publicFlags msg.author.discriminator
)}\`\`\``; }\`'s public flags:\n\`\`\`${flagFromInt(msg.author.publicFlags)}\`\`\``;
} }
}; };
hf.registerCommand(flagdump); hf.registerCommand(flagdump);
@ -710,7 +711,8 @@ presence.callback = async function (msg, line) {
} }
if (target) { if (target) {
if (!target.clientStatus) return `**${target.username}#${target.discriminator}** is offline.`; if (!target.clientStatus)
return `**${target.username}#${target.discriminator}** is offline.`;
let icons = ""; let icons = "";
for (const platform of Object.keys(target.clientStatus)) { for (const platform of Object.keys(target.clientStatus)) {
@ -902,7 +904,9 @@ presence.callback = async function (msg, line) {
} }
return { return {
content: `Presence for **${target.username}#${target.discriminator}**: ${icons.trim()}`, content: `Presence for **${target.username}#${
target.discriminator
}**: ${icons.trim()}`,
embeds, embeds,
files, files,
}; };