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