diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/commands/info/help.ts | 44 | ||||
-rw-r--r-- | src/config/example-options.ts | 4 | ||||
-rw-r--r-- | src/lib/utils/Config.ts | 3 |
3 files changed, 37 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] }); } } diff --git a/src/config/example-options.ts b/src/config/example-options.ts index 55e655c..2ae18a4 100644 --- a/src/config/example-options.ts +++ b/src/config/example-options.ts @@ -29,5 +29,9 @@ export default new Config({ db: false, verbose: false, info: true + }, + supportGuild: { + id: '812400566235430912', + invite: 'https://discord.gg/mWtDmq6XcB' } }); diff --git a/src/lib/utils/Config.ts b/src/lib/utils/Config.ts index d6b5802..65f43cb 100644 --- a/src/lib/utils/Config.ts +++ b/src/lib/utils/Config.ts @@ -8,6 +8,7 @@ export interface ConfigOptions { channels: { log: Snowflake; error: Snowflake; dm: Snowflake }; db: { host: string; port: number; username: string; password: string }; logging: { db: boolean; verbose: boolean; info: boolean }; + supportGuild: {id: Snowflake, invite: string} } export class Config { @@ -18,6 +19,7 @@ export class Config { public channels: { log: Snowflake; error: Snowflake; dm: Snowflake }; public db: { host: string; port: number; username: string; password: string }; public logging: { db: boolean; verbose: boolean; info: boolean }; + public supportGuild: {id: Snowflake, invite: string} public constructor(options: ConfigOptions) { this.credentials = options.credentials; @@ -27,6 +29,7 @@ export class Config { this.channels = options.channels; this.db = options.db; this.logging = options.logging; + this.supportGuild = options.supportGuild } public get token(): string { |