From 2b06a59c57fdf7aad217d63db875cdb3d8868036 Mon Sep 17 00:00:00 2001 From: IRONM00N <64110067+IRONM00N@users.noreply.github.com> Date: Thu, 1 Jul 2021 20:37:34 -0400 Subject: don't judge me part 2 & fix esbuild with eval command --- .pnp.js | 77 +++++---- .vscode/extensions.json | 16 +- .vscode/settings.json | 184 ++++++++++----------- package.json | 21 +-- src/bot.ts | 1 + src/commands/config/muteRole.ts | 2 +- src/commands/config/prefix.ts | 2 +- src/commands/dev/eval.ts | 51 +++++- src/commands/dev/reload.ts | 2 +- src/commands/dev/setLevel.ts | 2 +- src/commands/info/botInfo.ts | 2 +- src/commands/info/help.ts | 2 +- src/commands/info/ping.ts | 2 +- src/commands/info/pronouns.ts | 2 +- src/commands/moderation/ban.ts | 2 +- src/commands/moderation/kick.ts | 2 +- src/commands/moderation/modlog.ts | 2 +- src/commands/moderation/mute.ts | 2 +- src/commands/moderation/role.ts | 2 +- src/commands/moulberry-bush/giveawayPing.ts | 2 +- src/commands/moulberry-bush/level.ts | 2 +- src/inhibitors/blacklist/guildBlacklist.ts | 7 +- src/inhibitors/blacklist/userBlacklist.ts | 7 +- src/inhibitors/commands/disabledCommand.ts | 7 +- src/inhibitors/noCache.ts | 9 +- src/lib/extensions/discord-akairo/BushClient.ts | 57 +++++-- .../extensions/discord-akairo/BushClientUtil.ts | 2 +- src/lib/extensions/discord-akairo/BushCommand.ts | 2 +- .../extensions/discord-akairo/BushCommandUtil.ts | 14 +- src/lib/extensions/discord.js/BushActivity.ts | 10 ++ .../discord.js/BushApplicationCommand.ts | 14 ++ .../discord.js/BushApplicationCommandManager.ts | 24 +++ .../BushApplicationCommandPermissionsManager.ts | 24 +++ .../extensions/discord.js/BushButtonInteraction.ts | 19 +++ .../extensions/discord.js/BushCategoryChannel.ts | 2 +- .../discord.js/BushCommandInteraction.ts | 37 +++++ src/lib/extensions/discord.js/BushDMChannel.ts | 2 +- src/lib/extensions/discord.js/BushEmoji.ts | 9 + .../BushGuildApplicationCommandManager.ts | 10 ++ src/lib/extensions/discord.js/BushGuildChannel.ts | 2 +- src/lib/extensions/discord.js/BushGuildEmoji.ts | 2 +- .../discord.js/BushGuildEmojiRoleManager.ts | 2 +- src/lib/extensions/discord.js/BushMessage.ts | 4 +- .../extensions/discord.js/BushMessageManager.ts | 2 +- .../extensions/discord.js/BushMessageReaction.ts | 14 ++ src/lib/extensions/discord.js/BushNewsChannel.ts | 2 +- src/lib/extensions/discord.js/BushPresence.ts | 15 ++ src/lib/extensions/discord.js/BushReactionEmoji.ts | 11 ++ src/lib/extensions/discord.js/BushRole.ts | 2 +- .../discord.js/BushSelectMenuInteraction.ts | 19 +++ src/lib/extensions/discord.js/BushStageChannel.ts | 17 ++ src/lib/extensions/discord.js/BushStageInstance.ts | 13 ++ src/lib/extensions/discord.js/BushStoreChannel.ts | 2 +- src/lib/extensions/discord.js/BushTextChannel.ts | 2 +- src/lib/extensions/discord.js/BushThreadChannel.ts | 2 +- src/lib/extensions/discord.js/BushThreadManager.ts | 2 +- src/lib/extensions/discord.js/BushThreadMember.ts | 2 +- .../discord.js/BushThreadMemberManager.ts | 2 +- src/lib/extensions/discord.js/BushVoiceChannel.ts | 2 +- src/lib/extensions/discord.js/BushVoiceState.ts | 14 ++ src/lib/utils/BushLogger.ts | 55 +++--- src/lib/utils/CanvasProgressBar.ts | 2 +- src/listeners/client/interaction.ts | 37 +++++ src/listeners/commands/commandStarted.ts | 2 +- src/listeners/commands/slashCommandError.ts | 2 +- src/listeners/commands/slashStarted.ts | 2 +- src/listeners/message/level.ts | 2 +- src/listeners/other/promiseRejection.ts | 2 +- src/tasks/unban.ts | 2 +- src/tasks/unmute.ts | 2 +- src/tasks/updateCache.ts | 2 +- yarn.lock | 73 ++++---- 72 files changed, 681 insertions(+), 271 deletions(-) create mode 100644 src/lib/extensions/discord.js/BushActivity.ts create mode 100644 src/lib/extensions/discord.js/BushApplicationCommand.ts create mode 100644 src/lib/extensions/discord.js/BushApplicationCommandManager.ts create mode 100644 src/lib/extensions/discord.js/BushApplicationCommandPermissionsManager.ts create mode 100644 src/lib/extensions/discord.js/BushButtonInteraction.ts create mode 100644 src/lib/extensions/discord.js/BushCommandInteraction.ts create mode 100644 src/lib/extensions/discord.js/BushEmoji.ts create mode 100644 src/lib/extensions/discord.js/BushGuildApplicationCommandManager.ts create mode 100644 src/lib/extensions/discord.js/BushMessageReaction.ts create mode 100644 src/lib/extensions/discord.js/BushPresence.ts create mode 100644 src/lib/extensions/discord.js/BushReactionEmoji.ts create mode 100644 src/lib/extensions/discord.js/BushSelectMenuInteraction.ts create mode 100644 src/lib/extensions/discord.js/BushStageChannel.ts create mode 100644 src/lib/extensions/discord.js/BushStageInstance.ts create mode 100644 src/lib/extensions/discord.js/BushVoiceState.ts create mode 100644 src/listeners/client/interaction.ts diff --git a/.pnp.js b/.pnp.js index 977d0de..ece27cb 100755 --- a/.pnp.js +++ b/.pnp.js @@ -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 - } } } diff --git a/src/bot.ts b/src/bot.ts index 5e2d10c..5bab926 100644 --- a/src/bot.ts +++ b/src/bot.ts @@ -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 { - 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 { 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 { 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 { - 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 { + //@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; + 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 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 { + public permissions: ApplicationCommandPermissionsManager< + { command?: BushApplicationCommandResolvable } & PermissionsOptionsExtras, + { command: BushApplicationCommandResolvable } & PermissionsOptionsExtras, + PermissionsGuildType, + null + >; + + public constructor(client: BushClient, iterable?: Iterable) { + 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 { + 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; 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) { + 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; - 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; - constructor(channel: BushTextChannel | BushDMChannel, iterable?: Iterable) { + public constructor(channel: BushTextChannel | BushDMChannel, iterable?: Iterable) { 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; - 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 BushStageCha