blob: 70998d5804535e3c33d5aa697d0352b24a0737a3 [file] [log] [blame]
pineafanad54d752022-04-18 19:01:43 +01001import Discord, { CommandInteraction, Guild, MessageActionRow, MessageButton } from "discord.js";
2import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
3import { WrappedCheck } from "jshaiku";
pineafan4edb7762022-06-26 19:21:04 +01004import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
pineafanad54d752022-04-18 19:01:43 +01005import getEmojiByName from "../../utils/getEmojiByName.js";
6import generateKeyValueList, { toCapitals } from "../../utils/generateKeyValueList.js";
PineappleFanb3dd83c2022-06-17 10:53:48 +01007import client from "../../utils/client.js"
pineafanad54d752022-04-18 19:01:43 +01008
9const command = (builder: SlashCommandSubcommandBuilder) => builder
10 .setName("about")
11 .setDescription("Shows info about the server")
12
pineafan4edb7762022-06-26 19:21:04 +010013const callback = async (interaction: CommandInteraction): Promise<any> => {
pineafanad54d752022-04-18 19:01:43 +010014 let guild = interaction.guild as Guild;
PineappleFanb3dd83c2022-06-17 10:53:48 +010015 const { renderUser, renderDelta } = client.logger
pineafan4edb7762022-06-26 19:21:04 +010016 interaction.reply({embeds: [new EmojiEmbed()
pineafanad54d752022-04-18 19:01:43 +010017 .setTitle("Server Info")
18 .setStatus("Success")
19 .setEmoji("GUILD.GREEN")
20 .setDescription(
21 generateKeyValueList({
22 "name": guild.name,
23 "id": `\`${guild.id}\``,
24 "owner": `${renderUser((await guild.fetchOwner()).user)}`,
25 "created": `${renderDelta(guild.createdTimestamp)}`,
26 "emojis": `${guild.emojis.cache.size}` + (guild.emojis.cache.size > 1 ? `\n> ${
27 guild.emojis.cache.first(10).map((emoji) => `<${emoji.animated ? 'a' : ''}:${emoji.name}:${emoji.id}>`).join(" ")
28 }` +
29 (guild.emojis.cache.size > 10 ? ` and ${guild.emojis.cache.size - 10} more` : ``) : ""),
30 "icon": `[Discord](${guild.iconURL()})`,
31 "2 factor authentication": `${guild.mfaLevel === "NONE" ? `${getEmojiByName("CONTROL.CROSS")} No` : `${getEmojiByName("CONTROL.TICK")} Yes`}`,
32 "verification level": `${toCapitals(guild.verificationLevel)}`,
33 "explicit content filter": `${toCapitals(guild.explicitContentFilter.toString().replace(/_/, " ", ))}`,
pineafane23c4ec2022-07-27 21:56:27 +010034 "nitro boost level": `${guild.premiumTier !== "NONE" ? guild.premiumTier.toString()[-1] : "0"}`,
pineafanad54d752022-04-18 19:01:43 +010035 "channels": `${guild.channels.cache.size}`,
36 "roles": `${guild.roles.cache.size}`,
37 "members": `${guild.memberCount}`,
38 })
39 )
40 .setThumbnail(guild.iconURL({dynamic: true}))
41 ], ephemeral: true});
42}
43
44const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
45 return true;
46}
47
48export { command };
49export { callback };
50export { check };