aboutsummaryrefslogtreecommitdiff
path: root/src/commands/info/links.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/commands/info/links.ts')
-rw-r--r--src/commands/info/links.ts31
1 files changed, 10 insertions, 21 deletions
diff --git a/src/commands/info/links.ts b/src/commands/info/links.ts
index b0d2007..25b040c 100644
--- a/src/commands/info/links.ts
+++ b/src/commands/info/links.ts
@@ -1,7 +1,8 @@
import { BushCommand, type BushMessage, type BushSlashMessage } from '#lib';
import { assert } from 'console';
-import { MessageActionRow, MessageButton } from 'discord.js';
+import { ActionRow, ButtonComponent, ButtonStyle } from 'discord.js';
import packageDotJSON from '../../../package.json' assert { type: 'json' };
+
assert(packageDotJSON);
export default class LinksCommand extends BushCommand {
@@ -19,26 +20,14 @@ export default class LinksCommand extends BushCommand {
}
public override async exec(message: BushMessage | BushSlashMessage) {
- 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=5368709119918&scope=bot%20applications.commands`
- }),
- new MessageButton({
- style: 'LINK',
- label: 'Support Server',
- url: client.config.supportGuild.invite
- }),
- new MessageButton({
- style: 'LINK',
- label: 'GitHub',
- url: packageDotJSON.repository
- })
+ const buttonRow = new ActionRow();
+ if (!client.config.isDevelopment || message.author.isOwner()) {
+ buttonRow.addComponents(new ButtonComponent().setStyle(ButtonStyle.Link).setLabel('Invite Me').setURL(util.invite));
+ }
+ buttonRow.addComponents(
+ new ButtonComponent().setStyle(ButtonStyle.Link).setLabel('Support Server').setURL(client.config.supportGuild.invite),
+ new ButtonComponent().setStyle(ButtonStyle.Link).setLabel('GitHub').setURL(packageDotJSON.repository)
);
- return await message.util.reply({ content: '\u200B', components: [ButtonRow] });
+ return await message.util.reply({ content: 'Here are some useful links:', components: [buttonRow] });
}
}