mirror of
https://github.com/toast-ts/Daggerbot-TS.git
synced 2024-11-17 00:10:58 -05:00
Refactor inviteinfo.ts
This commit is contained in:
parent
e4dbe8a536
commit
fb21c14f79
@ -2,19 +2,20 @@ import Discord from 'discord.js';
|
|||||||
import TClient from '../client.js';
|
import TClient from '../client.js';
|
||||||
export default {
|
export default {
|
||||||
async run(client: TClient, interaction: Discord.ChatInputCommandInteraction<'cached'>){
|
async run(client: TClient, interaction: Discord.ChatInputCommandInteraction<'cached'>){
|
||||||
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=>
|
await client.fetchInvite(interaction.options.getString('code',true).replace(/(https:\/\/|discord.gg\/)/g,'')).then(async inviteData=>
|
||||||
await interaction.reply({embeds: [
|
await interaction.reply({embeds:[new client.embed()
|
||||||
new client.embed().setColor(client.config.embedColor).setURL(`https://discord.gg/${inviteInfo.data.code}`).setTitle(inviteInfo.data.guild.name).setDescription([
|
.setColor(client.config.embedColor).setURL(`https://discord.gg/${inviteData.code}`).setTitle(inviteData.guild.name).setDescription([
|
||||||
`ID: \`${inviteInfo.data.guild.id}\``,
|
`ID: \`${inviteData.guild.id}\``,
|
||||||
`Description: \`\`\`${inviteInfo.data.guild.description != null ? inviteInfo.data.guild.description : 'No description set.'}`,
|
`Description: \`\`\`${inviteData.guild.description != null ? inviteData.guild.description : 'No description set.'}`,
|
||||||
`\`\`\`Total server boosters: \`${inviteInfo.data.guild.premium_subscription_count}\``,
|
`\`\`\`Total server boosts: \`${inviteData.guild.premiumSubscriptionCount}\``,
|
||||||
`Channel: \`#${inviteInfo.data.channel.name}\``
|
`Total members: \`${inviteData.presenceCount}\`**/**\`${inviteData.memberCount}\``,
|
||||||
].join('\n'))
|
`Channel: \`#${inviteData.channel.name}\``,
|
||||||
]})).catch(err=>interaction.reply(`\`${err}\``))
|
].join('\n')).setThumbnail(inviteData.guild.iconURL({size:1024,extension:'webp'})).setImage(inviteData.guild.bannerURL({size:2048,extension:'webp'}))
|
||||||
|
]})).catch((err:Discord.DiscordAPIError)=>interaction.reply(err.message));
|
||||||
},
|
},
|
||||||
data: new Discord.SlashCommandBuilder()
|
data: new Discord.SlashCommandBuilder()
|
||||||
.setName('inviteinfo')
|
.setName('inviteinfo')
|
||||||
.setDescription('View the invite data')
|
.setDescription('View the server data from invite link')
|
||||||
.addStringOption(x=>x
|
.addStringOption(x=>x
|
||||||
.setName('code')
|
.setName('code')
|
||||||
.setDescription('Discord invite code')
|
.setDescription('Discord invite code')
|
||||||
|
Loading…
Reference in New Issue
Block a user