diff --git a/commands/General/help.js b/commands/General/help.js index 660f800c..095a6c31 100644 --- a/commands/General/help.js +++ b/commands/General/help.js @@ -16,7 +16,8 @@ class Help extends BaseCommand { .addStringOption(option => option.setName("command") .setDescription(client.translate("common:COMMAND")) - .setDescriptionLocalizations({ "uk": client.translate("common:COMMAND", null, "uk-UA") })), + .setDescriptionLocalizations({ "uk": client.translate("common:COMMAND", null, "uk-UA") }) + .setAutocomplete(true)), aliases: [], dirname: __dirname, ownerOnly: false, @@ -41,9 +42,11 @@ class Help extends BaseCommand { const commands = [...new Map(client.commands.map(v => [v.constructor.name, v])).values()]; const categories = []; const command = interaction.options.getString("command"); - if ((commands.find(c => c.command.name === command).category === "Owner") && interaction.user.id !== client.config.owner.id) return interaction.error("misc:OWNER_ONLY", null, { edit: true, ephemeral: true }); - if (command) return interaction.editReply({ embeds: [ generateCommandHelp(interaction, command) ] }); + if (command) { + if (commands.find(c => c.command.name === command).category === "Owner" && interaction.user.id !== client.config.owner.id) return interaction.error("misc:OWNER_ONLY", null, { edit: true, ephemeral: true }); + return interaction.editReply({ embeds: [ generateCommandHelp(interaction, command) ] }); + } commands.forEach(c => { if (!categories.includes(c.category)) { @@ -117,6 +120,26 @@ class Help extends BaseCommand { }); }); } + + /** + * + * @param {import("../../base/JaBa")} client + * @param {import("discord.js").AutocompleteInteraction} interaction + * @returns + */ + async autocompleteRun(client, interaction) { + const command = interaction.options.getString("command"), + commands = [...new Map(client.commands.map(v => [v.constructor.name, v])).values()], + results = commands.filter(c => c.name.includes(command)); + console.log(commands); + + return interaction.respond( + results.slice(0, 25).map(command => ({ + name: command.name, + value: command.name, + }), + )); + } } function getPermName(bitfield = 0) { diff --git a/package-lock.json b/package-lock.json index cadadbe4..d83e2e30 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,17 +11,17 @@ "dependencies": { "@discord-player/extractor": "^4.1.2", "@discordjs/opus": "^0.9.0", - "@discordjs/rest": "^1.6.0", - "@discordjs/voice": "^0.15.0", + "@discordjs/rest": "^1.7.0", + "@discordjs/voice": "^0.16.0", "btoa": "^1.2.1", "canvacord": "^5.1.0", "canvas": "^2.10.2", "chalk": "^4.1.2", "cron": "^2.1.0", - "discord-api-types": "^0.37.36", + "discord-api-types": "^0.37.37", "discord-giveaways": "^6.0.1", "discord-player": "^6.1.1", - "discord.js": "^14.8.0", + "discord.js": "^14.9.0", "ejs": "^3.1.3", "express": "^4.17.1", "express-session": "^1.17.0", @@ -32,7 +32,8 @@ "md5": "^2.2.1", "moment": "^2.26.0", "mongoose": "^5.13.15", - "ms": "^2.1.3" + "ms": "^2.1.3", + "play-dl": "^1.9.6" }, "devDependencies": { "eslint": "^8.23.0" @@ -141,14 +142,14 @@ } }, "node_modules/@discordjs/builders": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/@discordjs/builders/-/builders-1.5.0.tgz", - "integrity": "sha512-7XxT78mnNBPigHn2y6KAXkicxIBFtZREGWaRZ249EC1l6gBUEP8IyVY5JTciIjJArxkF+tg675aZvsTNTKBpmA==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/@discordjs/builders/-/builders-1.6.1.tgz", + "integrity": "sha512-CCcLwn/8ANhlAbhlE18fcaN0hfXTen53/JiwZs1t9oE/Cqa9maA8ZRarkCIsXF4J7J/MYnd0J6IsxeKsq+f6mw==", "dependencies": { - "@discordjs/formatters": "^0.2.0", + "@discordjs/formatters": "^0.3.0", "@discordjs/util": "^0.2.0", "@sapphire/shapeshift": "^3.8.1", - "discord-api-types": "^0.37.35", + "discord-api-types": "^0.37.37", "fast-deep-equal": "^3.1.3", "ts-mixer": "^6.0.3", "tslib": "^2.5.0" @@ -158,19 +159,19 @@ } }, "node_modules/@discordjs/collection": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/@discordjs/collection/-/collection-1.4.0.tgz", - "integrity": "sha512-hiOJyk2CPFf1+FL3a4VKCuu1f448LlROVuu8nLz1+jCOAPokUcdFAV+l4pd3B3h6uJlJQSASoZzrdyNdjdtfzQ==", + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@discordjs/collection/-/collection-1.5.0.tgz", + "integrity": "sha512-suyVndkEAAWrGxyw/CPGdtXoRRU6AUNkibtnbJevQzpelkJh3Q1gQqWDpqf5i39CnAn5+LrN0YS+cULeEjq2Yw==", "engines": { "node": ">=16.9.0" } }, "node_modules/@discordjs/formatters": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/@discordjs/formatters/-/formatters-0.2.0.tgz", - "integrity": "sha512-vn4oMSXuMZUm8ITqVOtvE7/fMMISj4cI5oLsR09PEQXHKeKDAMLltG/DWeeIs7Idfy6V8Fk3rn1e69h7NfzuNA==", + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/@discordjs/formatters/-/formatters-0.3.0.tgz", + "integrity": "sha512-Fc4MomalbP8HMKEMor3qUiboAKDtR7PSBoPjwm7WYghVRwgJlj5WYvUsriLsxeKk8+Qq2oy+HJlGTUkGvX0YnA==", "dependencies": { - "discord-api-types": "^0.37.35" + "discord-api-types": "^0.37.37" }, "engines": { "node": ">=16.9.0" @@ -209,18 +210,18 @@ } }, "node_modules/@discordjs/rest": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/@discordjs/rest/-/rest-1.6.0.tgz", - "integrity": "sha512-HGvqNCZ5Z5j0tQHjmT1lFvE5ETO4hvomJ1r0cbnpC1zM23XhCpZ9wgTCiEmaxKz05cyf2CI9p39+9LL+6Yz1bA==", + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/@discordjs/rest/-/rest-1.7.0.tgz", + "integrity": "sha512-r2HzmznRIo8IDGYBWqQfkEaGN1LrFfWQd3dSyC4tOpMU8nuVvFUEw6V/lwnG44jyOq+vgyDny2fxeUDMt9I4aQ==", "dependencies": { - "@discordjs/collection": "^1.4.0", + "@discordjs/collection": "^1.5.0", "@discordjs/util": "^0.2.0", "@sapphire/async-queue": "^1.5.0", "@sapphire/snowflake": "^3.4.0", - "discord-api-types": "^0.37.35", + "discord-api-types": "^0.37.37", "file-type": "^18.2.1", "tslib": "^2.5.0", - "undici": "^5.20.0" + "undici": "^5.21.0" }, "engines": { "node": ">=16.9.0" @@ -235,15 +236,15 @@ } }, "node_modules/@discordjs/voice": { - "version": "0.15.0", - "resolved": "https://registry.npmjs.org/@discordjs/voice/-/voice-0.15.0.tgz", - "integrity": "sha512-YEvrRchDhjB0QbI9QYOF/qgDwvGb9sNGUyks5d3Srl+VRoMoKkMzWY+wcEfVbAgdMIAdLi5vyrTKP/gLND26jA==", + "version": "0.16.0", + "resolved": "https://registry.npmjs.org/@discordjs/voice/-/voice-0.16.0.tgz", + "integrity": "sha512-ToGCvHD1cBscuW3p+C7zOF5+L7MJmU4GjdOARfNk9mkHyFFZq4grK+Sxr3QXKbp27DtfDBc9uqD4GUOYgxngfA==", "dependencies": { "@types/ws": "^8.5.4", - "discord-api-types": "^0.37.35", + "discord-api-types": "^0.37.37", "prism-media": "^1.3.5", "tslib": "^2.5.0", - "ws": "^8.12.1" + "ws": "^8.13.0" }, "engines": { "node": ">=16.9.0" @@ -537,9 +538,9 @@ } }, "node_modules/@sapphire/shapeshift": { - "version": "3.8.1", - "resolved": "https://registry.npmjs.org/@sapphire/shapeshift/-/shapeshift-3.8.1.tgz", - "integrity": "sha512-xG1oXXBhCjPKbxrRTlox9ddaZTvVpOhYLmKmApD/vIWOV1xEYXnpoFs68zHIZBGbqztq6FrUPNPerIrO1Hqeaw==", + "version": "3.8.2", + "resolved": "https://registry.npmjs.org/@sapphire/shapeshift/-/shapeshift-3.8.2.tgz", + "integrity": "sha512-NXpnJAsxN3/h9TqQPntOeVWZrpIuucqXI3IWF6tj2fWCoRLCuVK5wx7Dtg7pRrtkYfsMUbDqgKoX26vrC5iYfA==", "dependencies": { "fast-deep-equal": "^3.1.3", "lodash": "^4.17.21" @@ -1459,9 +1460,9 @@ } }, "node_modules/discord-api-types": { - "version": "0.37.36", - "resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.37.36.tgz", - "integrity": "sha512-Nlxmp10UpVr/utgZ9uODQvG2Or+5w7LFrvFMswyeKC9l/+UaqGT6H0OVgEFhu9GEO4U6K7NNO5W8Carv7irnCA==" + "version": "0.37.37", + "resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.37.37.tgz", + "integrity": "sha512-LDMBKzl/zbvHO/yCzno5hevuA6lFIXJwdKSJZQrB+1ToDpFfN9thK+xxgZNR4aVkI7GHRDja0p4Sl2oYVPnHYg==" }, "node_modules/discord-giveaways": { "version": "6.0.1", @@ -1498,23 +1499,23 @@ } }, "node_modules/discord.js": { - "version": "14.8.0", - "resolved": "https://registry.npmjs.org/discord.js/-/discord.js-14.8.0.tgz", - "integrity": "sha512-UOxYtc/YnV7jAJ2gISluJyYeBw4e+j8gWn+IoqG8unaHAVuvZ13DdYN0M1f9fbUgUvSarV798inIrYFtDNDjwQ==", + "version": "14.9.0", + "resolved": "https://registry.npmjs.org/discord.js/-/discord.js-14.9.0.tgz", + "integrity": "sha512-ygGms5xP4hG+QrrY9k7d/OYCzMltSMtdl/2Snzq/nLCiZo+Sna91Ulv9l0+B5Jd/Czcq37B7wJAnmja7GOa+bg==", "dependencies": { - "@discordjs/builders": "^1.5.0", - "@discordjs/collection": "^1.4.0", - "@discordjs/formatters": "^0.2.0", - "@discordjs/rest": "^1.6.0", + "@discordjs/builders": "^1.6.0", + "@discordjs/collection": "^1.5.0", + "@discordjs/formatters": "^0.3.0", + "@discordjs/rest": "^1.7.0", "@discordjs/util": "^0.2.0", "@sapphire/snowflake": "^3.4.0", "@types/ws": "^8.5.4", - "discord-api-types": "^0.37.35", + "discord-api-types": "^0.37.37", "fast-deep-equal": "^3.1.3", "lodash.snakecase": "^4.1.1", "tslib": "^2.5.0", - "undici": "^5.20.0", - "ws": "^8.12.1" + "undici": "^5.21.0", + "ws": "^8.13.0" }, "engines": { "node": ">=16.9.0" @@ -3475,14 +3476,12 @@ "node_modules/play-audio": { "version": "0.5.2", "resolved": "https://registry.npmjs.org/play-audio/-/play-audio-0.5.2.tgz", - "integrity": "sha512-ZAqHUKkQLix2Iga7pPbsf1LpUoBjcpwU93F1l3qBIfxYddQLhxS6GKmS0d3jV8kSVaUbr6NnOEcEMFvuX93SWQ==", - "peer": true + "integrity": "sha512-ZAqHUKkQLix2Iga7pPbsf1LpUoBjcpwU93F1l3qBIfxYddQLhxS6GKmS0d3jV8kSVaUbr6NnOEcEMFvuX93SWQ==" }, "node_modules/play-dl": { "version": "1.9.6", "resolved": "https://registry.npmjs.org/play-dl/-/play-dl-1.9.6.tgz", "integrity": "sha512-JW44bQbME9fNfGhGXQ/rdcsHr4BfgJabVlSgpS9QY/NscfprFH1asv+q9atrZThP3+hHIpgtFNABccg9rFWlwg==", - "peer": true, "dependencies": { "play-audio": "^0.5.2" }, @@ -4566,30 +4565,30 @@ } }, "@discordjs/builders": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/@discordjs/builders/-/builders-1.5.0.tgz", - "integrity": "sha512-7XxT78mnNBPigHn2y6KAXkicxIBFtZREGWaRZ249EC1l6gBUEP8IyVY5JTciIjJArxkF+tg675aZvsTNTKBpmA==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/@discordjs/builders/-/builders-1.6.1.tgz", + "integrity": "sha512-CCcLwn/8ANhlAbhlE18fcaN0hfXTen53/JiwZs1t9oE/Cqa9maA8ZRarkCIsXF4J7J/MYnd0J6IsxeKsq+f6mw==", "requires": { - "@discordjs/formatters": "^0.2.0", + "@discordjs/formatters": "^0.3.0", "@discordjs/util": "^0.2.0", "@sapphire/shapeshift": "^3.8.1", - "discord-api-types": "^0.37.35", + "discord-api-types": "^0.37.37", "fast-deep-equal": "^3.1.3", "ts-mixer": "^6.0.3", "tslib": "^2.5.0" } }, "@discordjs/collection": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/@discordjs/collection/-/collection-1.4.0.tgz", - "integrity": "sha512-hiOJyk2CPFf1+FL3a4VKCuu1f448LlROVuu8nLz1+jCOAPokUcdFAV+l4pd3B3h6uJlJQSASoZzrdyNdjdtfzQ==" + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@discordjs/collection/-/collection-1.5.0.tgz", + "integrity": "sha512-suyVndkEAAWrGxyw/CPGdtXoRRU6AUNkibtnbJevQzpelkJh3Q1gQqWDpqf5i39CnAn5+LrN0YS+cULeEjq2Yw==" }, "@discordjs/formatters": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/@discordjs/formatters/-/formatters-0.2.0.tgz", - "integrity": "sha512-vn4oMSXuMZUm8ITqVOtvE7/fMMISj4cI5oLsR09PEQXHKeKDAMLltG/DWeeIs7Idfy6V8Fk3rn1e69h7NfzuNA==", + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/@discordjs/formatters/-/formatters-0.3.0.tgz", + "integrity": "sha512-Fc4MomalbP8HMKEMor3qUiboAKDtR7PSBoPjwm7WYghVRwgJlj5WYvUsriLsxeKk8+Qq2oy+HJlGTUkGvX0YnA==", "requires": { - "discord-api-types": "^0.37.35" + "discord-api-types": "^0.37.37" } }, "@discordjs/node-pre-gyp": { @@ -4618,18 +4617,18 @@ } }, "@discordjs/rest": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/@discordjs/rest/-/rest-1.6.0.tgz", - "integrity": "sha512-HGvqNCZ5Z5j0tQHjmT1lFvE5ETO4hvomJ1r0cbnpC1zM23XhCpZ9wgTCiEmaxKz05cyf2CI9p39+9LL+6Yz1bA==", + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/@discordjs/rest/-/rest-1.7.0.tgz", + "integrity": "sha512-r2HzmznRIo8IDGYBWqQfkEaGN1LrFfWQd3dSyC4tOpMU8nuVvFUEw6V/lwnG44jyOq+vgyDny2fxeUDMt9I4aQ==", "requires": { - "@discordjs/collection": "^1.4.0", + "@discordjs/collection": "^1.5.0", "@discordjs/util": "^0.2.0", "@sapphire/async-queue": "^1.5.0", "@sapphire/snowflake": "^3.4.0", - "discord-api-types": "^0.37.35", + "discord-api-types": "^0.37.37", "file-type": "^18.2.1", "tslib": "^2.5.0", - "undici": "^5.20.0" + "undici": "^5.21.0" } }, "@discordjs/util": { @@ -4638,15 +4637,15 @@ "integrity": "sha512-/8qNbebFzLWKOOg+UV+RB8itp4SmU5jw0tBUD3ifElW6rYNOj1Ku5JaSW7lLl/WgjjxF01l/1uQPCzkwr110vg==" }, "@discordjs/voice": { - "version": "0.15.0", - "resolved": "https://registry.npmjs.org/@discordjs/voice/-/voice-0.15.0.tgz", - "integrity": "sha512-YEvrRchDhjB0QbI9QYOF/qgDwvGb9sNGUyks5d3Srl+VRoMoKkMzWY+wcEfVbAgdMIAdLi5vyrTKP/gLND26jA==", + "version": "0.16.0", + "resolved": "https://registry.npmjs.org/@discordjs/voice/-/voice-0.16.0.tgz", + "integrity": "sha512-ToGCvHD1cBscuW3p+C7zOF5+L7MJmU4GjdOARfNk9mkHyFFZq4grK+Sxr3QXKbp27DtfDBc9uqD4GUOYgxngfA==", "requires": { "@types/ws": "^8.5.4", - "discord-api-types": "^0.37.35", + "discord-api-types": "^0.37.37", "prism-media": "^1.3.5", "tslib": "^2.5.0", - "ws": "^8.12.1" + "ws": "^8.13.0" } }, "@eslint/eslintrc": { @@ -4813,9 +4812,9 @@ "integrity": "sha512-JkLdIsP8fPAdh9ZZjrbHWR/+mZj0wvKS5ICibcLrRI1j84UmLMshx5n9QmL8b95d4onJ2xxiyugTgSAX7AalmA==" }, "@sapphire/shapeshift": { - "version": "3.8.1", - "resolved": "https://registry.npmjs.org/@sapphire/shapeshift/-/shapeshift-3.8.1.tgz", - "integrity": "sha512-xG1oXXBhCjPKbxrRTlox9ddaZTvVpOhYLmKmApD/vIWOV1xEYXnpoFs68zHIZBGbqztq6FrUPNPerIrO1Hqeaw==", + "version": "3.8.2", + "resolved": "https://registry.npmjs.org/@sapphire/shapeshift/-/shapeshift-3.8.2.tgz", + "integrity": "sha512-NXpnJAsxN3/h9TqQPntOeVWZrpIuucqXI3IWF6tj2fWCoRLCuVK5wx7Dtg7pRrtkYfsMUbDqgKoX26vrC5iYfA==", "requires": { "fast-deep-equal": "^3.1.3", "lodash": "^4.17.21" @@ -5523,9 +5522,9 @@ } }, "discord-api-types": { - "version": "0.37.36", - "resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.37.36.tgz", - "integrity": "sha512-Nlxmp10UpVr/utgZ9uODQvG2Or+5w7LFrvFMswyeKC9l/+UaqGT6H0OVgEFhu9GEO4U6K7NNO5W8Carv7irnCA==" + "version": "0.37.37", + "resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.37.37.tgz", + "integrity": "sha512-LDMBKzl/zbvHO/yCzno5hevuA6lFIXJwdKSJZQrB+1ToDpFfN9thK+xxgZNR4aVkI7GHRDja0p4Sl2oYVPnHYg==" }, "discord-giveaways": { "version": "6.0.1", @@ -5548,23 +5547,23 @@ } }, "discord.js": { - "version": "14.8.0", - "resolved": "https://registry.npmjs.org/discord.js/-/discord.js-14.8.0.tgz", - "integrity": "sha512-UOxYtc/YnV7jAJ2gISluJyYeBw4e+j8gWn+IoqG8unaHAVuvZ13DdYN0M1f9fbUgUvSarV798inIrYFtDNDjwQ==", + "version": "14.9.0", + "resolved": "https://registry.npmjs.org/discord.js/-/discord.js-14.9.0.tgz", + "integrity": "sha512-ygGms5xP4hG+QrrY9k7d/OYCzMltSMtdl/2Snzq/nLCiZo+Sna91Ulv9l0+B5Jd/Czcq37B7wJAnmja7GOa+bg==", "requires": { - "@discordjs/builders": "^1.5.0", - "@discordjs/collection": "^1.4.0", - "@discordjs/formatters": "^0.2.0", - "@discordjs/rest": "^1.6.0", + "@discordjs/builders": "^1.6.0", + "@discordjs/collection": "^1.5.0", + "@discordjs/formatters": "^0.3.0", + "@discordjs/rest": "^1.7.0", "@discordjs/util": "^0.2.0", "@sapphire/snowflake": "^3.4.0", "@types/ws": "^8.5.4", - "discord-api-types": "^0.37.35", + "discord-api-types": "^0.37.37", "fast-deep-equal": "^3.1.3", "lodash.snakecase": "^4.1.1", "tslib": "^2.5.0", - "undici": "^5.20.0", - "ws": "^8.12.1" + "undici": "^5.21.0", + "ws": "^8.13.0" } }, "doctrine": { @@ -7025,14 +7024,12 @@ "play-audio": { "version": "0.5.2", "resolved": "https://registry.npmjs.org/play-audio/-/play-audio-0.5.2.tgz", - "integrity": "sha512-ZAqHUKkQLix2Iga7pPbsf1LpUoBjcpwU93F1l3qBIfxYddQLhxS6GKmS0d3jV8kSVaUbr6NnOEcEMFvuX93SWQ==", - "peer": true + "integrity": "sha512-ZAqHUKkQLix2Iga7pPbsf1LpUoBjcpwU93F1l3qBIfxYddQLhxS6GKmS0d3jV8kSVaUbr6NnOEcEMFvuX93SWQ==" }, "play-dl": { "version": "1.9.6", "resolved": "https://registry.npmjs.org/play-dl/-/play-dl-1.9.6.tgz", "integrity": "sha512-JW44bQbME9fNfGhGXQ/rdcsHr4BfgJabVlSgpS9QY/NscfprFH1asv+q9atrZThP3+hHIpgtFNABccg9rFWlwg==", - "peer": true, "requires": { "play-audio": "^0.5.2" } diff --git a/package.json b/package.json index e16a9ec7..ea6b32e7 100644 --- a/package.json +++ b/package.json @@ -14,17 +14,17 @@ "dependencies": { "@discord-player/extractor": "^4.1.2", "@discordjs/opus": "^0.9.0", - "@discordjs/rest": "^1.6.0", - "@discordjs/voice": "^0.15.0", + "@discordjs/rest": "^1.7.0", + "@discordjs/voice": "^0.16.0", "btoa": "^1.2.1", "canvacord": "^5.1.0", "canvas": "^2.10.2", "chalk": "^4.1.2", "cron": "^2.1.0", - "discord-api-types": "^0.37.36", + "discord-api-types": "^0.37.37", "discord-giveaways": "^6.0.1", "discord-player": "^6.1.1", - "discord.js": "^14.8.0", + "discord.js": "^14.9.0", "ejs": "^3.1.3", "express": "^4.17.1", "express-session": "^1.17.0", @@ -35,7 +35,8 @@ "md5": "^2.2.1", "moment": "^2.26.0", "mongoose": "^5.13.15", - "ms": "^2.1.3" + "ms": "^2.1.3", + "play-dl": "^1.9.6" }, "devDependencies": { "eslint": "^8.23.0"