diff options
author | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-07-25 19:00:38 -0400 |
---|---|---|
committer | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-07-25 19:00:38 -0400 |
commit | 88e68875030086f5acf2c4295280e1b370242ec7 (patch) | |
tree | 1abbde525d54de5dceb4e99b3ea4c78bdb8816d4 /src/commands/info | |
parent | 479122efbd892c513b12b00f7860659e7fff8116 (diff) | |
download | tanzanite-88e68875030086f5acf2c4295280e1b370242ec7.tar.gz tanzanite-88e68875030086f5acf2c4295280e1b370242ec7.tar.bz2 tanzanite-88e68875030086f5acf2c4295280e1b370242ec7.zip |
feat: add more buttons to help command
Diffstat (limited to 'src/commands/info')
-rw-r--r-- | src/commands/info/help.ts | 44 |
1 files changed, 30 insertions, 14 deletions
diff --git a/src/commands/info/help.ts b/src/commands/info/help.ts index 67ba8c0..3c75645 100644 --- a/src/commands/info/help.ts +++ b/src/commands/info/help.ts @@ -1,5 +1,6 @@ import { BushCommand, BushMessage, BushSlashMessage } from '@lib'; import { MessageActionRow, MessageButton, MessageEmbed } from 'discord.js'; +import packageDotJSON from '../../../package.json'; export default class HelpCommand extends BushCommand { public constructor() { @@ -47,19 +48,34 @@ export default class HelpCommand extends BushCommand { args: { command: BushCommand | string; showHidden?: boolean } ): Promise<unknown> { const prefix = this.client.config.isDevelopment ? 'dev ' : message.util.parsed.prefix; - const components = - !this.client.config.isDevelopment && !this.client.guilds.cache.some((guild) => guild.ownerId === message.author.id) - ? [ - 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` - }) - ) - ] - : undefined; + const row = new MessageActionRow(); + if (!this.client.config.isDevelopment && !this.client.guilds.cache.some((guild) => guild.ownerId === message.author.id)) { + row.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` + }) + ); + } + if (!this.client.guilds.cache.get(this.client.config.supportGuild.id).members.cache.has(message.author.id)) { + row.addComponents( + new MessageButton({ + style: 'LINK', + label: 'Support Server', + url: this.client.config.supportGuild.invite + }) + ); + } + row.addComponents( + new MessageButton({ + style: 'LINK', + label: 'GitHub', + url: packageDotJSON.repository + }) + ) + const isOwner = this.client.isOwner(message.author); const isSuperUser = this.client.isSuperUser(message.author); const command = args.command @@ -94,7 +110,7 @@ export default class HelpCommand extends BushCommand { embed.addField(`${categoryNice}`, `${categoryCommands.join(' ')}`); } } - return await message.util.reply({ embeds: [embed], components }); + return await message.util.reply({ embeds: [embed], components: [row] }); } const embed = new MessageEmbed() @@ -112,6 +128,6 @@ export default class HelpCommand extends BushCommand { embed.addField('Examples', `\`${command.description.examples.join('`\n`')}\``, true); } - return await message.util.reply({ embeds: [embed], components }); + return await message.util.reply({ embeds: [embed], components: [row] }); } } |