diff options
72 files changed, 681 insertions, 271 deletions
@@ -48,9 +48,9 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["chalk", "npm:4.1.1"], ["common-tags", "npm:1.8.0"], ["discord-akairo", "https://github.com/NotEnoughUpdates/discord-akairo.git#commit=58e5a8610d9cb47257cb163a94e284113a39a62b"], - ["discord-api-types", "npm:0.18.1"], - ["discord.js", "npm:13.0.0-dev.edab5af.1624996138"], - ["esbuild", "npm:0.12.12"], + ["discord-api-types", "npm:0.19.0-next.f393ba520d7d6d2aacaca7b3ca5d355fab614f6e"], + ["discord.js", "npm:13.0.0-dev.fe6cc0c.1625184228"], + ["esbuild", "npm:0.12.14"], ["eslint", "npm:7.29.0"], ["eslint-config-prettier", "virtual:d7ae587dddcefd495158f5c047acecbca3203324d75e681c7d8657c07f901f74e152f0b39978f7428d3a91daad7b5020c47ece28de69c22fcbd49d04707bf15c#npm:8.3.0"], ["got", "npm:11.8.2"], @@ -98,6 +98,17 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { "linkType": "HARD", }] ]], + ["@discordjs/builders", [ + ["npm:0.1.1", { + "packageLocation": "./.yarn/cache/@discordjs-builders-npm-0.1.1-86a3db61e4-2902d53542.zip/node_modules/@discordjs/builders/", + "packageDependencies": [ + ["@discordjs/builders", "npm:0.1.1"], + ["discord-api-types", "npm:0.18.1"], + ["tslib", "npm:2.3.0"] + ], + "linkType": "HARD", + }] + ]], ["@discordjs/collection", [ ["npm:0.1.6", { "packageLocation": "./.yarn/cache/@discordjs-collection-npm-0.1.6-bad654db9e-da87faf997.zip/node_modules/@discordjs/collection/", @@ -216,7 +227,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { "packageDependencies": [ ["@types/body-parser", "npm:1.19.0"], ["@types/connect", "npm:3.4.34"], - ["@types/node", "npm:15.12.5"] + ["@types/node", "npm:15.14.0"] ], "linkType": "HARD", }] @@ -228,7 +239,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["@types/cacheable-request", "npm:6.0.1"], ["@types/http-cache-semantics", "npm:4.0.0"], ["@types/keyv", "npm:3.1.1"], - ["@types/node", "npm:15.12.5"], + ["@types/node", "npm:15.14.0"], ["@types/responselike", "npm:1.0.0"] ], "linkType": "HARD", @@ -248,7 +259,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { "packageLocation": "./.yarn/cache/@types-connect-npm-3.4.34-39e4f7bb55-6f712a0408.zip/node_modules/@types/connect/", "packageDependencies": [ ["@types/connect", "npm:3.4.34"], - ["@types/node", "npm:15.12.5"] + ["@types/node", "npm:15.14.0"] ], "linkType": "HARD", }] @@ -271,7 +282,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { "packageLocation": "./.yarn/cache/@types-express-serve-static-core-npm-4.17.22-e9a70ec107-e9ed12d6fd.zip/node_modules/@types/express-serve-static-core/", "packageDependencies": [ ["@types/express-serve-static-core", "npm:4.17.22"], - ["@types/node", "npm:15.12.5"], + ["@types/node", "npm:15.14.0"], ["@types/qs", "npm:6.9.6"], ["@types/range-parser", "npm:1.2.3"] ], @@ -301,7 +312,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { "packageLocation": "./.yarn/cache/@types-keyv-npm-3.1.1-779a80f2c7-3aaf557d5b.zip/node_modules/@types/keyv/", "packageDependencies": [ ["@types/keyv", "npm:3.1.1"], - ["@types/node", "npm:15.12.5"] + ["@types/node", "npm:15.14.0"] ], "linkType": "HARD", }] @@ -323,10 +334,10 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ], "linkType": "HARD", }], - ["npm:15.12.5", { - "packageLocation": "./.yarn/cache/@types-node-npm-15.12.5-bfb1f4b853-42485de7a0.zip/node_modules/@types/node/", + ["npm:15.14.0", { + "packageLocation": "./.yarn/cache/@types-node-npm-15.14.0-b271eff214-b36835ddec.zip/node_modules/@types/node/", "packageDependencies": [ - ["@types/node", "npm:15.12.5"] + ["@types/node", "npm:15.14.0"] ], "linkType": "HARD", }] @@ -354,7 +365,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { "packageLocation": "./.yarn/cache/@types-responselike-npm-1.0.0-85dd08af42-e6e6613c80.zip/node_modules/@types/responselike/", "packageDependencies": [ ["@types/responselike", "npm:1.0.0"], - ["@types/node", "npm:15.12.5"] + ["@types/node", "npm:15.14.0"] ], "linkType": "HARD", }] @@ -365,7 +376,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { "packageDependencies": [ ["@types/serve-static", "npm:1.13.9"], ["@types/mime", "npm:1.3.2"], - ["@types/node", "npm:15.12.5"] + ["@types/node", "npm:15.14.0"] ], "linkType": "HARD", }] @@ -384,7 +395,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { "packageLocation": "./.yarn/cache/@types-ws-npm-7.4.5-3f11000a5b-b467f596cc.zip/node_modules/@types/ws/", "packageDependencies": [ ["@types/ws", "npm:7.4.5"], - ["@types/node", "npm:15.12.5"] + ["@types/node", "npm:15.14.0"] ], "linkType": "HARD", }] @@ -786,9 +797,9 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["chalk", "npm:4.1.1"], ["common-tags", "npm:1.8.0"], ["discord-akairo", "https://github.com/NotEnoughUpdates/discord-akairo.git#commit=58e5a8610d9cb47257cb163a94e284113a39a62b"], - ["discord-api-types", "npm:0.18.1"], - ["discord.js", "npm:13.0.0-dev.edab5af.1624996138"], - ["esbuild", "npm:0.12.12"], + ["discord-api-types", "npm:0.19.0-next.f393ba520d7d6d2aacaca7b3ca5d355fab614f6e"], + ["discord.js", "npm:13.0.0-dev.fe6cc0c.1625184228"], + ["esbuild", "npm:0.12.14"], ["eslint", "npm:7.29.0"], ["eslint-config-prettier", "virtual:d7ae587dddcefd495158f5c047acecbca3203324d75e681c7d8657c07f901f74e152f0b39978f7428d3a91daad7b5020c47ece28de69c22fcbd49d04707bf15c#npm:8.3.0"], ["got", "npm:11.8.2"], @@ -1060,7 +1071,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ]], ["discord-akairo", [ ["https://github.com/NotEnoughUpdates/discord-akairo.git#commit=58e5a8610d9cb47257cb163a94e284113a39a62b", { - "packageLocation": "./.yarn/unplugged/discord-akairo-https-10183ac4c6/node_modules/discord-akairo/", + "packageLocation": "./.yarn/cache/discord-akairo-https-10183ac4c6-3a07eb6541.zip/node_modules/discord-akairo/", "packageDependencies": [ ["discord-akairo", "https://github.com/NotEnoughUpdates/discord-akairo.git#commit=58e5a8610d9cb47257cb163a94e284113a39a62b"] ], @@ -1084,10 +1095,11 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { }] ]], ["discord.js", [ - ["npm:13.0.0-dev.edab5af.1624996138", { - "packageLocation": "./.yarn/unplugged/discord.js-npm-13.0.0-dev.edab5af.1624996138-7dc41aa565/node_modules/discord.js/", + ["npm:13.0.0-dev.fe6cc0c.1625184228", { + "packageLocation": "./.yarn/cache/discord.js-npm-13.0.0-dev.fe6cc0c.1625184228-ea99e41fe8-0b2a39e708.zip/node_modules/discord.js/", "packageDependencies": [ - ["discord.js", "npm:13.0.0-dev.edab5af.1624996138"], + ["discord.js", "npm:13.0.0-dev.fe6cc0c.1625184228"], + ["@discordjs/builders", "npm:0.1.1"], ["@discordjs/collection", "npm:0.1.6"], ["@discordjs/form-data", "npm:3.0.1"], ["@sapphire/async-queue", "npm:1.1.4"], @@ -1158,10 +1170,10 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { }] ]], ["esbuild", [ - ["npm:0.12.12", { - "packageLocation": "./.yarn/unplugged/esbuild-npm-0.12.12-3705093b39/node_modules/esbuild/", + ["npm:0.12.14", { + "packageLocation": "./.yarn/unplugged/esbuild-npm-0.12.14-9086ce8ed7/node_modules/esbuild/", "packageDependencies": [ - ["esbuild", "npm:0.12.12"] + ["esbuild", "npm:0.12.14"] ], "linkType": "HARD", }] @@ -1461,17 +1473,17 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { "packageLocation": "./.yarn/cache/flat-cache-npm-3.0.4-ee77e5911e-72d86ccdf8.zip/node_modules/flat-cache/", "packageDependencies": [ ["flat-cache", "npm:3.0.4"], - ["flatted", "npm:3.1.1"], + ["flatted", "npm:3.2.0"], ["rimraf", "npm:3.0.2"] ], "linkType": "HARD", }] ]], ["flatted", [ - ["npm:3.1.1", { - "packageLocation": "./.yarn/cache/flatted-npm-3.1.1-ffd80d62a2-1065cd7829.zip/node_modules/flatted/", + ["npm:3.2.0", { + "packageLocation": "./.yarn/cache/flatted-npm-3.2.0-8861bfbc41-8352f321fc.zip/node_modules/flatted/", "packageDependencies": [ - ["flatted", "npm:3.1.1"] + ["flatted", "npm:3.2.0"] ], "linkType": "HARD", }] @@ -2788,6 +2800,13 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["tslib", "npm:1.14.1"] ], "linkType": "HARD", + }], + ["npm:2.3.0", { + "packageLocation": "./.yarn/cache/tslib-npm-2.3.0-277e75e108-7b4fc9feff.zip/node_modules/tslib/", + "packageDependencies": [ + ["tslib", "npm:2.3.0"] + ], + "linkType": "HARD", }] ]], ["tsutils", [ @@ -2945,7 +2964,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { "packageLocation": "./.yarn/cache/wkx-npm-0.5.0-fca5152cd8-ea38c886b8.zip/node_modules/wkx/", "packageDependencies": [ ["wkx", "npm:0.5.0"], - ["@types/node", "npm:15.12.5"] + ["@types/node", "npm:15.14.0"] ], "linkType": "HARD", }] diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 94a8b5c..d3de569 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -1,10 +1,10 @@ { - "recommendations": [ - "aaron-bond.better-comments", - "arcanis.vscode-zipfs", - "dbaeumer.vscode-eslint", - "eamodio.gitlens", - "esbenp.prettier-vscode", - "streetsidesoftware.code-spell-checker" - ] + "recommendations": [ + "aaron-bond.better-comments", + "arcanis.vscode-zipfs", + "dbaeumer.vscode-eslint", + "eamodio.gitlens", + "esbenp.prettier-vscode", + "streetsidesoftware.code-spell-checker" + ] } diff --git a/.vscode/settings.json b/.vscode/settings.json index 31f0057..02155ed 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,94 +1,94 @@ { - "files.exclude": { - "**/.git": true, - "**/.svn": true, - "**/.hg": true, - "**/CVS": true, - "**/.DS_Store": true, - "node_modules": true, - // "dist": true, - ".pnp.js": true - }, - "javascript.preferences.importModuleSpecifier": "project-relative", - "typescript.preferences.importModuleSpecifier": "project-relative", - "typescript.preferences.importModuleSpecifierEnding": "minimal", - "search.exclude": { - "**/.yarn": true, - "**/.pnp.*": true - }, - "editor.codeActionsOnSave": { - "source.organizeImports": true, - "source.fixAll.eslint": true, - "source.format": true - }, - "editor.formatOnSave": true, - "diffEditor.wordWrap": "on", - "editor.insertSpaces": false, - "editor.wordWrap": "on", - "editor.tabSize": 2, - "prettier.configPath": "package.json", - "prettier.prettierPath": ".yarn/sdks/prettier/index.js", - "prettier.withNodeModules": true, - "prettier.useEditorConfig": false, - "eslint.nodePath": ".yarn/sdks", - "typescript.tsdk": ".yarn/sdks/typescript/lib", - "typescript.enablePromptUseWorkspaceTsdk": true, - "better-comments.highlightPlainText": false, - "better-comments.multilineComments": true, - "better-comments.tags": [ - { - "tag": "!", - "color": "#FF2D00", - "strikethrough": false, - "underline": false, - "backgroundColor": "transparent", - "bold": false, - "italic": false - }, - { - "tag": "?", - "color": "#3498DB", - "strikethrough": false, - "underline": false, - "backgroundColor": "transparent", - "bold": false, - "italic": false - }, - { - "tag": "#", - "color": "#f003fc", - "strikethrough": false, - "underline": false, - "backgroundColor": "transparent", - "bold": false, - "italic": false - }, - { - "tag": "//", - "color": "#474747", - "strikethrough": true, - "underline": false, - "backgroundColor": "transparent", - "bold": false, - "italic": false - }, - { - "tag": "todo", - "color": "#FF8C00", - "strikethrough": false, - "underline": false, - "backgroundColor": "transparent", - "bold": false, - "italic": false - }, - { - "tag": "*", - "color": "#98C379", - "strikethrough": false, - "underline": false, - "backgroundColor": "transparent", - "bold": false, - "italic": false - } - ] + "files.exclude": { + "**/.git": true, + "**/.svn": true, + "**/.hg": true, + "**/CVS": true, + "**/.DS_Store": true, + "node_modules": true, + // "dist": true, + ".pnp.js": true + }, + "javascript.preferences.importModuleSpecifier": "project-relative", + "typescript.preferences.importModuleSpecifier": "project-relative", + "typescript.preferences.importModuleSpecifierEnding": "minimal", + "search.exclude": { + "**/.yarn": true, + "**/.pnp.*": true + }, + "editor.codeActionsOnSave": { + "source.organizeImports": true, + "source.fixAll.eslint": true, + "source.format": true + }, + "editor.formatOnSave": true, + "diffEditor.wordWrap": "on", + "editor.insertSpaces": false, + "editor.wordWrap": "on", + "editor.tabSize": 2, + "prettier.configPath": "package.json", + "prettier.prettierPath": ".yarn/sdks/prettier/index.js", + "prettier.withNodeModules": true, + "prettier.useEditorConfig": false, + "eslint.nodePath": ".yarn/sdks", + "typescript.tsdk": ".yarn/sdks/typescript/lib", + "typescript.enablePromptUseWorkspaceTsdk": true, + "better-comments.highlightPlainText": false, + "better-comments.multilineComments": true, + "better-comments.tags": [ + { + "tag": "!", + "color": "#FF2D00", + "strikethrough": false, + "underline": false, + "backgroundColor": "transparent", + "bold": false, + "italic": false + }, + { + "tag": "?", + "color": "#3498DB", + "strikethrough": false, + "underline": false, + "backgroundColor": "transparent", + "bold": false, + "italic": false + }, + { + "tag": "#", + "color": "#f003fc", + "strikethrough": false, + "underline": false, + "backgroundColor": "transparent", + "bold": false, + "italic": false + }, + { + "tag": "//", + "color": "#474747", + "strikethrough": true, + "underline": false, + "backgroundColor": "transparent", + "bold": false, + "italic": false + }, + { + "tag": "todo", + "color": "#FF8C00", + "strikethrough": false, + "underline": false, + "backgroundColor": "transparent", + "bold": false, + "italic": false + }, + { + "tag": "*", + "color": "#98C379", + "strikethrough": false, + "underline": false, + "backgroundColor": "transparent", + "bold": false, + "italic": false + } + ] } diff --git a/package.json b/package.json index 07f0810..f0f63f0 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "author": "Tyman, IRONM00N, and TrashCan", "license": "CC-BY-NC-SA-4.0", "scripts": { - "build-esbuild": "yarn rimraf dist && yarn esbuild --sourcemap=inline --minify-whitespace --minify-syntax --outdir=dist --platform=node --target=es2020 --format=cjs src/**/*.ts", + "build-esbuild": "yarn rimraf dist && yarn esbuild --sourcemap=inline --minify-whitespace --minify-syntax --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", "dev": "yarn build-tsc && node --trace-warnings -r source-map-support/register dist/bot.js", @@ -38,7 +38,7 @@ "chalk": "^4.1.1", "common-tags": "^1.8.0", "discord-akairo": "NotEnoughUpdates/discord-akairo", - "discord-api-types": "^0.18.1", + "discord-api-types": "0.19.0-next.f393ba520d7d6d2aacaca7b3ca5d355fab614f6e", "discord.js": "dev", "got": "^11.8.2", "moment": "^2.29.1", @@ -94,22 +94,5 @@ "quoteProps": "consistent", "singleQuote": true, "trailingComma": "none" - }, - "dependenciesMeta": { - "discord-akairo@8.2.2": { - "unplugged": true - }, - "discord.js@13.0.0-dev.5ad83a6a65e5944ceb3a41fee2df40ba1f5b03e4": { - "unplugged": true - }, - "discord.js@13.0.0-dev.e37ef3af2151e556527ccd8e98ec531bdcc0ed70": { - "unplugged": true - }, - "discord.js@13.0.0-dev.edab5af.1624996138": { - "unplugged": true - }, - "prettier@2.3.1": { - "unplugged": true - } } } @@ -1,5 +1,6 @@ import * as config from './config/options'; import { BushClient } from './lib/extensions/discord-akairo/BushClient'; +BushClient.preStart(); const client: BushClient = new BushClient(config); client.start(); diff --git a/src/commands/config/muteRole.ts b/src/commands/config/muteRole.ts index 2b2f938..3c662ea 100644 --- a/src/commands/config/muteRole.ts +++ b/src/commands/config/muteRole.ts @@ -5,7 +5,7 @@ import { BushMessage } from '../../lib/extensions/discord.js/BushMessage'; import AllowedMentions from '../../lib/utils/AllowedMentions'; export default class MuteRoleCommand extends BushCommand { - constructor() { + public constructor() { super('muteRole', { aliases: ['muterole'], category: 'config', diff --git a/src/commands/config/prefix.ts b/src/commands/config/prefix.ts index 1551205..eaf4fcc 100644 --- a/src/commands/config/prefix.ts +++ b/src/commands/config/prefix.ts @@ -3,7 +3,7 @@ import { BushSlashMessage } from '../../lib/extensions/discord-akairo/BushSlashM import { BushMessage } from '../../lib/extensions/discord.js/BushMessage'; export default class PrefixCommand extends BushCommand { - constructor() { + public constructor() { super('prefix', { aliases: ['prefix'], category: 'config', diff --git a/src/commands/dev/eval.ts b/src/commands/dev/eval.ts index fc6e7e8..f1509aa 100644 --- a/src/commands/dev/eval.ts +++ b/src/commands/dev/eval.ts @@ -135,8 +135,8 @@ export default class EvalCommand extends BushCommand { show_proto: boolean; } ): Promise<unknown> { - if (!message.author.isOwner()) - return await message.util.reply(`${this.client.util.emojis.error} Only my developers can run this command.`); + // if (!message.author.isOwner()) + // return await message.util.reply(`${this.client.util.emojis.error} Only my developers can run this command.`); if (message.util.isSlash) { await (message as BushSlashMessage).interaction.defer({ ephemeral: args.silent }); } @@ -181,18 +181,51 @@ export default class EvalCommand extends BushCommand { config = this.client.config, members = message.guild.members, roles = message.guild.roles, - { Ban } = await import('../../lib/models/Ban'), - { Global } = await import('../../lib/models/Global'), - { Guild } = await import('../../lib/models/Guild'), - { Level } = await import('../../lib/models/Level'), - { ModLog } = await import('../../lib/models/ModLog'), - { StickyRole } = await import('../../lib/models/StickyRole'); + client = this.client, + { Ban, Global, Guild, Level, ModLog, StickyRole } = await import('../../lib/models/index.js'), + { + ButtonInteraction, + Collector, + CommandInteraction, + Interaction, + Message, + MessageActionRow, + MessageAttachment, + MessageButton, + MessageCollector, + MessageComponentInteractionCollector, + MessageEmbed, + MessageSelectMenu, + ReactionCollector, + Util + // eslint-disable-next-line @typescript-eslint/no-var-requires + } = require('discord.js'); // I would use import here but esbuild doesn't like that if (code[code.lang].replace(/ /g, '').includes('9+10' || '10+9')) { output = 21; } else { output = eval(code.js); + //// const menuRow = new MessageActionRow().addComponents( + //// new MessageSelectMenu({ + //// customID: 'test', + //// options: [ + //// { label: '1', value: '1', default: false }, + //// { label: '2', value: '2', default: false }, + //// { label: '3', value: '3', default: false }, + //// { label: '4', value: '4', default: false }, + //// { label: '5', value: '5', default: false }, + //// { label: '6', value: '6', default: false }, + //// { label: '7', value: '7', default: false }, + //// { label: '8', value: '8', default: false }, + //// { label: '9', value: '9', default: false } + //// ] + //// }) + //// ); + //// message.channel.send({ + //// content: 'test', + //// components: [menuRow] + //// }); output = await output; - this.client.console.debug(output); + //// this.client.console.debug(inspect(message, { depth: 0, colors: true })); } let proto, outputProto; if (args.show_proto) { diff --git a/src/commands/dev/reload.ts b/src/commands/dev/reload.ts index 82dde4c..d932816 100644 --- a/src/commands/dev/reload.ts +++ b/src/commands/dev/reload.ts @@ -3,7 +3,7 @@ import { BushSlashMessage } from '../../lib/extensions/discord-akairo/BushSlashM import { BushMessage } from '../../lib/extensions/discord.js/BushMessage'; export default class ReloadCommand extends BushCommand { - constructor() { + public constructor() { super('reload', { aliases: ['reload'], category: 'dev', diff --git a/src/commands/dev/setLevel.ts b/src/commands/dev/setLevel.ts index 9903013..2a807f8 100644 --- a/src/commands/dev/setLevel.ts +++ b/src/commands/dev/setLevel.ts @@ -6,7 +6,7 @@ import { Level } from '../../lib/models'; import AllowedMentions from '../../lib/utils/AllowedMentions'; export default class SetLevelCommand extends BushCommand { - constructor() { + public constructor() { super('setlevel', { aliases: ['setlevel'], category: 'dev', diff --git a/src/commands/info/botInfo.ts b/src/commands/info/botInfo.ts index b77a271..6cdae17 100644 --- a/src/commands/info/botInfo.ts +++ b/src/commands/info/botInfo.ts @@ -3,7 +3,7 @@ import { duration } from 'moment'; import { BushCommand } from '../../lib/extensions/discord-akairo/BushCommand'; export default class BotInfoCommand extends BushCommand { - constructor() { + public constructor() { super('botinfo', { aliases: ['botinfo'], category: 'info', diff --git a/src/commands/info/help.ts b/src/commands/info/help.ts index 6e14d96..598f01a 100644 --- a/src/commands/info/help.ts +++ b/src/commands/info/help.ts @@ -4,7 +4,7 @@ import { BushSlashMessage } from '../../lib/extensions/discord-akairo/BushSlashM import { BushMessage } from '../../lib/extensions/discord.js/BushMessage'; export default class HelpCommand extends BushCommand { - constructor() { + public constructor() { super('help', { aliases: ['help'], category: 'info', diff --git a/src/commands/info/ping.ts b/src/commands/info/ping.ts index 45cfd22..75f4700 100644 --- a/src/commands/info/ping.ts +++ b/src/commands/info/ping.ts @@ -3,7 +3,7 @@ import { BushCommand } from '../../lib/extensions/discord-akairo/BushCommand'; import { BushSlashMessage } from '../../lib/extensions/discord-akairo/BushSlashMessage'; export default class PingCommand extends BushCommand { - constructor() { + public constructor() { super('ping', { aliases: ['ping'], category: 'info', diff --git a/src/commands/info/pronouns.ts b/src/commands/info/pronouns.ts index 538ec64..1f7ac15 100644 --- a/src/commands/info/pronouns.ts +++ b/src/commands/info/pronouns.ts @@ -29,7 +29,7 @@ export const pronounMapping = { export type pronounsType = keyof typeof pronounMapping; export default class PronounsCommand extends BushCommand { - constructor() { + public constructor() { super('pronouns', { aliases: ['pronouns', 'pronoun'], category: 'info', diff --git a/src/commands/moderation/ban.ts b/src/commands/moderation/ban.ts index 9df1c2a..29dc8a6 100644 --- a/src/commands/moderation/ban.ts +++ b/src/commands/moderation/ban.ts @@ -14,7 +14,7 @@ import { Ban, Guild, ModLog, ModLogType } from '../../lib/models'; const durationRegex = /(?:(\d+)(d(?:ays?)?|h(?:ours?|rs?)?|m(?:inutes?|ins?)?|mo(?:nths?)?|w(?:eeks?|ks?)?)(?: |$))/g; */ export default class BanCommand extends BushCommand { - constructor() { + public constructor() { super('ban', { aliases: ['ban'], category: 'moderation', diff --git a/src/commands/moderation/kick.ts b/src/commands/moderation/kick.ts index a666c8e..09d6abf 100644 --- a/src/commands/moderation/kick.ts +++ b/src/commands/moderation/kick.ts @@ -4,7 +4,7 @@ import { BushSlashMessage } from '../../lib/extensions/discord-akairo/BushSlashM import { Guild, ModLog, ModLogType } from '../../lib/models'; export default class KickCommand extends BushCommand { - constructor() { + public constructor() { super('kick', { aliases: ['kick'], category: 'moderation', diff --git a/src/commands/moderation/modlog.ts b/src/commands/moderation/modlog.ts index 27018f1..d094885 100644 --- a/src/commands/moderation/modlog.ts +++ b/src/commands/moderation/modlog.ts @@ -6,7 +6,7 @@ import { BushCommand } from '../../lib/extensions/discord-akairo/BushCommand'; import { ModLog } from '../../lib/models'; export default class ModlogCommand extends BushCommand { - constructor() { + public constructor() { super('modlog', { aliases: ['modlog', 'modlogs'], category: 'moderation', diff --git a/src/commands/moderation/mute.ts b/src/commands/moderation/mute.ts index 88fcc69..3496489 100644 --- a/src/commands/moderation/mute.ts +++ b/src/commands/moderation/mute.ts @@ -5,7 +5,7 @@ import { BushCommand } from '../../lib/extensions/discord-akairo/BushCommand'; import { Guild, ModLog, ModLogType, Mute } from '../../lib/models'; export default class MuteCommand extends BushCommand { - constructor() { + public constructor() { super('mute', { aliases: ['mute'], category: 'moderation', diff --git a/src/commands/moderation/role.ts b/src/commands/moderation/role.ts index d1f8e00..71bb88e 100644 --- a/src/commands/moderation/role.ts +++ b/src/commands/moderation/role.ts @@ -24,7 +24,7 @@ export default class RoleCommand extends BushCommand { 'Giveaway (5m)': ['*', 'Admin Perms', 'Sr. Moderator', 'Moderator'], 'Giveaway (1m)': ['*', 'Admin Perms', 'Sr. Moderator', 'Moderator'] }; - constructor() { + public constructor() { super('role', { aliases: ['role', 'addrole', 'removerole'], category: 'moderation', diff --git a/src/commands/moulberry-bush/giveawayPing.ts b/src/commands/moulberry-bush/giveawayPing.ts index 40f782d..dbbbfef 100644 --- a/src/commands/moulberry-bush/giveawayPing.ts +++ b/src/commands/moulberry-bush/giveawayPing.ts @@ -3,7 +3,7 @@ import { BushMessage } from '../../lib/extensions/discord.js/BushMessage'; import AllowedMentions from '../../lib/utils/AllowedMentions'; export default class GiveawayPingCommand extends BushCommand { - constructor() { + public constructor() { super('giveawayping', { aliases: ['giveawayping', 'giveawaypong'], category: "Moulberry's Bush", diff --git a/src/commands/moulberry-bush/level.ts b/src/commands/moulberry-bush/level.ts index c81c555..eabf7a0 100644 --- a/src/commands/moulberry-bush/level.ts +++ b/src/commands/moulberry-bush/level.ts @@ -11,7 +11,7 @@ import { CanvasProgressBar } from '../../lib/extensions/Util'; */ export default class LevelCommand extends BushCommand { - constructor() { + public constructor() { super('level', { aliases: ['level', 'rank'], category: "Moulberry's Bush", diff --git a/src/inhibitors/blacklist/guildBlacklist.ts b/src/inhibitors/blacklist/guildBlacklist.ts index 103e89b..04f496a 100644 --- a/src/inhibitors/blacklist/guildBlacklist.ts +++ b/src/inhibitors/blacklist/guildBlacklist.ts @@ -3,7 +3,7 @@ import { BushSlashMessage } from '../../lib/extensions/discord-akairo/BushSlashM import { BushMessage } from '../../lib/extensions/discord.js/BushMessage'; export default class GuildBlacklistInhibitor extends BushInhibitor { - constructor() { + public constructor() { super('guildBlacklist', { reason: 'guildBlacklist', category: 'blacklist', @@ -14,6 +14,9 @@ export default class GuildBlacklistInhibitor extends BushInhibitor { public exec(message: BushMessage | BushSlashMessage): boolean { if (!message.guild) return false; if (message.author && (this.client.isOwner(message.author) || this.client.isSuperUser(message.author))) return false; - return this.client.cache.global.blacklistedGuilds.includes(message.guild.id); + if (this.client.cache.global.blacklistedGuilds.includes(message.guild.id)) { + this.client.console.debug(`GuildBlacklistInhibitor blocked message.`); + return true; + } } } diff --git a/src/inhibitors/blacklist/userBlacklist.ts b/src/inhibitors/blacklist/userBlacklist.ts index 6772188..4349bb1 100644 --- a/src/inhibitors/blacklist/userBlacklist.ts +++ b/src/inhibitors/blacklist/userBlacklist.ts @@ -3,7 +3,7 @@ import { BushSlashMessage } from '../../lib/extensions/discord-akairo/BushSlashM import { BushMessage } from '../../lib/extensions/discord.js/BushMessage'; export default class UserBlacklistInhibitor extends BushInhibitor { - constructor() { + public constructor() { super('userBlacklist', { reason: 'userBlacklist', category: 'blacklist', @@ -14,6 +14,9 @@ export default class UserBlacklistInhibitor extends BushInhibitor { public exec(message: BushMessage | BushSlashMessage): boolean { if (!message.author) return false; if (this.client.isOwner(message.author) || this.client.isSuperUser(message.author)) return false; - return this.client.cache.global.blacklistedUsers.includes(message.author.id); + if (this.client.cache.global.blacklistedUsers.includes(message.author.id)) { + this.client.console.debug(`UserBlacklistInhibitor blocked message.`); + return true; + } } } diff --git a/src/inhibitors/commands/disabledCommand.ts b/src/inhibitors/commands/disabledCommand.ts index 5b47ce3..6936a41 100644 --- a/src/inhibitors/commands/disabledCommand.ts +++ b/src/inhibitors/commands/disabledCommand.ts @@ -4,7 +4,7 @@ import { BushSlashMessage } from '../../lib/extensions/discord-akairo/BushSlashM import { BushMessage } from '../../lib/extensions/discord.js/BushMessage'; export default class DisabledCommandInhibitor extends BushInhibitor { - constructor() { + public constructor() { super('disabledCommand', { reason: 'disabled', type: 'pre', @@ -14,6 +14,9 @@ export default class DisabledCommandInhibitor extends BushInhibitor { public async exec(message: BushMessage | BushSlashMessage, command: BushCommand): Promise<boolean> { if (this.client.isOwner(message.author)) return false; - return this.client.cache.global.disabledCommands.includes(command?.id); + if (this.client.cache.global.disabledCommands.includes(command?.id)) { + this.client.console.debug(`DisabledCommandInhibitor blocked message.`); + return true; + } } } diff --git a/src/inhibitors/noCache.ts b/src/inhibitors/noCache.ts index fe2e522..db46801 100644 --- a/src/inhibitors/noCache.ts +++ b/src/inhibitors/noCache.ts @@ -2,8 +2,8 @@ import { BushInhibitor } from '../lib/extensions/discord-akairo/BushInhibitor'; import { BushSlashMessage } from '../lib/extensions/discord-akairo/BushSlashMessage'; import { BushMessage } from '../lib/extensions/discord.js/BushMessage'; -export default class noCacheInhibitor extends BushInhibitor { - constructor() { +export default class NoCacheInhibitor extends BushInhibitor { + public constructor() { super('noCache', { reason: 'noCache', type: 'all', @@ -14,7 +14,10 @@ export default class noCacheInhibitor extends BushInhibitor { public async exec(message: BushMessage | BushSlashMessage): Promise<boolean> { if (this.client.isOwner(message.author)) return false; for (const property in this.client.cache) { - if (property === undefined || property === null) return true; + if (property === undefined || property === null) { + this.client.console.debug(`NoCacheInhibitor blocked message.`); + return true; + } } return false; } diff --git a/src/lib/extensions/discord-akairo/BushClient.ts b/src/lib/extensions/discord-akairo/BushClient.ts index c18fe80..724f01a 100644 --- a/src/lib/extensions/discord-akairo/BushClient.ts +++ b/src/lib/extensions/discord-akairo/BushClient.ts @@ -24,10 +24,26 @@ import AllowedMentions from '../../utils/AllowedMentions'; import { BushCache } from '../../utils/BushCache'; import { BushConstants } from '../../utils/BushConstants'; import { BushLogger } from '../../utils/BushLogger'; +import { BushButtonInteraction } from '../discord.js/BushButtonInteraction'; +import { BushCategoryChannel } from '../discord.js/BushCategoryChannel'; +import { BushCommandInteraction } from '../discord.js/BushCommandInteraction'; +import { BushDMChannel } from '../discord.js/BushDMChannel'; import { BushGuild } from '../discord.js/BushGuild'; +import { BushGuildEmoji } from '../discord.js/BushGuildEmoji'; import { BushGuildMember } from '../discord.js/BushGuildMember'; import { BushMessage } from '../discord.js/BushMessage'; +import { BushMessageReaction } from '../discord.js/BushMessageReaction'; +import { BushNewsChannel } from '../discord.js/BushNewsChannel'; +import { BushPresence } from '../discord.js/BushPresence'; +import { BushRole } from '../discord.js/BushRole'; +import { BushSelectMenuInteraction } from '../discord.js/BushSelectMenuInteraction'; +import { BushStoreChannel } from '../discord.js/BushStoreChannel'; +import { BushTextChannel } from '../discord.js/BushTextChannel'; +import { BushThreadChannel } from '../discord.js/BushThreadChannel'; +import { BushThreadMember } from '../discord.js/BushThreadMember'; import { BushUser } from '../discord.js/BushUser'; +import { BushVoiceChannel } from '../discord.js/BushVoiceChannel'; +import { BushVoiceState } from '../discord.js/BushVoiceState'; import { BushClientUtil } from './BushClientUtil'; import { BushCommandHandler } from './BushCommandHandler'; import { BushInhibitorHandler } from './BushInhinitorHandler'; @@ -46,6 +62,29 @@ const rl = readline.createInterface({ }); export class BushClient extends AkairoClient { + public static preStart(): void { + Structures.extend('GuildEmoji', () => BushGuildEmoji); + Structures.extend('DMChannel', () => BushDMChannel); + Structures.extend('TextChannel', () => BushTextChannel); + Structures.extend('VoiceChannel', () => BushVoiceChannel); + Structures.extend('CategoryChannel', () => BushCategoryChannel); + Structures.extend('NewsChannel', () => BushNewsChannel); + Structures.extend('StoreChannel', () => BushStoreChannel); + Structures.extend('ThreadChannel', () => BushThreadChannel); + Structures.extend('GuildMember', () => BushGuildMember); + Structures.extend('ThreadMember', () => BushThreadMember); + Structures.extend('Guild', () => BushGuild); + Structures.extend('Message', () => BushMessage); + Structures.extend('MessageReaction', () => BushMessageReaction); + Structures.extend('Presence', () => BushPresence); + Structures.extend('VoiceState', () => BushVoiceState); + Structures.extend('Role', () => BushRole); + Structures.extend('User', () => BushUser); + Structures.extend('CommandInteraction', () => BushCommandInteraction); + Structures.extend('ButtonInteraction', () => BushButtonInteraction); + Structures.extend('SelectMenuInteraction', () => BushSelectMenuInteraction); + } + public config: BotConfig; public listenerHandler: BushListenerHandler; public inhibitorHandler: BushInhibitorHandler; @@ -57,7 +96,7 @@ export class BushClient extends AkairoClient { public logger: BushLogger; public constants = BushConstants; public cache = BushCache; - constructor(config: BotConfig) { + public constructor(config: BotConfig) { super( { ownerID: config.owners, @@ -77,24 +116,24 @@ export class BushClient extends AkairoClient { // Create listener handler this.listenerHandler = new BushListenerHandler(this, { - directory: path.join(__dirname, '..', '..', 'listeners'), + directory: path.join(__dirname, '..', '..', '..', 'listeners'), automateCategories: true }); // Create inhibitor handler this.inhibitorHandler = new BushInhibitorHandler(this, { - directory: path.join(__dirname, '..', '..', 'inhibitors'), + directory: path.join(__dirname, '..', '..', '..', 'inhibitors'), automateCategories: true }); // Create task handler this.taskHandler = new BushTaskHandler(this, { - directory: path.join(__dirname, '..', '..', 'tasks') + directory: path.join(__dirname, '..', '..', '..', 'tasks') }); // Create command handler this.commandHandler = new BushCommandHandler(this, { - directory: path.join(__dirname, '..', '..', 'commands'), + directory: path.join(__dirname, '..', '..', '..', 'commands'), prefix: async ({ guild }: { guild: Guild }) => { if (this.config.dev) return 'dev '; const row = await Models.Guild.findByPk(guild.id); @@ -144,11 +183,6 @@ export class BushClient extends AkairoClient { // Initialize everything private async _init(): Promise<void> { - Structures.extend('User', () => BushUser); - Structures.extend('Guild', () => BushGuild); - Structures.extend('GuildMember', () => BushGuildMember); - Structures.extend('Message', () => BushMessage); - this.commandHandler.useListenerHandler(this.listenerHandler); this.commandHandler.useInhibitorHandler(this.inhibitorHandler); this.commandHandler.ignorePermissions = this.config.owners; @@ -206,6 +240,9 @@ export class BushClient extends AkairoClient { /** Starts the bot */ public async start(): Promise<void> { + //@ts-ignore: stfu bitch + global.client = this; + try { await this._init(); await this.login(this.token); diff --git a/src/lib/extensions/discord-akairo/BushClientUtil.ts b/src/lib/extensions/discord-akairo/BushClientUtil.ts index 94ad10c..1f8c0f9 100644 --- a/src/lib/extensions/discord-akairo/BushClientUtil.ts +++ b/src/lib/extensions/discord-akairo/BushClientUtil.ts @@ -105,7 +105,7 @@ export class BushClientUtil extends ClientUtil { * Creates this client util * @param client The client to initialize with */ - constructor(client: BushClient) { + public constructor(client: BushClient) { super(client); } diff --git a/src/lib/extensions/discord-akairo/BushCommand.ts b/src/lib/extensions/discord-akairo/BushCommand.ts index b7071b5..101c9d3 100644 --- a/src/lib/extensions/discord-akairo/BushCommand.ts +++ b/src/lib/extensions/discord-akairo/BushCommand.ts @@ -42,7 +42,7 @@ export class BushCommand extends Command { /** Whether the command is hidden from the help command. */ public hidden: boolean; - constructor(id: string, options?: BushCommandOptions) { + public constructor(id: string, options?: BushCommandOptions) { super(id, options); this.options = options; this.hidden = options.hidden || false; diff --git a/src/lib/extensions/discord-akairo/BushCommandUtil.ts b/src/lib/extensions/discord-akairo/BushCommandUtil.ts index b4084bd..a1c8036 100644 --- a/src/lib/extensions/discord-akairo/BushCommandUtil.ts +++ b/src/lib/extensions/discord-akairo/BushCommandUtil.ts @@ -1,10 +1,22 @@ import { CommandUtil, ParsedComponentData } from 'discord-akairo'; +import { Collection, Snowflake } from 'discord.js'; +import { BushMessage } from '../discord.js/BushMessage'; import { BushCommand } from './BushCommand'; +import { BushCommandHandler } from './BushCommandHandler'; export interface BushParsedComponentData extends ParsedComponentData { command?: BushCommand; } export class BushCommandUtil extends CommandUtil { - declare parsed?: BushParsedComponentData; + public declare parsed?: BushParsedComponentData; + public declare handler: BushCommandHandler; + public declare message: BushMessage; + public declare messages?: Collection<Snowflake, BushMessage>; + public test: string; + + public constructor(handler: BushCommandHandler, message: BushMessage) { + super(handler, message); + this.test = 'abc'; + } } diff --git a/src/lib/extensions/discord.js/BushActivity.ts b/src/lib/extensions/discord.js/BushActivity.ts new file mode 100644 index 0000000..6ca1611 --- /dev/null +++ b/src/lib/extensions/discord.js/BushActivity.ts @@ -0,0 +1,10 @@ +import { Activity } from 'discord.js'; +import { BushEmoji } from './BushEmoji'; +import { BushPresence } from './BushPresence'; + +export class BushActivity extends Activity { + public emoji: BushEmoji | null; + public constructor(presence: BushPresence, data?: unknown) { + super(presence, data); + } +} diff --git a/src/lib/extensions/discord.js/BushApplicationCommand.ts b/src/lib/extensions/discord.js/BushApplicationCommand.ts new file mode 100644 index 0000000..5a0e139 --- /dev/null +++ b/src/lib/extensions/discord.js/BushApplicationCommand.ts @@ -0,0 +1,14 @@ +/* eslint-disable @typescript-eslint/ban-types */ +/* eslint-disable @typescript-eslint/no-unused-vars */ +import { ApplicationCommand, Snowflake } from 'discord.js'; +import { BushClient } from '../discord-akairo/BushClient'; +import { BushGuild } from './BushGuild'; + +export class BushApplicationCommand<PermissionsFetchType = {}> extends ApplicationCommand { + public declare readonly client: BushClient; + public guild: BushGuild | null; + + public constructor(client: BushClient, data: unknown, guild?: BushGuild, guildID?: Snowflake) { + super(client, data, guild, guildID); + } +} diff --git a/src/lib/extensions/discord.js/BushApplicationCommandManager.ts b/src/lib/extensions/discord.js/BushApplicationCommandManager.ts new file mode 100644 index 0000000..fb3375a --- /dev/null +++ b/src/lib/extensions/discord.js/BushApplicationCommandManager.ts @@ -0,0 +1,24 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +import { ApplicationCommandManager, ApplicationCommandPermissionsManager, GuildResolvable, Snowflake } from 'discord.js'; +import { BushClient } from '../discord-akairo/BushClient'; +import { BushApplicationCommand } from './BushApplicationCommand'; +import { BushGuildResolvable } from './BushCommandInteraction'; + +export type BushApplicationCommandResolvable = BushApplicationCommand | Snowflake; + +export class BushApplicationCommandManager< + ApplicationCommandType = BushApplicationCommand<{ guild: BushGuildResolvable }>, + PermissionsOptionsExtras = { guild: GuildResolvable }, + PermissionsGuildType = null +> extends ApplicationCommandManager<ApplicationCommandType, PermissionsOptionsExtras, PermissionsGuildType> { + public permissions: ApplicationCommandPermissionsManager< + { command?: BushApplicationCommandResolvable } & PermissionsOptionsExtras, + { command: BushApplicationCommandResolvable } & PermissionsOptionsExtras, + PermissionsGuildType, + null + >; + + public constructor(client: BushClient, iterable?: Iterable<any>) { + super(client, iterable); + } +} diff --git a/src/lib/extensions/discord.js/BushApplicationCommandPermissionsManager.ts b/src/lib/extensions/discord.js/BushApplicationCommandPermissionsManager.ts new file mode 100644 index 0000000..517935d --- /dev/null +++ b/src/lib/extensions/discord.js/BushApplicationCommandPermissionsManager.ts @@ -0,0 +1,24 @@ +import { + ApplicationCommand, + ApplicationCommandManager, + ApplicationCommandPermissionsManager, + GuildApplicationCommandManager +} from 'discord.js'; +import { BushClient } from '../discord-akairo/BushClient'; +import { BushApplicationCommand } from './BushApplicationCommand'; +import { BushApplicationCommandManager } from './BushApplicationCommandManager'; +import { BushGuildApplicationCommandManager } from './BushGuildApplicationCommandManager'; + +export class BushApplicationCommandPermissionsManager< + BaseOptions, + FetchSingleOptions, + GuildType, + CommandIDType +> extends ApplicationCommandPermissionsManager<BaseOptions, FetchSingleOptions, GuildType, CommandIDType> { + public client: BushClient; + public manager: BushApplicationCommandManager | BushGuildApplicationCommandManager | BushApplicationCommand; + + public constructor(manager: ApplicationCommandManager | GuildApplicationCommandManager | ApplicationCommand) { + super(manager); + } +} diff --git a/src/lib/extensions/discord.js/BushButtonInteraction.ts b/src/lib/extensions/discord.js/BushButtonInteraction.ts new file mode 100644 index 0000000..3a54f61 --- /dev/null +++ b/src/lib/extensions/discord.js/BushButtonInteraction.ts @@ -0,0 +1,19 @@ +import { APIInteractionGuildMember } from 'discord-api-types/v8'; +import { ButtonInteraction, PartialDMChannel } from 'discord.js'; +import { BushClient } from '../discord-akairo/BushClient'; +import { BushDMChannel } from './BushDMChannel'; +import { BushGuild } from './BushGuild'; +import { BushGuildMember } from './BushGuildMember'; +import { BushNewsChannel } from './BushNewsChannel'; +import { BushTextChannel } from './BushTextChannel'; +import { BushUser } from './BushUser'; + +export class BushButtonInteraction extends ButtonInteraction { + public declare readonly channel: BushTextChannel | BushDMChannel | BushNewsChannel | PartialDMChannel | null; + public declare readonly guild: BushGuild | null; + public declare member: BushGuildMember | APIInteractionGuildMember | null; + public declare user: BushUser; + public constructor(client: BushClient, data: unknown) { + super(client, data); + } +} diff --git a/src/lib/extensions/discord.js/BushCategoryChannel.ts b/src/lib/extensions/discord.js/BushCategoryChannel.ts index c4bc3ca..a66b2c6 100644 --- a/src/lib/extensions/discord.js/BushCategoryChannel.ts +++ b/src/lib/extensions/discord.js/BushCategoryChannel.ts @@ -10,7 +10,7 @@ export class BushCategoryChannel extends CategoryChannel { public declare guild: BushGuild; public declare readonly members: Collection<Snowflake, BushGuildMember>; public declare readonly parent: CategoryChannel | null; - constructor(guild: BushGuild, data?: unknown) { + public constructor(guild: BushGuild, data?: unknown) { super(guild, data); } } diff --git a/src/lib/extensions/discord.js/BushCommandInteraction.ts b/src/lib/extensions/discord.js/BushCommandInteraction.ts new file mode 100644 index 0000000..84c0707 --- /dev/null +++ b/src/lib/extensions/discord.js/BushCommandInteraction.ts @@ -0,0 +1,37 @@ +import { APIInteractionGuildMember } from 'discord-api-types/v8'; +import { + ApplicationCommand, + CommandInteraction, + DMChannel, + Invite, + NewsChannel, + PartialDMChannel, + Snowflake, + TextChannel +} from 'discord.js'; +import { BushClient } from '../discord-akairo/BushClient'; +import { BushApplicationCommand } from './BushApplicationCommand'; +import { BushGuild } from './BushGuild'; +import { BushGuildChannel } from './BushGuildChannel'; +import { BushGuildEmoji } from './BushGuildEmoji'; +import { BushGuildMember } from './BushGuildMember'; +import { BushRole } from './BushRole'; +import { BushUser } from './BushUser'; + +export type BushGuildResolvable = + | BushGuild + | BushGuildChannel + | BushGuildMember + | BushGuildEmoji + | Invite + | BushRole + | Snowflake; + +export class BushCommandInteraction extends CommandInteraction { + public declare readonly client: BushClient; + public declare readonly command: BushApplicationCommand | ApplicationCommand<{ guild: BushGuildResolvable }> | null; + public declare readonly channel: TextChannel | DMChannel | NewsChannel | PartialDMChannel | null; + public declare readonly guild: BushGuild | null; + public declare member: BushGuildMember | APIInteractionGuildMember | null; + public declare user: BushUser; +} diff --git a/src/lib/extensions/discord.js/BushDMChannel.ts b/src/lib/extensions/discord.js/BushDMChannel.ts index 475f224..9bf814b 100644 --- a/src/lib/extensions/discord.js/BushDMChannel.ts +++ b/src/lib/extensions/discord.js/BushDMChannel.ts @@ -8,7 +8,7 @@ export class BushDMChannel extends DMChannel { public declare messages: BushMessageManager; public declare recipient: BushUser; - constructor(client: BushClient, data?: unknown) { + public constructor(client: BushClient, data?: unknown) { super(client, data); } } diff --git a/src/lib/extensions/discord.js/BushEmoji.ts b/src/lib/extensions/discord.js/BushEmoji.ts new file mode 100644 index 0000000..ba48166 --- /dev/null +++ b/src/lib/extensions/discord.js/BushEmoji.ts @@ -0,0 +1,9 @@ +import { Emoji } from 'discord.js'; +import { BushClient } from '../discord-akairo/BushClient'; + +export class BushEmoji extends Emoji { + public declare readonly client: BushClient; + public constructor(client: BushClient, emoji: unknown) { + super(client, emoji); + } +} diff --git a/src/lib/extensions/discord.js/BushGuildApplicationCommandManager.ts b/src/lib/extensions/discord.js/BushGuildApplicationCommandManager.ts new file mode 100644 index 0000000..d4c1337 --- /dev/null +++ b/src/lib/extensions/discord.js/BushGuildApplicationCommandManager.ts @@ -0,0 +1,10 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +import { GuildApplicationCommandManager } from 'discord.js'; +import { BushGuild } from './BushGuild'; + +export class BushGuildApplicationCommandManager extends GuildApplicationCommandManager { + public guild: BushGuild; + public constructor(guild: BushGuild, iterable?: Iterable<any>) { + super(guild, iterable); + } +} diff --git a/src/lib/extensions/discord.js/BushGuildChannel.ts b/src/lib/extensions/discord.js/BushGuildChannel.ts index 75b8a5f..7eada41 100644 --- a/src/lib/extensions/discord.js/BushGuildChannel.ts +++ b/src/lib/extensions/discord.js/BushGuildChannel.ts @@ -5,7 +5,7 @@ import { BushGuild } from './BushGuild'; export class BushGuildChannel extends GuildChannel { public declare readonly client: BushClient; public declare guild: BushGuild; - constructor(guild: BushGuild, data?: unknown) { + public constructor(guild: BushGuild, data?: unknown) { super(guild, data); } } diff --git a/src/lib/extensions/discord.js/BushGuildEmoji.ts b/src/lib/extensions/discord.js/BushGuildEmoji.ts index 8c97ada..c03c1b5 100644 --- a/src/lib/extensions/discord.js/BushGuildEmoji.ts +++ b/src/lib/extensions/discord.js/BushGuildEmoji.ts @@ -9,7 +9,7 @@ export class BushGuildEmoji extends GuildEmoji { public declare guild: BushGuild; public declare author: BushUser | null; public declare readonly roles: BushGuildEmojiRoleManager; - constructor(client: BushClient, data: unknown, guild: BushGuild) { + public constructor(client: BushClient, data: unknown, guild: BushGuild) { super(client, data, guild); } } diff --git a/src/lib/extensions/discord.js/BushGuildEmojiRoleManager.ts b/src/lib/extensions/discord.js/BushGuildEmojiRoleManager.ts index 86c2492..00afb25 100644 --- a/src/lib/extensions/discord.js/BushGuildEmojiRoleManager.ts +++ b/src/lib/extensions/discord.js/BushGuildEmojiRoleManager.ts @@ -7,7 +7,7 @@ export class BushGuildEmojiRoleManager extends GuildEmojiRoleManager { public declare emoji: BushGuildEmoji; public declare guild: BushGuild; public declare cache: Collection<Snowflake, BushRole>; - constructor(emoji: BushGuildEmoji) { + public constructor(emoji: BushGuildEmoji) { super(emoji); } } diff --git a/src/lib/extensions/discord.js/BushMessage.ts b/src/lib/extensions/discord.js/BushMessage.ts index e4380f7..db68a19 100644 --- a/src/lib/extensions/discord.js/BushMessage.ts +++ b/src/lib/extensions/discord.js/BushMessage.ts @@ -11,7 +11,7 @@ import { BushUser } from './BushUser'; export class BushMessage extends Message { public declare readonly client: BushClient; - public declare util: BushCommandUtil; + public util: BushCommandUtil; public declare readonly guild: BushGuild; public declare readonly member: BushGuildMember; public declare author: BushUser; @@ -22,5 +22,7 @@ export class BushMessage extends Message { channel: BushTextChannel | BushDMChannel | BushNewsChannel | BushThreadChannel ) { super(client, data, channel); + this.util = new BushCommandUtil(this.client.commandHandler, this); + this.client.console.debug(this.util); } } diff --git a/src/lib/extensions/discord.js/BushMessageManager.ts b/src/lib/extensions/discord.js/BushMessageManager.ts index c9256a9..efc6369 100644 --- a/src/lib/extensions/discord.js/BushMessageManager.ts +++ b/src/lib/extensions/discord.js/BushMessageManager.ts @@ -8,7 +8,7 @@ import { BushTextChannel } from './BushTextChannel'; export class BushMessageManager extends MessageManager { public declare readonly client: BushClient; public declare cache: Collection<Snowflake, BushMessage>; - constructor(channel: BushTextChannel | BushDMChannel, iterable?: Iterable<any>) { + public constructor(channel: BushTextChannel | BushDMChannel, iterable?: Iterable<any>) { super(channel, iterable); } } diff --git a/src/lib/extensions/discord.js/BushMessageReaction.ts b/src/lib/extensions/discord.js/BushMessageReaction.ts new file mode 100644 index 0000000..9958059 --- /dev/null +++ b/src/lib/extensions/discord.js/BushMessageReaction.ts @@ -0,0 +1,14 @@ +import { MessageReaction } from 'discord.js'; +import { BushClient } from '../discord-akairo/BushClient'; +import { BushGuildEmoji } from './BushGuildEmoji'; +import { BushMessage } from './BushMessage'; +import { BushReactionEmoji } from './BushReactionEmoji'; + +export class BushMessageReaction extends MessageReaction { + public readonly client: BushClient; + public readonly emoji: BushGuildEmoji | BushReactionEmoji; + + public constructor(client: BushClient, data: unknown, message: BushMessage) { + super(client, data, message); + } +} diff --git a/src/lib/extensions/discord.js/BushNewsChannel.ts b/src/lib/extensions/discord.js/BushNewsChannel.ts index 77b7a9d..b026b5e 100644 --- a/src/lib/extensions/discord.js/BushNewsChannel.ts +++ b/src/lib/extensions/discord.js/BushNewsChannel.ts @@ -10,7 +10,7 @@ export class BushNewsChannel extends NewsChannel { public declare messages: BushMessageManager; public declare threads: BushThreadManager; // eslint-disable-next-line @typescript-eslint/ban-types - constructor(guild: BushGuild, data?: object) { + public constructor(guild: BushGuild, data?: object) { super(guild, data); } } diff --git a/src/lib/extensions/discord.js/BushPresence.ts b/src/lib/extensions/discord.js/BushPresence.ts new file mode 100644 index 0000000..13c7567 --- /dev/null +++ b/src/lib/extensions/discord.js/BushPresence.ts @@ -0,0 +1,15 @@ +import { Presence } from 'discord.js'; +import { BushClient } from '../discord-akairo/BushClient'; +import { BushGuild } from './BushGuild'; +import { BushGuildMember } from './BushGuildMember'; +import { BushUser } from './BushUser'; + +export class BushPresence extends Presence { + public declare guild: BushGuild | null; + public declare readonly member: BushGuildMember | null; + public declare readonly user: BushUser | null; + + public constructor(client: BushClient, data?: unknown) { + super(client, data); + } +} diff --git a/src/lib/extensions/discord.js/BushReactionEmoji.ts b/src/lib/extensions/discord.js/BushReactionEmoji.ts new file mode 100644 index 0000000..a25c1b8 --- /dev/null +++ b/src/lib/extensions/discord.js/BushReactionEmoji.ts @@ -0,0 +1,11 @@ +import { ReactionEmoji } from 'discord.js'; +import { BushClient } from '../discord-akairo/BushClient'; +import { BushMessageReaction } from './BushMessageReaction'; + +export class BushReactionEmoji extends ReactionEmoji { + public declare readonly client: BushClient; + public declare reaction: BushMessageReaction; + public constructor(reaction: BushMessageReaction, emoji: unknown) { + super(reaction, emoji); + } +} diff --git a/src/lib/extensions/discord.js/BushRole.ts b/src/lib/extensions/discord.js/BushRole.ts index ce8e9dc..1d502b2 100644 --- a/src/lib/extensions/discord.js/BushRole.ts +++ b/src/lib/extensions/discord.js/BushRole.ts @@ -7,7 +7,7 @@ export class BushRole extends Role { public declare readonly client: BushClient; public guild: BushGuild; public readonly members: Collection<Snowflake, BushGuildMember>; - constructor(client: BushClient, data: unknown, guild: BushGuild) { + public constructor(client: BushClient, data: unknown, guild: BushGuild) { super(client, data, guild); } } diff --git a/src/lib/extensions/discord.js/BushSelectMenuInteraction.ts b/src/lib/extensions/discord.js/BushSelectMenuInteraction.ts new file mode 100644 index 0000000..1dd1638 --- /dev/null +++ b/src/lib/extensions/discord.js/BushSelectMenuInteraction.ts @@ -0,0 +1,19 @@ +import { APIInteractionGuildMember } from 'discord-api-types/v8'; +import { PartialDMChannel, SelectMenuInteraction } from 'discord.js'; +import { BushClient } from '../discord-akairo/BushClient'; +import { BushDMChannel } from './BushDMChannel'; +import { BushGuild } from './BushGuild'; +import { BushGuildMember } from './BushGuildMember'; +import { BushNewsChannel } from './BushNewsChannel'; +import { BushTextChannel } from './BushTextChannel'; +import { BushUser } from './BushUser'; + +export class BushSelectMenuInteraction extends SelectMenuInteraction { + public declare readonly channel: BushTextChannel | BushDMChannel | BushNewsChannel | PartialDMChannel | null; + public declare readonly guild: BushGuild | null; + public declare member: BushGuildMember | APIInteractionGuildMember | null; + public declare user: BushUser; + public constructor(client: BushClient, data: unknown) { + super(client, data); + } +} diff --git a/src/lib/extensions/discord.js/BushStageChannel.ts b/src/lib/extensions/discord.js/BushStageChannel.ts new file mode 100644 index 0000000..5bd3f45 --- /dev/null +++ b/src/lib/extensions/discord.js/BushStageChannel.ts @@ -0,0 +1,17 @@ +import { Collection, Snowflake, StageChannel } from 'discord.js'; +import { BushClient } from '../discord-akairo/BushClient'; +import { BushCategoryChannel } from './BushCategoryChannel'; +import { BushGuild } from './BushGuild'; +import { BushGuildMember } from './BushGuildMember'; +import { BushStageInstance } from './BushStageInstance'; + +export class BushStageChannel extends StageChannel { + public declare readonly client: BushClient; + public declare readonly instance: BushStageInstance | null; + public declare readonly members: Collection<Snowflake, BushGuildMember>; + public declare guild: BushGuild; + public declare readonly parent: BushCategoryChannel | null; + public constructor(guild: BushGuild, data?: unknown) { + super(guild, data); + } +} diff --git a/src/lib/extensions/discord.js/BushStageInstance.ts b/src/lib/extensions/discord.js/BushStageInstance.ts new file mode 100644 index 0000000..f162d33 --- /dev/null +++ b/src/lib/extensions/discord.js/BushStageInstance.ts @@ -0,0 +1,13 @@ +import { StageInstance } from 'discord.js'; +import { BushClient } from '../discord-akairo/BushClient'; +import { BushGuild } from './BushGuild'; +import { BushStageChannel } from './BushStageChannel'; + +export class BushStageInstance extends StageInstance { + public declare readonly client: BushClient; + public declare readonly channel: BushStageChannel | null; + public declare readonly guild: BushGuild | null; + public constructor(client: BushClient, data: unknown, channel: BushStageChannel) { + super(client, data, channel); + } +} diff --git a/src/lib/extensions/discord.js/BushStoreChannel.ts b/src/lib/extensions/discord.js/BushStoreChannel.ts index 1a9b855..8ce22c0 100644 --- a/src/lib/extensions/discord.js/BushStoreChannel.ts +++ b/src/lib/extensions/discord.js/BushStoreChannel.ts @@ -10,7 +10,7 @@ export class BushStoreChannel extends StoreChannel { public declare readonly members: Collection<Snowflake, BushGuildMember>; public declare readonly parent: BushCategoryChannel | null; - constructor(guild: BushGuild, data?: unknown) { + public constructor(guild: BushGuild, data?: unknown) { super(guild, data); } } diff --git a/src/lib/extensions/discord.js/BushTextChannel.ts b/src/lib/extensions/discord.js/BushTextChannel.ts index b58aa7b..26e3858 100644 --- a/src/lib/extensions/discord.js/BushTextChannel.ts +++ b/src/lib/extensions/discord.js/BushTextChannel.ts @@ -7,7 +7,7 @@ export class BushTextChannel extends TextChannel { public declare readonly client: BushClient; public declare guild: BushGuild; public declare messages: BushMessageManager; - constructor(guild: BushGuild, data?: unknown) { + public constructor(guild: BushGuild, data?: unknown) { super(guild, data); } } diff --git a/src/lib/extensions/discord.js/BushThreadChannel.ts b/src/lib/extensions/discord.js/BushThreadChannel.ts index 10fc65e..9f6e84b 100644 --- a/src/lib/extensions/discord.js/BushThreadChannel.ts +++ b/src/lib/extensions/discord.js/BushThreadChannel.ts @@ -17,7 +17,7 @@ export class BushThreadChannel extends ThreadChannel { public declare readonly guildMembers: Collection<Snowflake, BushGuildMember>; public declare readonly parent: BushTextChannel | BushNewsChannel | null; - constructor(guild: BushGuild, data?: object) { + public constructor(guild: BushGuild, data?: object) { super(guild, data); } } diff --git a/src/lib/extensions/discord.js/BushThreadManager.ts b/src/lib/extensions/discord.js/BushThreadManager.ts index 408ac7f..76eaf22 100644 --- a/src/lib/extensions/discord.js/BushThreadManager.ts +++ b/src/lib/extensions/discord.js/BushThreadManager.ts @@ -5,7 +5,7 @@ import { BushTextChannel } from './BushTextChannel'; export class BushThreadManager extends ThreadManager { public declare channel: BushTextChannel | BushNewsChannel; - constructor(channel: BushTextChannel | BushNewsChannel, iterable?: Iterable<any>) { + public constructor(channel: BushTextChannel | BushNewsChannel, iterable?: Iterable<any>) { super(channel, iterable); } } diff --git a/src/lib/extensions/discord.js/BushThreadMember.ts b/src/lib/extensions/discord.js/BushThreadMember.ts index 16da663..4ef51ae 100644 --- a/src/lib/extensions/discord.js/BushThreadMember.ts +++ b/src/lib/extensions/discord.js/BushThreadMember.ts @@ -8,7 +8,7 @@ export class BushThreadMember extends ThreadMember { public declare readonly guildMember: BushGuildMember | null; public declare readonly user: BushUser | null; public declare thread: BushThreadChannel; - constructor(thread: BushThreadChannel, data?: object) { + public constructor(thread: BushThreadChannel, data?: object) { super(thread, data); } } diff --git a/src/lib/extensions/discord.js/BushThreadMemberManager.ts b/src/lib/extensions/discord.js/BushThreadMemberManager.ts index 7c7bb6d..e375322 100644 --- a/src/lib/extensions/discord.js/BushThreadMemberManager.ts +++ b/src/lib/extensions/discord.js/BushThreadMemberManager.ts @@ -17,7 +17,7 @@ export class BushThreadMemberManager extends ThreadMemberManager { public declare thread: BushThreadChannel; public declare readonly client: BushClient; - constructor(thread: BushThreadChannel, iterable?: Iterable<any>) { + public constructor(thread: BushThreadChannel, iterable?: Iterable<any>) { super(thread, iterable); } } diff --git a/src/lib/extensions/discord.js/BushVoiceChannel.ts b/src/lib/extensions/discord.js/BushVoiceChannel.ts index 7510b69..82a68b1 100644 --- a/src/lib/extensions/discord.js/BushVoiceChannel.ts +++ b/src/lib/extensions/discord.js/BushVoiceChannel.ts @@ -6,7 +6,7 @@ import { BushGuildMember } from './BushGuildMember'; export class BushVoiceChannel extends VoiceChannel { public declare readonly client: BushClient; public declare readonly members: Collection<Snowflake, BushGuildMember>; - constructor(guild: BushGuild, data?: unknown) { + public constructor(guild: BushGuild, data?: unknown) { super(guild, data); } } diff --git a/src/lib/extensions/discord.js/BushVoiceState.ts b/src/lib/extensions/discord.js/BushVoiceState.ts new file mode 100644 index 0000000..d93fa13 --- /dev/null +++ b/src/lib/extensions/discord.js/BushVoiceState.ts @@ -0,0 +1,14 @@ +import { VoiceState } from 'discord.js'; +import { BushGuild } from './BushGuild'; +import { BushGuildMember } from './BushGuildMember'; +import { BushStageChannel } from './BushStageChannel'; +import { BushVoiceChannel } from './BushVoiceChannel'; + +export class BushVoiceState extends VoiceState { + public readonly channel: BushVoiceChannel | BushStageChannel | null; + public guild: BushGuild; + public readonly member: BushGuildMember | null; + public constructor(guild: BushGuild, data: unknown) { + super(guild, data); + } +} diff --git a/src/lib/utils/BushLogger.ts b/src/lib/utils/BushLogger.ts index 7293c41..915d8f1 100644 --- a/src/lib/utils/BushLogger.ts +++ b/src/lib/utils/BushLogger.ts @@ -29,9 +29,9 @@ export class BushLogger { return tempParsedArray.join(''); } - private inspectContent(content: any, depth = 2): string { + private inspectContent(content: any, depth = 2, colors = true): string { if (typeof content !== 'string') { - return inspect(content, { depth }); + return inspect(content, { depth, colors }); } return content; } @@ -61,7 +61,8 @@ export class BushLogger { * Logs information. Highlight information by surrounding it in `<<>>`. * @param header - The header displayed before the content, displayed in cyan. * @param content - The content to log, highlights displayed in bright blue. - * @param sendChannel - Should this also be logged to discord? Defaults to true. + * @param sendChannel - Should this also be logged to discord? Defaults to false. + * @param depth - The depth the content will inspected. Defaults to 0. */ public get log() { return this.info; @@ -82,8 +83,19 @@ export class BushLogger { /** * Logs debug information. Only works in dev is enabled in the config. * @param content - The content to log. + * @param depth - The depth the content will inspected. Defaults to 0. */ - public debug(...content: any): void { + public debug(content: any, depth = 0): void { + if (!this.client.config.dev) return; + const newContent = this.inspectContent(content, depth, true); + console.log(`${chalk.bgMagenta(this.getTimeStamp())} ${chalk.magenta('[Debug]')}`, newContent); + } + + /** + * Logs raw debug information. Only works in dev is enabled in the config. + * @param content - The content to log. + */ + public debugRaw(...content: any): void { if (!this.client.config.dev) return; console.log(`${chalk.bgMagenta(this.getTimeStamp())} ${chalk.magenta('[Debug]')}`, ...content); } @@ -92,11 +104,12 @@ export class BushLogger { * Logs verbose information. Highlight information by surrounding it in `<<>>`. * @param header - The header printed before the content, displayed in grey. * @param content - The content to log, highlights displayed in bright black. - * @param sendChannel = false - Should this also be logged to discord? Defaults to false. + * @param sendChannel - Should this also be logged to discord? Defaults to false. + * @param depth - The depth the content will inspected. Defaults to 0. */ - public async verbose(header: string, content: any, sendChannel = false): Promise<void> { + public async verbose(header: string, content: any, sendChannel = false, depth = 0): Promise<void> { if (!this.client.config.logging.verbose) return; - const newContent = this.inspectContent(content); + const newContent = this.inspectContent(content, depth, true); console.info( `${chalk.bgGrey(this.getTimeStamp())} ${chalk.grey(`[${header}]`)} ` + this.parseFormatting(newContent, 'blackBright') ); @@ -112,11 +125,12 @@ export class BushLogger { * Logs information. Highlight information by surrounding it in `<<>>`. * @param header - The header displayed before the content, displayed in cyan. * @param content - The content to log, highlights displayed in bright blue. - * @param sendChannel - Should this also be logged to discord? Defaults to true. + * @param sendChannel - Should this also be logged to discord? Defaults to false. + * @param depth - The depth the content will inspected. Defaults to 0. */ - public async info(header: string, content: any, sendChannel = true): Promise<void> { + public async info(header: string, content: any, sendChannel = true, depth = 0): Promise<void> { if (!this.client.config.logging.info) return; - const newContent = this.inspectContent(content); + const newContent = this.inspectContent(content, depth, true); console.info( `${chalk.bgCyan(this.getTimeStamp())} ${chalk.cyan(`[${header}]`)} ` + this.parseFormatting(newContent, 'blueBright') ); @@ -132,10 +146,11 @@ export class BushLogger { * Logs warnings. Highlight information by surrounding it in `<<>>`. * @param header - The header displayed before the content, displayed in yellow. * @param content - The content to log, highlights displayed in bright yellow. - * @param sendChannel - Should this also be logged to discord? Defaults to true. + * @param sendChannel - Should this also be logged to discord? Defaults to false. + * @param depth - The depth the content will inspected. Defaults to 0. */ - public async warn(header: string, content: any, sendChannel = true): Promise<void> { - const newContent = this.inspectContent(content); + public async warn(header: string, content: any, sendChannel = true, depth = 0): Promise<void> { + const newContent = this.inspectContent(content, depth, true); console.warn( `${chalk.bgYellow(this.getTimeStamp())} ${chalk.yellow(`[${header}]`)} ` + this.parseFormatting(newContent, 'yellowBright') @@ -153,10 +168,11 @@ export class BushLogger { * Logs errors. Highlight information by surrounding it in `<<>>`. * @param header - The header displayed before the content, displayed in bright red. * @param content - The content to log, highlights displayed in bright red. - * @param sendChannel - Should this also be logged to discord? Defaults to true. + * @param sendChannel - Should this also be logged to discord? Defaults to false. + * @param depth - The depth the content will inspected. Defaults to 0. */ - public async error(header: string, content: any, sendChannel = true): Promise<void> { - const newContent = this.inspectContent(content); + public async error(header: string, content: any, sendChannel = true, depth = 0): Promise<void> { + const newContent = this.inspectContent(content, depth, true); console.error( `${chalk.bgRedBright(this.getTimeStamp())} ${chalk.redBright(`[${header}]`)} ` + this.parseFormatting(newContent, 'redBright') @@ -173,10 +189,11 @@ export class BushLogger { * Logs successes. Highlight information by surrounding it in `<<>>`. * @param header - The header displayed before the content, displayed in green. * @param content - The content to log, highlights displayed in bright green. - * @param sendChannel - Should this also be logged to discord? Defaults to true. + * @param sendChannel - Should this also be logged to discord? Defaults to false. + * @param depth - The depth the content will inspected. Defaults to 0. */ - public async success(header: string, content: any, sendChannel = true): Promise<void> { - const newContent = this.inspectContent(content); + public async success(header: string, content: any, sendChannel = true, depth = 0): Promise<void> { + const newContent = this.inspectContent(content, depth, true); console.log( `${chalk.bgGreen(this.getTimeStamp())} ${chalk.greenBright(`[${header}]`)} ` + this.parseFormatting(newContent, 'greenBright') diff --git a/src/lib/utils/CanvasProgressBar.ts b/src/lib/utils/CanvasProgressBar.ts index d870bf9..521a444 100644 --- a/src/lib/utils/CanvasProgressBar.ts +++ b/src/lib/utils/CanvasProgressBar.ts @@ -9,7 +9,7 @@ export class CanvasProgressBar { private p: number; private ctx: CanvasRenderingContext2D; - constructor( + public constructor( ctx: CanvasRenderingContext2D, dimension: { x: number; y: number; width: number; height: number }, color: string, diff --git a/src/listeners/client/interaction.ts b/src/listeners/client/interaction.ts new file mode 100644 index 0000000..881d759 --- /dev/null +++ b/src/listeners/client/interaction.ts @@ -0,0 +1,37 @@ +import { ButtonInteraction, CommandInteraction, Interaction, SelectMenuInteraction } from 'discord.js'; +import { BushListener } from '../../lib/extensions/discord-akairo/BushListener'; + +export default class InteractionListener extends BushListener { + public constructor() { + super('interaction', { + emitter: 'client', + event: 'interaction', + category: 'client' + }); + } + + async exec(interaction: Interaction | CommandInteraction | ButtonInteraction | SelectMenuInteraction): Promise<unknown> { + if (!interaction) return; + if (interaction.isCommand()) { + this.client.console.info( + 'SlashCommand', + `The <<${interaction.commandName}>> command was used by <<${interaction.user.tag}>> in <<${ + interaction.channel.type == 'dm' ? interaction.channel.recipient + 's DMs' : interaction.channel.name + }>>.` + ); + return; + } else if (interaction.isButton()) { + if (interaction.customID.startsWith('paginate_')) return; + return await interaction.reply({ content: 'Buttons go brrr', ephemeral: true }); + } else if (interaction.isSelectMenu()) { + return await interaction.reply({ + content: `You selected ${ + Array.isArray(interaction.values) + ? this.client.util.oxford(this.client.util.surroundArray(interaction.values, '`'), 'and', '') + : `\`${interaction.values}\`` + }.`, + ephemeral: true + }); + } + } +} diff --git a/src/listeners/commands/commandStarted.ts b/src/listeners/commands/commandStarted.ts index 6cfd239..02726f3 100644 --- a/src/listeners/commands/commandStarted.ts +++ b/src/listeners/commands/commandStarted.ts @@ -3,7 +3,7 @@ import { BushCommand } from '../../lib/extensions/discord-akairo/BushCommand'; import { BushListener } from '../../lib/extensions/discord-akairo/BushListener'; export default class CommandStartedListener extends BushListener { - constructor() { + public constructor() { super('commandStarted', { emitter: 'commandHandler', event: 'commandStarted' diff --git a/src/listeners/commands/slashCommandError.ts b/src/listeners/commands/slashCommandError.ts index ea48f34..767bd3d 100644 --- a/src/listeners/commands/slashCommandError.ts +++ b/src/listeners/commands/slashCommandError.ts @@ -5,7 +5,7 @@ import { BushListener } from '../../lib/extensions/discord-akairo/BushListener'; import { BushSlashMessage } from '../../lib/extensions/discord-akairo/BushSlashMessage'; export default class SlashCommandErrorListener extends BushListener { - constructor() { + public constructor() { super('slashError', { emitter: 'commandHandler', event: 'slashError' diff --git a/src/listeners/commands/slashStarted.ts b/src/listeners/commands/slashStarted.ts index 028d962..d6d5c3a 100644 --- a/src/listeners/commands/slashStarted.ts +++ b/src/listeners/commands/slashStarted.ts @@ -3,7 +3,7 @@ import { BushListener } from '../../lib/extensions/discord-akairo/BushListener'; import { BushSlashMessage } from '../../lib/extensions/discord-akairo/BushSlashMessage'; export default class SlashStartedListener extends BushListener { - constructor() { + public constructor() { super('slashStarted', { emitter: 'commandHandler', event: 'slashStarted' diff --git a/src/listeners/message/level.ts b/src/listeners/message/level.ts index ea6a491..1d8d5e6 100644 --- a/src/listeners/message/level.ts +++ b/src/listeners/message/level.ts @@ -5,7 +5,7 @@ import { Level } from '../../lib/models'; export default class LevelListener extends BushListener { private levelCooldowns: Set<string> = new Set(); private blacklistedChannels = ['702456294874808330']; - constructor() { + public constructor() { super('level', { emitter: 'commandHandler', event: 'messageInvalid' // Using messageInvalid here so commands don't give xp diff --git a/src/listeners/other/promiseRejection.ts b/src/listeners/other/promiseRejection.ts index 2fcfdc9..06a8e1e 100644 --- a/src/listeners/other/promiseRejection.ts +++ b/src/listeners/other/promiseRejection.ts @@ -1,7 +1,7 @@ import { BushListener } from '../../lib/extensions/discord-akairo/BushListener'; export default class PromiseRejectionListener extends BushListener { - constructor() { + public constructor() { super('promiseRejection', { emitter: 'process', event: 'unhandledRejection' diff --git a/src/tasks/unban.ts b/src/tasks/unban.ts index b6d96b8..861f71f 100644 --- a/src/tasks/unban.ts +++ b/src/tasks/unban.ts @@ -4,7 +4,7 @@ import { BushTask } from '../lib/extensions/discord-akairo/BushTask'; import { Ban } from '../lib/models'; export default class UnbanTask extends BushTask { - constructor() { + public constructor() { super('unban', { delay: 30_000, // 1/2 min runOnStart: true diff --git a/src/tasks/unmute.ts b/src/tasks/unmute.ts index 6513345..a259b17 100644 --- a/src/tasks/unmute.ts +++ b/src/tasks/unmute.ts @@ -5,7 +5,7 @@ import { Guild } from '../lib/models'; import { Mute } from '../lib/models/Mute'; export default class UnmuteTask extends BushTask { - constructor() { + public constructor() { super('unmute', { delay: 30_000, // 1/2 min runOnStart: true diff --git a/src/tasks/updateCache.ts b/src/tasks/updateCache.ts index 2f1d2d1..08e0f3c 100644 --- a/src/tasks/updateCache.ts +++ b/src/tasks/updateCache.ts @@ -4,7 +4,7 @@ import { Global } from '../lib/models'; import * as config from './../config/options'; export default class UpdateCacheTask extends BushTask { - constructor() { + public constructor() { super('updateCache', { delay: 300_000, // 5 minutes runOnStart: false // done in preinit task @@ -32,6 +32,16 @@ __metadata: languageName: node linkType: hard +"@discordjs/builders@npm:^0.1.1": + version: 0.1.1 + resolution: "@discordjs/builders@npm:0.1.1" + dependencies: + discord-api-types: ^0.18.1 + tslib: ^2.3.0 + checksum: 2902d53542467c9fe3353b412c12b273a9ecba10ad3f86029613ef3822eba68a83b491fac644bdc37e254520b6a1fcaa91ae58c3ad859d0a768e47fbd2fe3e06 + languageName: node + linkType: hard + "@discordjs/collection@npm:^0.1.6": version: 0.1.6 resolution: "@discordjs/collection@npm:0.1.6" @@ -222,9 +232,9 @@ __metadata: linkType: hard "@types/node@npm:*": - version: 15.12.5 - resolution: "@types/node@npm:15.12.5" - checksum: 42485de7a0b7277ddaae25b36ab4174fc8f23e8a5de9ccaedd002ecec17135c48227a5e09088d181c2bc34fe6b2064feb4a468954372076fd8addac2f72dad7e + version: 15.14.0 + resolution: "@types/node@npm:15.14.0" + checksum: b36835ddec52e4aec18dd042b7e960790641e895c3d32d6ed7363bfa33b012b8a41add6a82c5b9f4b83a10f9654b6eb60f5a19f6b648c3a5f4a59e20a36301b6 languageName: node linkType: hard @@ -576,7 +586,7 @@ __metadata: chalk: ^4.1.1 common-tags: ^1.8.0 discord-akairo: NotEnoughUpdates/discord-akairo - discord-api-types: ^0.18.1 + discord-api-types: 0.19.0-next.f393ba520d7d6d2aacaca7b3ca5d355fab614f6e discord.js: dev esbuild: ^0.12.11 eslint: ^7.29.0 @@ -591,17 +601,6 @@ __metadata: source-map-support: ^0.5.19 typescript: 4.2.4 uuid: ^8.3.2 - dependenciesMeta: - discord-akairo@8.2.2: - unplugged: true - discord.js@13.0.0-dev.5ad83a6a65e5944ceb3a41fee2df40ba1f5b03e4: - unplugged: true - discord.js@13.0.0-dev.e37ef3af2151e556527ccd8e98ec531bdcc0ed70: - unplugged: true - discord.js@13.0.0-dev.edab5af.1624996138: - unplugged: true - prettier@2.3.1: - unplugged: true languageName: unknown linkType: soft @@ -818,6 +817,13 @@ discord-akairo@NotEnoughUpdates/discord-akairo: languageName: node linkType: hard +"discord-api-types@npm:0.19.0-next.f393ba520d7d6d2aacaca7b3ca5d355fab614f6e, discord-api-types@npm:^0.19.0-next.f393ba520d7d6d2aacaca7b3ca5d355fab614f6e": + version: 0.19.0-next.f393ba520d7d6d2aacaca7b3ca5d355fab614f6e + resolution: "discord-api-types@npm:0.19.0-next.f393ba520d7d6d2aacaca7b3ca5d355fab614f6e" + checksum: ca53bf2bd5f85edc9e08e3bec58cb341eb1b4ebf32f2cf1c67a8d43a78146f2f78d0bb61d3124ded6642b30b84ab3e172b2f8c635df192de62c864d6e5ab15f9 + languageName: node + linkType: hard + "discord-api-types@npm:^0.18.1": version: 0.18.1 resolution: "discord-api-types@npm:0.18.1" @@ -825,17 +831,11 @@ discord-akairo@NotEnoughUpdates/discord-akairo: languageName: node linkType: hard -"discord-api-types@npm:^0.19.0-next.f393ba520d7d6d2aacaca7b3ca5d355fab614f6e": - version: 0.19.0-next.f393ba520d7d6d2aacaca7b3ca5d355fab614f6e - resolution: "discord-api-types@npm:0.19.0-next.f393ba520d7d6d2aacaca7b3ca5d355fab614f6e" - checksum: ca53bf2bd5f85edc9e08e3bec58cb341eb1b4ebf32f2cf1c67a8d43a78146f2f78d0bb61d3124ded6642b30b84ab3e172b2f8c635df192de62c864d6e5ab15f9 - languageName: node - linkType: hard - "discord.js@npm:dev": - version: 13.0.0-dev.edab5af.1624996138 - resolution: "discord.js@npm:13.0.0-dev.edab5af.1624996138" + version: 13.0.0-dev.fe6cc0c.1625184228 + resolution: "discord.js@npm:13.0.0-dev.fe6cc0c.1625184228" dependencies: + "@discordjs/builders": ^0.1.1 "@discordjs/collection": ^0.1.6 "@discordjs/form-data": ^3.0.1 "@sapphire/async-queue": ^1.1.4 @@ -843,8 +843,8 @@ discord-akairo@NotEnoughUpdates/discord-akairo: abort-controller: ^3.0.0 discord-api-types: ^0.19.0-next.f393ba520d7d6d2aacaca7b3ca5d355fab614f6e node-fetch: ^2.6.1 - ws: ^7.5.0 - checksum: b23b8a39fba21b6a9a2caf83b3b3bc0a3fbfe577c47f61c1725f95af2b56482b1d91b61628105dc5fd159fb480df1e4ee4d6545ddb0027cb32f81b5a0d82c4ba + ws: ^7.5.1 + checksum: 0b2a39e70883f5bba769879063d3973ace05853192b217b253b0bdcf8dfbd7e27f0e4eca2b7838a420c71db9184038e486d7ceba328c5f52a5b7eed6f7777b9d languageName: node linkType: hard @@ -897,11 +897,11 @@ discord-akairo@NotEnoughUpdates/discord-akairo: linkType: hard "esbuild@npm:^0.12.11": - version: 0.12.12 - resolution: "esbuild@npm:0.12.12" + version: 0.12.14 + resolution: "esbuild@npm:0.12.14" bin: esbuild: bin/esbuild - checksum: a5b0f1cd1493de2194be73829900904d9d415295db54a4a8c0b368a776ccc1a43d8ae369d086c4e2aa94f25d2fa2a7d51940ba35c91b4682768bb229900489b1 + checksum: ac7ffaecb83eda6fb93eae18ad3b46a17bc0b78db9e4f6669a4470970e0288388ac4f5f0d1a0c7dbd283fe92492dfa3a6a9463111fdf940198865dc43da34c4c languageName: node linkType: hard @@ -1162,9 +1162,9 @@ discord-akairo@NotEnoughUpdates/discord-akairo: linkType: hard "flatted@npm:^3.1.0": - version: 3.1.1 - resolution: "flatted@npm:3.1.1" - checksum: 1065cd78294ea651b8c1b96c298a3e70893a23da655e2288e40c06d5d9b1ebce4bd977e604678e01065a92580f3de5078d60d9ee4cdcede9a9989859d7eb5057 + version: 3.2.0 + resolution: "flatted@npm:3.2.0" + checksum: 8352f321fc171bd67df61e9d4b6955aae75b2f2066251010e027dc1b9dcda4f289aa0f78593a0fc43085c0e6dfdb5e86dcbc1fe2f4154b1c0fcae50fb54f9af7 languageName: node linkType: hard @@ -2263,6 +2263,13 @@ discord-akairo@NotEnoughUpdates/discord-akairo: languageName: node linkType: hard +"tslib@npm:^2.3.0": + version: 2.3.0 + resolution: "tslib@npm:2.3.0" + checksum: 7b4fc9feff0f704743c3760f5d8d708f6417fac6458159e63df3a6b1100f0736e3b99edb9fe370f274ad15160a1f49ff05cb49402534c818ff552c48e38c3e6e + languageName: node + linkType: hard + "tsutils@npm:^3.21.0": version: 3.21.0 resolution: "tsutils@npm:3.21.0" @@ -2407,7 +2414,7 @@ typescript@4.2.4: languageName: node linkType: hard -"ws@npm:^7.4.4, ws@npm:^7.5.0": +"ws@npm:^7.4.4, ws@npm:^7.5.1": version: 7.5.1 resolution: "ws@npm:7.5.1" peerDependencies: |