lookupinvite: nullcheck guild features
This commit is contained in:
parent
850228e237
commit
a39bffd0df
1 changed files with 10 additions and 6 deletions
|
@ -25,7 +25,7 @@ lookupinvite.callback = async function (msg, line) {
|
|||
|
||||
line = line.replace(/(https?:\/\/)?discord(\.gg|(app)?.com\/invite)\//, "");
|
||||
|
||||
if (decodeURI(line).indexOf("../") > -1) return "nuh uh";
|
||||
if (decodeURIComponent(line).indexOf("../") > -1) return "nuh uh";
|
||||
|
||||
let bail = false;
|
||||
let error;
|
||||
|
@ -74,8 +74,6 @@ lookupinvite.callback = async function (msg, line) {
|
|||
}
|
||||
: null;
|
||||
|
||||
const features = formatGuildFeatures(invite.guild.features);
|
||||
|
||||
switch (invite.type) {
|
||||
case 0: {
|
||||
embed.fields.push(
|
||||
|
@ -114,6 +112,12 @@ lookupinvite.callback = async function (msg, line) {
|
|||
.join("\n")}`,
|
||||
inline: false,
|
||||
},
|
||||
].filter((x) => !!x)
|
||||
);
|
||||
|
||||
if (invite.guild.features) {
|
||||
const features = formatGuildFeatures(invite.guild.features);
|
||||
embed.fields.push(
|
||||
{
|
||||
name: `Features (${features.length})`,
|
||||
value: features.length > 0 ? features.slice(0, Math.ceil(features.length / 2)).join("\n") : "None",
|
||||
|
@ -125,9 +129,9 @@ lookupinvite.callback = async function (msg, line) {
|
|||
value: features.slice(Math.ceil(features.length / 2), features.length).join("\n"),
|
||||
inline: true,
|
||||
}
|
||||
: null,
|
||||
].filter((x) => !!x)
|
||||
: null
|
||||
);
|
||||
}
|
||||
|
||||
const guildIcon = invite.guild?.icon && CDNEndpoints.GUILD_ICON(invite.guild.id, invite.guild.icon);
|
||||
const guildSplash = invite.guild?.splash && CDNEndpoints.GUILD_SPLASH(invite.guild.id, invite.guild.splash);
|
||||
|
|
Loading…
Reference in a new issue