diff options
author | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-06-19 16:52:48 -0400 |
---|---|---|
committer | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-06-19 16:52:48 -0400 |
commit | 16bc2ea54f094c005a56e3f473847b7a33f78cc0 (patch) | |
tree | c546c86660874582357ef55d9f2a3de6ada12039 | |
parent | f2883f221706f86ee045fa94ad8cd3c9b5db5f97 (diff) | |
download | tanzanite-16bc2ea54f094c005a56e3f473847b7a33f78cc0.tar.gz tanzanite-16bc2ea54f094c005a56e3f473847b7a33f78cc0.tar.bz2 tanzanite-16bc2ea54f094c005a56e3f473847b7a33f78cc0.zip |
misc
-rwxr-xr-x | .pnp.js | 89 | ||||
-rw-r--r-- | src/lib/extensions/BushClientUtil.ts | 85 |
2 files changed, 24 insertions, 150 deletions
@@ -139,7 +139,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { "packageDependencies": [ ["@eslint/eslintrc", "npm:0.4.2"], ["ajv", "npm:6.12.6"], - ["debug", "virtual:428f325a939c2653ad822eb3d75efb02ac311523dd0d4f9645afc39ea00bd86eceac35a9d59c9b6977d76b670a4ef0ae057ea572338a44729aa592711a8c05a3#npm:4.3.2"], + ["debug", "virtual:f8b688e6542ef635eefae684748f7db5410cd1803b0f43b02ae3ebd860a79349e9ae07146ce05bdfb5fca9536ad9dbe230ed7f4c2f2ffe26893f1f1b0b8700e7#npm:4.3.2"], ["espree", "npm:7.3.1"], ["globals", "npm:13.9.0"], ["ignore", "npm:4.0.6"], @@ -406,7 +406,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["@typescript-eslint/experimental-utils", "virtual:5e3c68ea71d0b85646d5a078b5b56e0e5243913f1ce1e78c84511da03cdd76ce978b3e42d3ba35119262d370b55b3e2f8b85ed81eb2b2f2ec218791b4ccc2dbb#npm:4.27.0"], ["@typescript-eslint/parser", "virtual:d7ae587dddcefd495158f5c047acecbca3203324d75e681c7d8657c07f901f74e152f0b39978f7428d3a91daad7b5020c47ece28de69c22fcbd49d04707bf15c#npm:4.27.0"], ["@typescript-eslint/scope-manager", "npm:4.27.0"], - ["debug", "virtual:428f325a939c2653ad822eb3d75efb02ac311523dd0d4f9645afc39ea00bd86eceac35a9d59c9b6977d76b670a4ef0ae057ea572338a44729aa592711a8c05a3#npm:4.3.2"], + ["debug", "virtual:f8b688e6542ef635eefae684748f7db5410cd1803b0f43b02ae3ebd860a79349e9ae07146ce05bdfb5fca9536ad9dbe230ed7f4c2f2ffe26893f1f1b0b8700e7#npm:4.3.2"], ["eslint", "npm:7.29.0"], ["functional-red-black-tree", "npm:1.0.1"], ["lodash", "npm:4.17.21"], @@ -469,7 +469,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["@typescript-eslint/scope-manager", "npm:4.27.0"], ["@typescript-eslint/types", "npm:4.27.0"], ["@typescript-eslint/typescript-estree", "virtual:5af56ff49cdc1acb6a87357d13c1523c79d7c7d4f960f9e1ba6e39e78b84263fa0d8c4d42471a368ec57993897e9a13a2d9b5a62bfeaf3579d0a24b94eb9bf13#npm:4.27.0"], - ["debug", "virtual:428f325a939c2653ad822eb3d75efb02ac311523dd0d4f9645afc39ea00bd86eceac35a9d59c9b6977d76b670a4ef0ae057ea572338a44729aa592711a8c05a3#npm:4.3.2"], + ["debug", "virtual:f8b688e6542ef635eefae684748f7db5410cd1803b0f43b02ae3ebd860a79349e9ae07146ce05bdfb5fca9536ad9dbe230ed7f4c2f2ffe26893f1f1b0b8700e7#npm:4.3.2"], ["eslint", "npm:7.29.0"], ["typescript", "patch:typescript@npm%3A4.3.4#builtin<compat/typescript>::version=4.3.4&hash=ddfc1b"] ], @@ -515,7 +515,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["@typescript-eslint/typescript-estree", "virtual:5af56ff49cdc1acb6a87357d13c1523c79d7c7d4f960f9e1ba6e39e78b84263fa0d8c4d42471a368ec57993897e9a13a2d9b5a62bfeaf3579d0a24b94eb9bf13#npm:4.27.0"], ["@typescript-eslint/types", "npm:4.27.0"], ["@typescript-eslint/visitor-keys", "npm:4.27.0"], - ["debug", "virtual:428f325a939c2653ad822eb3d75efb02ac311523dd0d4f9645afc39ea00bd86eceac35a9d59c9b6977d76b670a4ef0ae057ea572338a44729aa592711a8c05a3#npm:4.3.2"], + ["debug", "virtual:f8b688e6542ef635eefae684748f7db5410cd1803b0f43b02ae3ebd860a79349e9ae07146ce05bdfb5fca9536ad9dbe230ed7f4c2f2ffe26893f1f1b0b8700e7#npm:4.3.2"], ["globby", "npm:11.0.4"], ["is-glob", "npm:4.0.1"], ["semver", "npm:7.3.5"], @@ -533,7 +533,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["@typescript-eslint/typescript-estree", "virtual:e57695d83029b064e6336fe25471f739df8a339786b8a1316f12613926df9c9e05571d288732c3697d74eeca532d4849cea8bb96f8902aaccae4b7c39672c979#npm:4.27.0"], ["@typescript-eslint/types", "npm:4.27.0"], ["@typescript-eslint/visitor-keys", "npm:4.27.0"], - ["debug", "virtual:428f325a939c2653ad822eb3d75efb02ac311523dd0d4f9645afc39ea00bd86eceac35a9d59c9b6977d76b670a4ef0ae057ea572338a44729aa592711a8c05a3#npm:4.3.2"], + ["debug", "virtual:f8b688e6542ef635eefae684748f7db5410cd1803b0f43b02ae3ebd860a79349e9ae07146ce05bdfb5fca9536ad9dbe230ed7f4c2f2ffe26893f1f1b0b8700e7#npm:4.3.2"], ["globby", "npm:11.0.4"], ["is-glob", "npm:4.0.1"], ["semver", "npm:7.3.5"], @@ -849,19 +849,6 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { "linkType": "HARD", }] ]], - ["canvas", [ - ["npm:2.8.0", { - "packageLocation": "./.yarn/unplugged/canvas-npm-2.8.0-b8a304d4de/node_modules/canvas/", - "packageDependencies": [ - ["canvas", "npm:2.8.0"], - ["@mapbox/node-pre-gyp", "npm:1.0.5"], - ["nan", "npm:2.14.2"], - ["node-gyp", "npm:8.1.0"], - ["simple-get", "npm:3.1.0"] - ], - "linkType": "HARD", - }] - ]], ["chalk", [ ["npm:2.4.2", { "packageLocation": "./.yarn/cache/chalk-npm-2.4.2-3ea16dd91e-22c7b7b5bc.zip/node_modules/chalk/", @@ -991,11 +978,11 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ], "linkType": "SOFT", }], - ["virtual:428f325a939c2653ad822eb3d75efb02ac311523dd0d4f9645afc39ea00bd86eceac35a9d59c9b6977d76b670a4ef0ae057ea572338a44729aa592711a8c05a3#npm:4.3.2", { - "packageLocation": "./.yarn/$$virtual/debug-virtual-c8b34b81df/0/cache/debug-npm-4.3.2-f0148b6afe-5543570879.zip/node_modules/debug/", + ["virtual:6e177cabfad012f413f9c41366539c04d8701f0567119998690ab02224012faa99ec3a16b9f74f4d7920ab472c12b3e70f47f8f143239c06d0e2569e60ed9f62#npm:2.6.9", { + "packageLocation": "./.yarn/$$virtual/debug-virtual-53242bdd6a/0/cache/debug-npm-2.6.9-7d4cb597dc-559f44f98c.zip/node_modules/debug/", "packageDependencies": [ - ["debug", "virtual:428f325a939c2653ad822eb3d75efb02ac311523dd0d4f9645afc39ea00bd86eceac35a9d59c9b6977d76b670a4ef0ae057ea572338a44729aa592711a8c05a3#npm:4.3.2"], - ["ms", "npm:2.1.2"], + ["debug", "virtual:6e177cabfad012f413f9c41366539c04d8701f0567119998690ab02224012faa99ec3a16b9f74f4d7920ab472c12b3e70f47f8f143239c06d0e2569e60ed9f62#npm:2.6.9"], + ["ms", "npm:2.0.0"], ["supports-color", null] ], "packagePeers": [ @@ -1003,11 +990,11 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ], "linkType": "HARD", }], - ["virtual:6e177cabfad012f413f9c41366539c04d8701f0567119998690ab02224012faa99ec3a16b9f74f4d7920ab472c12b3e70f47f8f143239c06d0e2569e60ed9f62#npm:2.6.9", { - "packageLocation": "./.yarn/$$virtual/debug-virtual-53242bdd6a/0/cache/debug-npm-2.6.9-7d4cb597dc-559f44f98c.zip/node_modules/debug/", + ["virtual:f8b688e6542ef635eefae684748f7db5410cd1803b0f43b02ae3ebd860a79349e9ae07146ce05bdfb5fca9536ad9dbe230ed7f4c2f2ffe26893f1f1b0b8700e7#npm:4.3.2", { + "packageLocation": "./.yarn/$$virtual/debug-virtual-fb8400fa14/0/cache/debug-npm-4.3.2-f0148b6afe-5543570879.zip/node_modules/debug/", "packageDependencies": [ - ["debug", "virtual:6e177cabfad012f413f9c41366539c04d8701f0567119998690ab02224012faa99ec3a16b9f74f4d7920ab472c12b3e70f47f8f143239c06d0e2569e60ed9f62#npm:2.6.9"], - ["ms", "npm:2.0.0"], + ["debug", "virtual:f8b688e6542ef635eefae684748f7db5410cd1803b0f43b02ae3ebd860a79349e9ae07146ce05bdfb5fca9536ad9dbe230ed7f4c2f2ffe26893f1f1b0b8700e7#npm:4.3.2"], + ["ms", "npm:2.1.2"], ["supports-color", null] ], "packagePeers": [ @@ -1199,7 +1186,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["ajv", "npm:6.12.6"], ["chalk", "npm:4.1.1"], ["cross-spawn", "npm:7.0.3"], - ["debug", "virtual:428f325a939c2653ad822eb3d75efb02ac311523dd0d4f9645afc39ea00bd86eceac35a9d59c9b6977d76b670a4ef0ae057ea572338a44729aa592711a8c05a3#npm:4.3.2"], + ["debug", "virtual:f8b688e6542ef635eefae684748f7db5410cd1803b0f43b02ae3ebd860a79349e9ae07146ce05bdfb5fca9536ad9dbe230ed7f4c2f2ffe26893f1f1b0b8700e7#npm:4.3.2"], ["doctrine", "npm:3.0.0"], ["enquirer", "npm:2.3.6"], ["escape-string-regexp", "npm:4.0.0"], @@ -1997,23 +1984,6 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["ms", "npm:2.1.2"] ], "linkType": "HARD", - }], - ["npm:2.1.3", { - "packageLocation": "./.yarn/cache/ms-npm-2.1.3-81ff3cfac1-6e721e648a.zip/node_modules/ms/", - "packageDependencies": [ - ["ms", "npm:2.1.3"] - ], - "linkType": "HARD", - }] - ]], - ["nan", [ - ["npm:2.14.2", { - "packageLocation": "./.yarn/unplugged/nan-npm-2.14.2-e3ede8ce5d/node_modules/nan/", - "packageDependencies": [ - ["nan", "npm:2.14.2"], - ["node-gyp", "npm:8.1.0"] - ], - "linkType": "HARD", }] ]], ["natural-compare", [ @@ -2034,35 +2004,6 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { "linkType": "HARD", }] ]], - ["node-gyp", [ - ["npm:8.1.0", { - "packageLocation": "./.yarn/unplugged/node-gyp-npm-8.1.0-30cf500e19/node_modules/node-gyp/", - "packageDependencies": [ - ["node-gyp", "npm:8.1.0"], - ["env-paths", "npm:2.2.1"], - ["glob", "npm:7.1.7"], - ["graceful-fs", "npm:4.2.6"], - ["make-fetch-happen", "npm:8.0.14"], - ["nopt", "npm:5.0.0"], - ["npmlog", "npm:4.1.2"], - ["rimraf", "npm:3.0.2"], - ["semver", "npm:7.3.5"], - ["tar", "npm:6.1.0"], - ["which", "npm:2.0.2"] - ], - "linkType": "HARD", - }] - ]], - ["nopt", [ - ["npm:5.0.0", { - "packageLocation": "./.yarn/cache/nopt-npm-5.0.0-304b40fbfe-e1523158fc.zip/node_modules/nopt/", - "packageDependencies": [ - ["nopt", "npm:5.0.0"], - ["abbrev", "npm:1.1.1"] - ], - "linkType": "HARD", - }] - ]], ["normalize-url", [ ["npm:6.0.1", { "packageLocation": "./.yarn/cache/normalize-url-npm-6.0.1-1df8202fbc-63fe38bbc1.zip/node_modules/normalize-url/", @@ -2578,7 +2519,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { "packageLocation": "./.yarn/$$virtual/sequelize-virtual-d11c02af07/0/cache/sequelize-npm-6.6.2-c6128633b4-174b449f4d.zip/node_modules/sequelize/", "packageDependencies": [ ["sequelize", "virtual:d7ae587dddcefd495158f5c047acecbca3203324d75e681c7d8657c07f901f74e152f0b39978f7428d3a91daad7b5020c47ece28de69c22fcbd49d04707bf15c#npm:6.6.2"], - ["debug", "virtual:428f325a939c2653ad822eb3d75efb02ac311523dd0d4f9645afc39ea00bd86eceac35a9d59c9b6977d76b670a4ef0ae057ea572338a44729aa592711a8c05a3#npm:4.3.2"], + ["debug", "virtual:f8b688e6542ef635eefae684748f7db5410cd1803b0f43b02ae3ebd860a79349e9ae07146ce05bdfb5fca9536ad9dbe230ed7f4c2f2ffe26893f1f1b0b8700e7#npm:4.3.2"], ["dottie", "npm:2.0.2"], ["inflection", "npm:1.12.0"], ["lodash", "npm:4.17.21"], diff --git a/src/lib/extensions/BushClientUtil.ts b/src/lib/extensions/BushClientUtil.ts index 9b87efd..2836983 100644 --- a/src/lib/extensions/BushClientUtil.ts +++ b/src/lib/extensions/BushClientUtil.ts @@ -268,73 +268,6 @@ export class BushClientUtil extends ClientUtil { return apiRes.uuid.replace(/-/g, ''); } - public async syncSlashCommands(force = false, guild?: Snowflake): Promise<void> { - let fetchedGuild: Guild; - if (guild) fetchedGuild = this.client.guilds.cache.get(guild); - try { - const registered = - guild === undefined ? await this.client.application.commands.fetch() : await fetchedGuild.commands.fetch(); - for (const [, registeredCommand] of registered) { - if (!this.client.commandHandler.modules.find((cmd) => cmd.id == registeredCommand.name)?.execSlash || force) { - guild === undefined - ? await this.client.application.commands.delete(registeredCommand.id) - : await fetchedGuild.commands.delete(registeredCommand.id); - this.client.logger.verbose( - 'syncSlashCommands', - `Deleted slash command <<${registeredCommand.name}>>${ - guild !== undefined ? ` in guild <<${fetchedGuild.name}>>` : '' - }` - ); - } - } - - for (const [, botCommand] of this.client.commandHandler.modules) { - if (botCommand.execSlash) { - const found = registered.find((i) => i.name == botCommand.id); - Command; - const slashdata = { - name: botCommand.id, - description: botCommand.description.content, - options: botCommand.options.slashCommandOptions - }; - botCommand; - - if (found?.id && !force) { - if (slashdata.description !== found.description) { - guild === undefined - ? await this.client.application.commands.edit(found.id, slashdata) - : fetchedGuild.commands.edit(found.id, slashdata); - this.client.logger.verbose( - 'syncSlashCommands', - `Edited slash command <<${botCommand.id}>>${guild !== undefined ? ` in guild <<${fetchedGuild?.name}>>` : ''}` - ); - } - } else { - guild === undefined - ? await this.client.application.commands.create(slashdata) - : fetchedGuild.commands.create(slashdata); - this.client.logger.verbose( - 'syncSlashCommands', - `Created slash command <<${botCommand.id}>>${guild !== undefined ? ` in guild <<${fetchedGuild?.name}>>` : ''}}` - ); - } - } - } - - return this.client.logger.log( - 'syncSlashCommands', - `Slash commands registered${guild !== undefined ? ` in guild <<${fetchedGuild?.name}>>` : ''}` - ); - } catch (e) { - return this.client.logger.error( - 'syncSlashCommands', - `Slash commands not registered${ - guild !== undefined ? ` in guild <<${fetchedGuild?.name}>>` : '' - }, with the following error:\n${e?.stack}` - ); - } - } - public moulberryBushRoleMap = [ { name: '*', id: '792453550768390194' }, { name: 'Admin Perms', id: '746541309853958186' }, @@ -402,14 +335,14 @@ export class BushClientUtil extends ClientUtil { } case 'paginate_stop': { if (deleteOnExit) { - await interaction.deferUpdate().catch(() => {}); + await interaction.deferUpdate().catch(() => undefined); if (msg.deletable && !msg.deleted) { await msg.delete(); } } else { await interaction ?.update({ content: `${text ? text + '\n' : ''}Command closed by user.`, embeds: [], components: [] }) - .catch(() => {}); + .catch(() => undefined); } return; } @@ -425,18 +358,18 @@ export class BushClientUtil extends ClientUtil { } } } else { - return await interaction?.deferUpdate().catch(() => {}); + return await interaction?.deferUpdate().catch(() => undefined); } }); collector.on('end', async () => { - await msg.edit({ content: text, embeds: [embeds[curPage]], components: [getPaginationRow(true)] }).catch(() => {}); + await msg.edit({ content: text, embeds: [embeds[curPage]], components: [getPaginationRow(true)] }).catch(() => undefined); }); async function edit(interaction: MessageComponentInteraction): Promise<void> { return await interaction ?.update({ content: text, embeds: [embeds[curPage]], components: [getPaginationRow()] }) - .catch(() => {}); + .catch(() => undefined); } const paginateEmojis = this.paginateEmojis; function getPaginationRow(disableAll = false): MessageActionRow { @@ -478,19 +411,19 @@ export class BushClientUtil extends ClientUtil { const collector = msg.createMessageComponentInteractionCollector(filter, { time: 300000 }); collector.on('collect', async (interaction: MessageComponentInteraction) => { if (interaction.user.id == message.author.id || this.client.config.owners.includes(interaction.user.id)) { - await interaction.deferUpdate().catch(() => {}); + await interaction.deferUpdate().catch(() => undefined); if (msg.deletable && !msg.deleted) { await msg.delete(); } return; } else { - return await interaction?.deferUpdate().catch(() => {}); + return await interaction?.deferUpdate().catch(() => undefined); } }); collector.on('end', async () => { updateOptions(true, true); - await msg.edit(options as MessageEditOptions).catch(() => {}); + await msg.edit(options as MessageEditOptions).catch(() => undefined); }); const paginateEmojis = this.paginateEmojis; @@ -547,7 +480,7 @@ export class BushClientUtil extends ClientUtil { return (await interaction.editReply(newResponseOptions)) as APIMessage; } else { await interaction.reply(newResponseOptions); - return await interaction.fetchReply().catch(() => {}); + return await interaction.fetchReply().catch(() => undefined); } } |