diff options
author | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2022-07-14 08:59:39 -0400 |
---|---|---|
committer | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2022-07-14 08:59:39 -0400 |
commit | bddeb83bc0641a059a08c5887e6585c759c3b643 (patch) | |
tree | 6d4a70a6568d42014d8d93842b7ae956bd8ce42c /src | |
parent | e30edf77d2cc27db97a6b6b1f845730c4924046c (diff) | |
download | tanzanite-bddeb83bc0641a059a08c5887e6585c759c3b643.tar.gz tanzanite-bddeb83bc0641a059a08c5887e6585c759c3b643.tar.bz2 tanzanite-bddeb83bc0641a059a08c5887e6585c759c3b643.zip |
invite info
Diffstat (limited to 'src')
-rw-r--r-- | src/commands/info/inviteInfo.ts | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/src/commands/info/inviteInfo.ts b/src/commands/info/inviteInfo.ts new file mode 100644 index 0000000..bfe7eae --- /dev/null +++ b/src/commands/info/inviteInfo.ts @@ -0,0 +1,43 @@ +import { Arg, ArgType, BushCommand, clientSendAndPermCheck, colors, type CommandMessage, type SlashMessage } from '#lib'; +import { ApplicationCommandOptionType, EmbedBuilder, Invite, PermissionFlagsBits } from 'discord.js'; + +export default class InviteInfoCommand extends BushCommand { + public constructor() { + super('inviteInfo', { + aliases: ['invite-info', 'ii'], + category: 'info', + description: 'Get info about an invite.', + usage: ['invite-info [invite]'], + examples: ['invite-info discord.gg/moulberry'], + args: [ + { + id: 'invite', + description: 'The guild to find information about.', + type: 'invite', + prompt: 'What invite would you like to find information about?', + retry: '{error} Choose a valid invite to find information about.', + slashType: ApplicationCommandOptionType.String + } + ], + slash: true, + clientPermissions: (m) => clientSendAndPermCheck(m, [PermissionFlagsBits.EmbedLinks], true), + userPermissions: [] + }); + } + + public override async exec(message: CommandMessage | SlashMessage, args: { invite: ArgType<'invite' | 'string'> }) { + const invite = message.util.isSlashMessage(message) + ? ((await Arg.cast('invite', message, args.invite as string)) as ArgType<'invite'>) + : args.invite; + + const inviteInfoEmbed = new EmbedBuilder().setTitle(`Invite to ${invite.guild.name}`).setColor(colors.default); + + this.generateAboutField(inviteInfoEmbed, invite); + } + + private generateAboutField(embed: EmbedBuilder, invite: Invite) { + const about = [`**code:** ${invite.code}`, `**channel:** ${}`]; + + embed.addFields({ name: 'ยป About', value: about.join('\n') }); + } +} |