1import {
2 ChatInputCommandInteraction,
3 EmbedBuilder,
4 SlashCommandBuilder,
5} from 'discord.js'
6import { Command } from '@/types/bot'
7
8export default {
9 data: new SlashCommandBuilder()
10 .setName('serverinfo')
11 .setDescription('Get information about the server'),
12
13 async execute(interaction: ChatInputCommandInteraction) {
14 if (!interaction.guild) {
15 await interaction.reply({
16 content: 'This command can only be used in a server!',
17 ephemeral: true,
18 })
19 return
20 }
21
22 const embed = new EmbedBuilder()
23 .setColor('#0099ff')
24 .setTitle(interaction.guild.name)
25 .setThumbnail(interaction.guild.iconURL() ?? '')
26 .addFields(
27 {
28 name: 'Owner',
29 value: `<@${interaction.guild.ownerId}>`,
30 inline: true,
31 },
32 {
33 name: 'Members',
34 value: interaction.guild.memberCount.toString(),
35 inline: true,
36 },
37 {
38 name: 'Created',
39 value: `<t:${Math.floor(interaction.guild.createdTimestamp / 1000)}:R>`,
40 inline: true,
41 },
42 {
43 name: 'Channels',
44 value: interaction.guild.channels.cache.size.toString(),
45 inline: true,
46 },
47 {
48 name: 'Roles',
49 value: interaction.guild.roles.cache.size.toString(),
50 inline: true,
51 },
52 {
53 name: 'Boost Level',
54 value: interaction.guild.premiumTier.toString(),
55 inline: true,
56 },
57 )
58 .setTimestamp()
59
60 await interaction.reply({ embeds: [embed] })
61 },
62} as Command
63