!server: make sure we only show information for other servers when it's public information

This commit is contained in:
Dragory 2020-08-05 04:59:57 +03:00
parent d1402b2400
commit 52980a2515
No known key found for this signature in database
GPG key ID: 5F387BA66DF8AAC1

View file

@ -22,6 +22,11 @@ export async function serverInfo(pluginData: PluginData<UtilityPluginType>, serv
return null;
}
const features = (restGuild || guildPreview).features;
if (!thisServer && !features.includes("DISCOVERABLE")) {
return null;
}
const embed: EmbedOptions = {
fields: [],
color: parseInt("6b80cf", 16),
@ -47,7 +52,6 @@ export async function serverInfo(pluginData: PluginData<UtilityPluginType>, serv
basicInformation.push(`Voice region: **${thisServer.region}**`);
}
const features = (guildPreview || restGuild).features;
if (features.length > 0) {
basicInformation.push(`Features: ${features.join(", ")}`);
}
@ -157,5 +161,11 @@ export async function serverInfo(pluginData: PluginData<UtilityPluginType>, serv
value: otherStats.join("\n") + embedPadding,
});
if (!thisServer) {
embed.footer = {
text: "⚠️ Only showing publicly available information for this server",
};
}
return embed;
}