1
0
mirror of https://github.com/toast-ts/Daggerbot-TS.git synced 2024-11-17 04:10:59 -05:00
Daggerbot-TS/src/commands/inviteinfo.ts
2024-02-18 05:54:55 +11:00

25 lines
1.5 KiB
TypeScript

import Discord from 'discord.js';
import TClient from '../client.js';
import MessageTool from '../helpers/MessageTool.js';
export default class InviteInfo {
static async run(client: TClient, interaction: Discord.ChatInputCommandInteraction<'cached'>){
await client.fetchInvite(interaction.options.getString('code',true).replace(/(https:\/\/)/g,'')).then(async inviteData=>
await interaction.reply({embeds:[new client.embed()
.setColor(client.config.embedColor).setURL(`https://discord.gg/${inviteData.code}`).setTitle(inviteData.guild.name).setDescription(MessageTool.concatMessage(
`ID: \`${inviteData.guild.id}\``,
`Description: \`\`\`${inviteData.guild.description != null ? inviteData.guild.description : 'No description set'}`,
`\`\`\`Total server boosts: \`${inviteData.guild.premiumSubscriptionCount}\``,
`Total members: \`${inviteData.presenceCount}\`**/**\`${inviteData.memberCount}\``,
`Channel: \`#${inviteData.channel.name}\``,
)).setThumbnail(inviteData.guild.iconURL({size:1024,extension:'webp'})).setImage(inviteData.guild.bannerURL({size:2048,extension:'webp'}))
]})).catch((err:Discord.DiscordAPIError)=>interaction.reply(err.message));
}
static data = new Discord.SlashCommandBuilder()
.setName('inviteinfo')
.setDescription('View the server data from invite link')
.addStringOption(x=>x
.setName('code')
.setDescription('Discord invite code')
.setRequired(true))
}