const { SlashCommandBuilder } = require('discord.js'); module.exports = { data: new SlashCommandBuilder() .setName('info') .setDescription('Check user or server info.') .addSubcommand(subcommand => subcommand.setName('user') .setDescription('Check user info.') .addUserOption(option => option.setName('username') .setDescription('Input a user.') .setRequired(true) ) ) .addSubcommand(subcommand => subcommand.setName('server') .setDescription('Check server info.') ), async execute(interaction) { // user if (interaction.options.getSubcommand() === 'user') { const target = interaction.options.getUser('username'); let botCheck = 'no'; if (target.bot == true) botCheck = 'yes'; await interaction.reply(`### <@${target.id}>\n**Username:** ${target.username}\n**ID:** ${target.id}\n**Bot:** ${botCheck}\n**Date created:** ${target.createdAt.toUTCString()}`); } // server else if (interaction.options.getSubcommand() === 'server') { await interaction.reply(`### ${interaction.guild.name}\n**ID:** ${interaction.guild.id}\n**Number of members:** ${interaction.guild.memberCount}\n**Date created:** ${interaction.guild.createdAt.toUTCString()}`); } }, };