2023-05-23 02:47:51 -04:00
|
|
|
import Discord from 'discord.js';
|
|
|
|
import TClient from '../client.js';
|
|
|
|
export default {
|
|
|
|
async run(client: TClient, interaction: Discord.ChatInputCommandInteraction<'cached'>){
|
2023-07-07 09:49:24 -04:00
|
|
|
await client.axios.get(`https://discord.com/api/v${Discord.APIVersion}/invites/${interaction.options.getString('code',true).replace(/(https:\/\/|discord.gg\/)/g,'')}`).then(async inviteInfo=>
|
2023-05-23 02:47:51 -04:00
|
|
|
await interaction.reply({embeds: [
|
|
|
|
new client.embed().setColor(client.config.embedColor).setURL(`https://discord.gg/${inviteInfo.data.code}`).setTitle(inviteInfo.data.guild.name).setDescription([
|
|
|
|
`ID: \`${inviteInfo.data.guild.id}\``,
|
|
|
|
`Description: \`\`\`${inviteInfo.data.guild.description != null ? inviteInfo.data.guild.description : 'No description set.'}`,
|
|
|
|
`\`\`\`Total server boosters: \`${inviteInfo.data.guild.premium_subscription_count}\``,
|
|
|
|
`Channel: \`#${inviteInfo.data.channel.name}\``
|
|
|
|
].join('\n'))
|
|
|
|
]})).catch(err=>interaction.reply(`\`${err}\``))
|
|
|
|
},
|
|
|
|
data: new Discord.SlashCommandBuilder()
|
|
|
|
.setName('inviteinfo')
|
|
|
|
.setDescription('View the invite data')
|
|
|
|
.addStringOption(x=>x
|
|
|
|
.setName('code')
|
2023-05-23 03:36:23 -04:00
|
|
|
.setDescription('Discord invite code')
|
|
|
|
.setRequired(true))
|
2023-05-23 02:47:51 -04:00
|
|
|
}
|