1
0
mirror of https://github.com/toast-ts/Daggerbot-TS.git synced 2024-11-17 08:20:58 -05:00
Daggerbot-TS/src/commands/inviteinfo.ts

25 lines
1.5 KiB
TypeScript
Raw Normal View History

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