Update !server embed to be consistent with !invite embed

This commit is contained in:
Dragory 2020-08-05 22:01:29 +03:00
parent 25b23c61ef
commit 6118639dd3
No known key found for this signature in database
GPG key ID: 5F387BA66DF8AAC1

View file

@ -1,6 +1,6 @@
import { PluginData } from "knub"; import { PluginData } from "knub";
import { UtilityPluginType } from "../types"; import { UtilityPluginType } from "../types";
import { embedPadding, formatNumber, memoize, MINUTES, resolveUser, trimLines } from "../../../utils"; import { embedPadding, formatNumber, memoize, MINUTES, preEmbedPadding, resolveUser, trimLines } from "../../../utils";
import { CategoryChannel, EmbedOptions, Guild, RESTChannelInvite, TextChannel, VoiceChannel } from "eris"; import { CategoryChannel, EmbedOptions, Guild, RESTChannelInvite, TextChannel, VoiceChannel } from "eris";
import moment from "moment-timezone"; import moment from "moment-timezone";
import humanizeDuration from "humanize-duration"; import humanizeDuration from "humanize-duration";
@ -35,7 +35,10 @@ export async function getServerInfoEmbed(
color: parseInt("6b80cf", 16), color: parseInt("6b80cf", 16),
}; };
embed.thumbnail = { url: (guildPreview || restGuild).iconURL }; embed.author = {
name: `Server: ${(guildPreview || restGuild).name}`,
icon_url: (guildPreview || restGuild).iconURL,
};
// BASIC INFORMATION // BASIC INFORMATION
const createdAt = moment((guildPreview || restGuild).createdAt); const createdAt = moment((guildPreview || restGuild).createdAt);
@ -60,8 +63,8 @@ export async function getServerInfoEmbed(
} }
embed.fields.push({ embed.fields.push({
name: `Server information - ${(guildPreview || restGuild).name}`, name: preEmbedPadding + "Basic information",
value: basicInformation.join("\n") + embedPadding, value: basicInformation.join("\n"),
}); });
// MEMBER COUNTS // MEMBER COUNTS
@ -105,7 +108,7 @@ export async function getServerInfoEmbed(
} }
embed.fields.push({ embed.fields.push({
name: "Members", name: preEmbedPadding + "Members",
inline: true, inline: true,
value: trimLines(` value: trimLines(`
${memberCountTotalLines} ${memberCountTotalLines}
@ -122,15 +125,14 @@ export async function getServerInfoEmbed(
const voiceChannels = thisServer.channels.filter(channel => channel instanceof VoiceChannel); const voiceChannels = thisServer.channels.filter(channel => channel instanceof VoiceChannel);
embed.fields.push({ embed.fields.push({
name: "Channels", name: preEmbedPadding + "Channels",
inline: true, inline: true,
value: value: trimLines(`
trimLines(`
Total: **${totalChannels}** / 500 Total: **${totalChannels}** / 500
Categories: **${categories.length}** Categories: **${categories.length}**
Text: **${textChannels.length}** Text: **${textChannels.length}**
Voice: **${voiceChannels.length}** Voice: **${voiceChannels.length}**
`) + embedPadding, `),
}); });
} }
@ -159,9 +161,9 @@ export async function getServerInfoEmbed(
} }
embed.fields.push({ embed.fields.push({
name: "Other stats", name: preEmbedPadding + "Other stats",
inline: true, inline: true,
value: otherStats.join("\n") + embedPadding, value: otherStats.join("\n"),
}); });
if (!thisServer) { if (!thisServer) {