aboutsummaryrefslogtreecommitdiff
path: root/src/commands/info/invite.ts
blob: 923c54a8cb91f37dace06cfb5af4c43107521910 (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
33
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 (this.client.config.isDevelopment)
			return await message.util.reply(`${this.client.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=${this.client.user.id}&permissions=2147483647&scope=bot%20applications.commands`
			})
		);
		return await message.util.reply({ components: [ButtonRow] });
	}
}