aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-07-25 19:00:38 -0400
committerIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-07-25 19:00:38 -0400
commit88e68875030086f5acf2c4295280e1b370242ec7 (patch)
tree1abbde525d54de5dceb4e99b3ea4c78bdb8816d4
parent479122efbd892c513b12b00f7860659e7fff8116 (diff)
downloadtanzanite-88e68875030086f5acf2c4295280e1b370242ec7.tar.gz
tanzanite-88e68875030086f5acf2c4295280e1b370242ec7.tar.bz2
tanzanite-88e68875030086f5acf2c4295280e1b370242ec7.zip
feat: add more buttons to help command
-rw-r--r--package.json10
-rw-r--r--src/commands/info/help.ts44
-rw-r--r--src/config/example-options.ts4
-rw-r--r--src/lib/utils/Config.ts3
-rw-r--r--tsconfig.json1
5 files changed, 43 insertions, 19 deletions
diff --git a/package.json b/package.json
index c924bfc..6f39ed3 100644
--- a/package.json
+++ b/package.json
@@ -2,7 +2,7 @@
"name": "bush-bot",
"version": "3.0.0",
"description": "A custom bot for Moulberry's Bush",
- "main": "dist/bot.js",
+ "main": "dist/src/bot.js",
"repository": "https://github.com/NotEnoughUpdates/bush-bot-3.0",
"author": "IRONM00N#0001 (@IRONM00N)",
"contributors": [
@@ -15,14 +15,14 @@
],
"license": "CC-BY-NC-SA-4.0",
"_moduleAliases": {
- "@lib": "dist/lib"
+ "@lib": "dist/src/lib"
},
"scripts": {
"build-esbuild": "yarn rimraf dist && yarn esbuild --sourcemap=inline --outdir=dist --platform=node --target=es2020 --format=cjs --log-level=warning src/**/*.ts",
"build-tsc": "yarn rimraf dist && yarn tsc",
- "_start": "yarn build-esbuild && node --trace-warnings -r source-map-support/register dist/bot.js",
- "start": "yarn build-tsc && node --trace-warnings -r source-map-support/register dist/bot.js",
- "dev": "yarn build-tsc && node --trace-warnings -r source-map-support/register dist/bot.js",
+ "_start": "yarn build-esbuild && node --trace-warnings -r source-map-support/register dist/src/bot.js",
+ "start": "yarn build-tsc && node --trace-warnings -r source-map-support/register dist/src/bot.js",
+ "dev": "yarn build-tsc && node --trace-warnings -r source-map-support/register dist/src/bot.js",
"test": "yarn lint && yarn tsc --noEmit",
"format": "yarn prettier . --write",
"lint": "yarn eslint --ext js,jsx,ts,tsx src",
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 {
diff --git a/tsconfig.json b/tsconfig.json
index a4c0c58..b063dad 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -11,6 +11,7 @@
"esModuleInterop": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
+ "resolveJsonModule": true,
"baseUrl": "./",
"paths": {
"src/*": ["./src/*"],