aboutsummaryrefslogtreecommitdiff
path: root/src/commands/info/invite.ts
blob: a2128b34623fe14c8b1fbd08e404c0719ed78303 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import { BushCommand, BushMessage, BushSlashMessage } from '@lib';
import { MessageActionRow, MessageButton } from 'discord.js';

export default class InviteCommand extends BushCommand {
	public constructor() {
		super('invite', {
			aliases: ['invite'],
			category: 'info',
			description: {
				content: 'Sends the bot invite link.',
				usage: 'invite',
				examples: ['invite']
			},
			ratelimit: 4,
			cooldown: 4000,
			clientPermissions: ['SEND_MESSAGES'],
			slash: true
		});
	}

	public async exec(message: BushMessage | BushSlashMessage): Promise<unknown> {
		if (client.config.isDevelopment) return await message.util.reply(`${util.emojis.error} The dev bot cannot be invited.`);
		const ButtonRow = new MessageActionRow().addComponents(
			new MessageButton({
				style: 'LINK',
				label: 'Invite Me',
				url: `https://discord.com/api/oauth2/authorize?client_id=${client.user.id}&permissions=2147483647&scope=bot%20applications.commands`
			})
		);
		return await message.util.reply({ content: 'You can invite me here:', components: [ButtonRow] });
	}
}