aboutsummaryrefslogtreecommitdiff
path: root/src/commands/info/links.ts
blob: d9d5b8ae22fbf5fcb94e153dc113c5e80ab3ab13 (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
34
35
36
import { BushCommand, type BushMessage, type BushSlashMessage } from '#lib';
import { assert } from 'console';
import { ActionRow, ButtonComponent, ButtonStyle } from 'discord.js';
import packageDotJSON from '../../../package.json' assert { type: 'json' };

assert(packageDotJSON);

export default class LinksCommand extends BushCommand {
	public constructor() {
		super('links', {
			aliases: ['links', 'invite', 'support'],
			category: 'info',
			description: 'Sends bot links',
			usage: ['links'],
			examples: ['links'],
			clientPermissions: (m) => util.clientSendAndPermCheck(m),
			userPermissions: [],
			slash: true
		});
	}

	public override async exec(message: BushMessage | BushSlashMessage) {
		const buttonRow = new ActionRow();
		if (!client.config.isDevelopment || message.author.isOwner()) {
			// @ts-expect-error: outdated @discord.js/builders
			buttonRow.addComponents(new ButtonComponent().setStyle(ButtonStyle.Link).setLabel('Invite Me').setURL(util.invite));
		}
		buttonRow.addComponents(
			// @ts-expect-error: outdated @discord.js/builders
			new ButtonComponent().setStyle(ButtonStyle.Link).setLabel('Support Server').setURL(client.config.supportGuild.invite),
			// @ts-expect-error: outdated @discord.js/builders
			new ButtonComponent().setStyle(ButtonStyle.Link).setLabel('GitHub').setURL(packageDotJSON.repository)
		);
		return await message.util.reply({ content: 'Here are some useful links:', components: [buttonRow] });
	}
}