| import Discord, { CommandInteraction, Guild, MessageActionRow, MessageButton } from "discord.js"; |
| import { SlashCommandSubcommandBuilder } from "@discordjs/builders"; |
| import { WrappedCheck } from "jshaiku"; |
| import EmojiEmbed from "../../utils/generateEmojiEmbed.js"; |
| import getEmojiByName from "../../utils/getEmojiByName.js"; |
| import generateKeyValueList, { toCapitals } from "../../utils/generateKeyValueList.js"; |
| import client from "../../utils/client.js" |
| |
| const command = (builder: SlashCommandSubcommandBuilder) => builder |
| .setName("about") |
| .setDescription("Shows info about the server") |
| |
| const callback = async (interaction: CommandInteraction): Promise<any> => { |
| let guild = interaction.guild as Guild; |
| const { renderUser, renderDelta } = client.logger |
| interaction.reply({embeds: [new EmojiEmbed() |
| .setTitle("Server Info") |
| .setStatus("Success") |
| .setEmoji("GUILD.GREEN") |
| .setDescription( |
| generateKeyValueList({ |
| "name": guild.name, |
| "id": `\`${guild.id}\``, |
| "owner": `${renderUser((await guild.fetchOwner()).user)}`, |
| "created": `${renderDelta(guild.createdTimestamp)}`, |
| "emojis": `${guild.emojis.cache.size}` + (guild.emojis.cache.size > 1 ? `\n> ${ |
| guild.emojis.cache.first(10).map((emoji) => `<${emoji.animated ? 'a' : ''}:${emoji.name}:${emoji.id}>`).join(" ") |
| }` + |
| (guild.emojis.cache.size > 10 ? ` and ${guild.emojis.cache.size - 10} more` : ``) : ""), |
| "icon": `[Discord](${guild.iconURL()})`, |
| "2 factor authentication": `${guild.mfaLevel === "NONE" ? `${getEmojiByName("CONTROL.CROSS")} No` : `${getEmojiByName("CONTROL.TICK")} Yes`}`, |
| "verification level": `${toCapitals(guild.verificationLevel)}`, |
| "explicit content filter": `${toCapitals(guild.explicitContentFilter.toString().replace(/_/, " ", ))}`, |
| "nitro boost level": `${guild.premiumTier != "NONE" ? guild.premiumTier.toString()[-1] : "0"}`, |
| "channels": `${guild.channels.cache.size}`, |
| "roles": `${guild.roles.cache.size}`, |
| "members": `${guild.memberCount}`, |
| }) |
| ) |
| .setThumbnail(guild.iconURL({dynamic: true})) |
| ], ephemeral: true}); |
| } |
| |
| const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => { |
| return true; |
| } |
| |
| export { command }; |
| export { callback }; |
| export { check }; |