diff --git a/base/JaBa.js b/base/JaBa.js index 5416f0a0..6b5c0741 100644 --- a/base/JaBa.js +++ b/base/JaBa.js @@ -235,10 +235,10 @@ class JaBa extends Client { /** * Finds or creates user in DB - * @param {Array} param0 { id: User ID } - * @returns {import("./User")} Mongoose model or JSON of this user + * @param {String} userID User ID + * @returns {import("./User")} Mongoose model */ - async findOrCreateUser({ id: userID }) { + async findOrCreateUser(userID) { if (this.databaseCache.users.get(userID)) return this.databaseCache.users.get(userID); else { let userData = await this.usersData.findOne({ id: userID }); @@ -260,8 +260,8 @@ class JaBa extends Client { /** * Finds or creates member in DB - * @param {Array} param0 { id: Member ID } - * @returns {import("./Member")} Mongoose model or JSON of this member + * @param {Array} { id: Member ID, Guild ID } + * @returns {import("./Member")} Mongoose model */ async findOrCreateMember({ id: memberID, guildId }) { let memberData = await this.membersData.findOne({ guildID: guildId, id: memberID }); @@ -290,8 +290,8 @@ class JaBa extends Client { /** * Finds or creates guild in DB - * @param {Array} param0 { id: Guild ID } - * @returns {import("./Guild")} Mongoose model or JSON of this guild + * @param {String} guildId Guild ID + * @returns {import("./Guild")} Mongoose model */ async findOrCreateGuild(guildId) { let guildData = await this.guildsData.findOne({ id: guildId }).populate("members"); diff --git a/commands/!DISABLED/memes.js b/commands/!DISABLED/memes.js index 36eab8d2..b9e1f93a 100644 --- a/commands/!DISABLED/memes.js +++ b/commands/!DISABLED/memes.js @@ -47,12 +47,7 @@ class Memes extends BaseCommand { ), ); - const row = new ActionRowBuilder().addComponents( - new StringSelectMenuBuilder() - .setCustomId("memes_select") - .setPlaceholder(client.translate("common:NOTHING_SELECTED")) - .addOptions(tags), - ); + const row = new ActionRowBuilder().addComponents(new StringSelectMenuBuilder().setCustomId("memes_select").setPlaceholder(client.translate("common:NOTHING_SELECTED")).addOptions(tags)); const msg = await interaction.editReply({ content: interaction.translate("common:AVAILABLE_OPTIONS"), diff --git a/commands/!DISABLED/rename.js b/commands/!DISABLED/rename.js deleted file mode 100644 index 1ca1a9ca..00000000 --- a/commands/!DISABLED/rename.js +++ /dev/null @@ -1,23 +0,0 @@ -const { SlashCommandBuilder, PermissionFlagsBits } = require("discord.js"); - -module.exports = { - data: new SlashCommandBuilder() - .setName("rename") - .setDescription("Renames the ticket channel. Usage: /rename ") - .addStringOption(option => option.setName("newname").setDescription("The new name for the ticket channel").setRequired(true)) - .setDefaultMemberPermissions(PermissionFlagsBits.ManageMessages), - async execute(interaction) { - try { - const newName = interaction.options.getString("newname"); - if (!interaction.channel.name.includes("support")) { - interaction.reply("This command can only be used in a ticket channel."); - return; - } - await interaction.channel.setName(newName + "-" + interaction.channel.name.split("-")[1]); - interaction.reply(`Renamed the ticket channel to ${newName}`); - } catch (error) { - console.error(error); - interaction.reply("An error occurred while trying to rename the ticket channel."); - } - }, -}; diff --git a/commands/!DISABLED/staff.js b/commands/!DISABLED/staff.js index fbe39db5..22ceb6eb 100644 --- a/commands/!DISABLED/staff.js +++ b/commands/!DISABLED/staff.js @@ -36,6 +36,7 @@ class Staff extends BaseCommand { */ async execute(client, interaction) { await interaction.guild.members.fetch(); + const administrators = interaction.guild.members.cache.filter(m => m.permissions.has(PermissionsBitField.Flags.Administrator) && !m.user.bot); const moderators = interaction.guild.members.cache.filter(m => !administrators.has(m.id) && m.permissions.has(PermissionsBitField.Flags.ManageMessages) && !m.user.bot); const embed = new EmbedBuilder() diff --git a/commands/Administration/automod.js b/commands/Administration/automod.js index 6f99062f..dd68e21c 100644 --- a/commands/Administration/automod.js +++ b/commands/Administration/automod.js @@ -17,25 +17,44 @@ class Automod extends BaseCommand { }) .setDMPermission(false) .setDefaultMemberPermissions(PermissionsBitField.Flags.ManageGuild) - .addBooleanOption(option => - option - .setName("state") - .setDescription(client.translate("common:STATE")) + .addSubcommand(subcommand => + subcommand + .setName("toggle") + .setDescription(client.translate("administration/automod:TOGGLE")) .setDescriptionLocalizations({ - uk: client.translate("common:STATE", null, "uk-UA"), - ru: client.translate("common:STATE", null, "ru-RU"), + uk: client.translate("administration/automod:TOGGLE", null, "uk-UA"), + ru: client.translate("administration/automod:TOGGLE", null, "ru-RU"), }) - .setRequired(true), + .addBooleanOption(option => + option + .setName("state") + .setDescription(client.translate("common:STATE")) + .setDescriptionLocalizations({ + uk: client.translate("common:STATE", null, "uk-UA"), + ru: client.translate("common:STATE", null, "ru-RU"), + }) + .setRequired(true), + ), ) - .addChannelOption(option => - option - .setName("channel") - .setDescription(client.translate("common:CHANNEL")) + .addSubcommand(subcommand => + subcommand + .setName("ignore") + .setDescription(client.translate("administration/automod:IGNORE")) .setDescriptionLocalizations({ - uk: client.translate("common:CHANNEL", null, "uk-UA"), - ru: client.translate("common:CHANNEL", null, "ru-RU"), + uk: client.translate("administration/automod:IGNORE", null, "uk-UA"), + ru: client.translate("administration/automod:IGNORE", null, "ru-RU"), }) - .addChannelTypes(ChannelType.GuildText), + .addChannelOption(option => + option + .setName("channel") + .setDescription(client.translate("common:CHANNEL")) + .setDescriptionLocalizations({ + uk: client.translate("common:CHANNEL", null, "uk-UA"), + ru: client.translate("common:CHANNEL", null, "ru-RU"), + }) + .addChannelTypes(ChannelType.GuildText) + .setRequired(true), + ), ), aliases: [], dirname: __dirname, @@ -57,36 +76,26 @@ class Automod extends BaseCommand { */ async execute(client, interaction, data) { const state = interaction.options.getBoolean("state"), - channel = interaction.options.getChannel("channel"); + channel = interaction.options.getChannel("channel"), + command = interaction.options.getSubcommand(); - if (state) { + if (command === "toggle") { data.guildData.plugins.automod = { - enabled: true, + enabled: state, ignored: [], }; await data.guildData.save(); - return interaction.success("administration/automod:ENABLED"); - } else { - if (channel) { - data.guildData.plugins.automod.ignored.push(channel.id); + interaction.success(`administration/automod:${state ? "ENABLED" : "DISABLED"}`); + } else if (command === "ignore") { + data.guildData.plugins.automod.ignored.push(channel.id); - await data.guildData.save(); + await data.guildData.save(); - interaction.success("administration/automod:DISABLED_CHANNEL", { - channel: channel.toString(), - }); - } else { - data.guildData.plugins.automod = { - enabled: false, - ignored: [], - }; - - await data.guildData.save(); - - interaction.success("administration/automod:DISABLED"); - } + interaction.success("administration/automod:DISABLED_CHANNEL", { + channel: channel.toString(), + }); } } } diff --git a/languages/en-US/administration/automod.json b/languages/en-US/administration/automod.json index d2cd2289..291a7e39 100644 --- a/languages/en-US/administration/automod.json +++ b/languages/en-US/administration/automod.json @@ -2,6 +2,8 @@ "DESCRIPTION": "Toggles automatic removal of invitation links", "USAGE": "[state] (#channel)", "EXAMPLES": "automod state:True\nautomod state:False channel:#general\nautomod state:False", + "TOGGLE": "Toggle automod", + "IGNORE": "Ignore channel", "ENABLED": "Invitation links will be automatically removed\nUse `automod false #channel` to ignore the channel", "DISABLED_CHANNEL": "Automoderation will not be performed in {{channel}}", "DISABLED": "Automoderation is disabled", diff --git a/languages/ru-RU/administration/automod.json b/languages/ru-RU/administration/automod.json index 4613a478..bdbb0937 100644 --- a/languages/ru-RU/administration/automod.json +++ b/languages/ru-RU/administration/automod.json @@ -2,6 +2,8 @@ "DESCRIPTION": "Включить или отключить автоудаление ссылок-приглашений", "USAGE": "[state] (#channel)", "EXAMPLES": "automod state:True\nautomod state:False channel:#general\nautomod state:False", + "TOGGLE": "Переключить автомод", + "IGNORE": "Игнорировать канал", "ENABLED": "Ссылки-приглашения будут удаляться автоматически\nИспользуйте `automod false #channel` для игнорирования канала", "DISABLED_CHANNEL": "Автомодерация не будет выполняться в {{channel}}", "DISABLED": "Автомодерация отключена", diff --git a/languages/uk-UA/administration/automod.json b/languages/uk-UA/administration/automod.json index c2b6c813..7cb672e7 100644 --- a/languages/uk-UA/administration/automod.json +++ b/languages/uk-UA/administration/automod.json @@ -2,6 +2,8 @@ "DESCRIPTION": "Увімкнути або вимкнути автовидалення посилань-запрошень", "USAGE": "[state] (#channel)", "EXAMPLES": "automod state:True\nautomod state:False channel:#general\nautomod state:False", + "TOGGLE": "Переключити автомод", + "IGNORE": "Ігнорувати канал", "ENABLED": "Посилання-запрошення будуть видалятися автоматично\nВикористовуйте `automod false #channel` для ігнорування каналу", "DISABLED_CHANNEL": "Автомодерація не буде виконуватися в {{channel}}", "DISABLED": "Автомодерація відключена", diff --git a/package.json b/package.json index a619b84b..f10ed81e 100644 --- a/package.json +++ b/package.json @@ -10,16 +10,16 @@ }, "author": "Discord: jonny_bro", "dependencies": { - "@discord-player/extractor": "^4.4.4", + "@discord-player/extractor": "^4.4.5", "@discordjs/opus": "^0.9.0", "@discordjs/rest": "^2.0.1", "@discordjs/voice": "^0.16.0", "canvas": "^2.10.2", "chalk": "^4.1.2", "cron": "^2.1.0", - "discord-api-types": "^0.37.60", + "discord-api-types": "^0.37.62", "discord-giveaways": "^6.0.1", - "discord-player": "^6.6.4", + "discord-player": "^6.6.6", "discord.js": "^14.13.0", "gamedig": "^4.0.2", "i18next": "^21.9.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 0d8cb39f..cb50060b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -6,8 +6,8 @@ settings: dependencies: '@discord-player/extractor': - specifier: ^4.4.4 - version: 4.4.4 + specifier: ^4.4.5 + version: 4.4.5 '@discordjs/opus': specifier: ^0.9.0 version: 0.9.0 @@ -27,14 +27,14 @@ dependencies: specifier: ^2.1.0 version: 2.1.0 discord-api-types: - specifier: ^0.37.60 - version: 0.37.60 + specifier: ^0.37.62 + version: 0.37.62 discord-giveaways: specifier: ^6.0.1 version: 6.0.1(discord.js@14.13.0) discord-player: - specifier: ^6.6.4 - version: 6.6.4(@discord-player/extractor@4.4.4)(@discordjs/opus@0.9.0)(discord.js@14.13.0)(youtube-sr@4.3.4) + specifier: ^6.6.6 + version: 6.6.6(@discord-player/extractor@4.4.5)(@discordjs/opus@0.9.0) discord.js: specifier: ^14.13.0 version: 14.13.0 @@ -89,17 +89,17 @@ packages: resolution: {integrity: sha512-71UAepYMbHTg2QQLXQAgyuXYHrgAYpJDxjg9dRWfTUNf+zfOAlyJEiRRk/WFhQyGu6m23iLR/H/JxgF4AW8Csg==} dev: false - /@discord-player/extractor@4.4.4: - resolution: {integrity: sha512-GO6GiZ+dccfAWVQxhz26TaxKEsKYwYE/MVmCkwCYAzaZ879nnG4so+OJi1l/uYbbZq0fjBCDX/2vkgm9gIw16Q==} + /@discord-player/extractor@4.4.5: + resolution: {integrity: sha512-xy4PXrjYRF2VwLkxYFEB++Q6jutvAeLv58fHTW2HI2wbyiNYI8F6+dka1X0qd7ubKl8meE+bsfkmvJssAhsmyA==} dependencies: file-type: 16.5.4 genius-lyrics: 4.4.6 isomorphic-unfetch: 4.0.2 - node-html-parser: 6.1.5 + node-html-parser: 6.1.10 reverbnation-scraper: 2.0.0 soundcloud.ts: 0.5.2 spotify-url-info: 3.2.8 - youtube-sr: 4.3.4 + youtube-sr: 4.3.9 transitivePeerDependencies: - encoding dev: false @@ -198,7 +198,7 @@ packages: engines: {node: '>=16.9.0'} dependencies: '@types/ws': 8.5.5 - discord-api-types: 0.37.60 + discord-api-types: 0.37.62 prism-media: 1.3.5(@discordjs/opus@0.9.0) tslib: 2.6.0 ws: 8.13.0 @@ -714,8 +714,8 @@ packages: resolution: {integrity: sha512-X4CDiMnDbA3s3RaUXWXmgAIbY1uxab3fqe3qwzg5XutR3wjqi7M3IkgQbsIBzpqBN2YWr/Qdv7JrFRqSgb4TFg==} dev: false - /discord-api-types@0.37.60: - resolution: {integrity: sha512-5BELXTsv7becqVHrD81nZrqT4oEyXXWBwbsO/kwDDu6X3u19VV1tYDB5I5vaVAK+c1chcDeheI9zACBLm41LiQ==} + /discord-api-types@0.37.62: + resolution: {integrity: sha512-KpLQ6TiylGSSHj8AQW8Hz1ek1MkBbQUWs4gZhWH0rvSsWSj9tfav6EIitSxbFmqveqfu8oiPFI7vgFE4kBhTcQ==} dev: false /discord-giveaways@6.0.1(discord.js@14.13.0): @@ -729,22 +729,18 @@ packages: serialize-javascript: 6.0.1 dev: false - /discord-player@6.6.4(@discord-player/extractor@4.4.4)(@discordjs/opus@0.9.0)(discord.js@14.13.0)(youtube-sr@4.3.4): - resolution: {integrity: sha512-dXOCqgFD6Yc+gi/FHJ4J+AGtiMQ8NNxXYPKrhOLt0dQWHVQxpk2MwzNcukNi3OBPZ0f/U030rOIzmtZSkST9mg==} + /discord-player@6.6.6(@discord-player/extractor@4.4.5)(@discordjs/opus@0.9.0): + resolution: {integrity: sha512-XYQU4Vuy3H1aXgdaNPajzp8od7salL5cy2JIWoUdINKv5rCVXeu24BxkPj7QB5Db6uK3yKCOumfIWkL0Il1uVQ==} peerDependencies: - '@discord-player/extractor': ^4.4.4 - discord.js: 14.x - youtube-sr: 4.x + '@discord-player/extractor': ^4.4.5 dependencies: '@discord-player/equalizer': 0.2.3 - '@discord-player/extractor': 4.4.4 + '@discord-player/extractor': 4.4.5 '@discord-player/ffmpeg': 0.1.0 '@discord-player/utils': 0.2.2 discord-voip: 0.1.3(@discordjs/opus@0.9.0) - discord.js: 14.13.0 ip: 1.1.8 libsodium-wrappers: 0.7.11 - youtube-sr: 4.3.4 transitivePeerDependencies: - '@discordjs/opus' - bufferutil @@ -761,7 +757,7 @@ packages: '@discord-player/ffmpeg': 0.1.0 '@discord-player/opus': 0.1.2 '@types/ws': 8.5.5 - discord-api-types: 0.37.60 + discord-api-types: 0.37.62 prism-media: 1.3.5(@discordjs/opus@0.9.0) tslib: 2.6.2 ws: 8.13.0 @@ -1111,7 +1107,7 @@ packages: resolution: {integrity: sha512-TeSF4qXwLm+Nl8wUX+WUTJlEhPBanMw9EWpIHE2a/Qs4y2NBK99AHYfZJc73H1HVkZj4zPfscuGWlkQbbh0pDA==} dependencies: node-html-parser: 6.1.10 - undici: 5.25.2 + undici: 5.26.4 dev: false /get-stream@6.0.1: @@ -1652,13 +1648,6 @@ packages: he: 1.2.0 dev: false - /node-html-parser@6.1.5: - resolution: {integrity: sha512-fAaM511feX++/Chnhe475a0NHD8M7AxDInsqQpz6x63GRF7xYNdS8Vo5dKsIVPgsOvG7eioRRTZQnWBrhDHBSg==} - dependencies: - css-select: 5.1.0 - he: 1.2.0 - dev: false - /nopt@5.0.0: resolution: {integrity: sha512-Tbj67rffqceeLpcRXrT7vKAN8CwfPeIBgM7E6iBkmKLV7bEMwpGgYLGv0jACUsECaa/vuxP0IjEont6umdMgtQ==} engines: {node: '>=6'} @@ -2004,7 +1993,7 @@ packages: /soundcloud.ts@0.5.2: resolution: {integrity: sha512-/pc72HWYJpSpup+mJBE9pT31JsrMcxJGBlip3Vem+0Fsscg98xh1/7I2nCpAKuMAeV6MVyrisI8TfjO6T7qKJg==} dependencies: - undici: 5.22.1 + undici: 5.26.4 dev: false /sparse-bitfield@3.0.3: @@ -2163,13 +2152,6 @@ packages: busboy: 1.6.0 dev: false - /undici@5.25.2: - resolution: {integrity: sha512-tch8RbCfn1UUH1PeVCXva4V8gDpGAud/w0WubD6sHC46vYQ3KDxL+xv1A2UxK0N6jrVedutuPHxe1XIoqerwMw==} - engines: {node: '>=14.0'} - dependencies: - busboy: 1.6.0 - dev: false - /undici@5.26.4: resolution: {integrity: sha512-OG+QOf0fTLtazL9P9X7yqWxQ+Z0395Wk6DSkyTxtaq3wQEjIroVe7Y4asCX/vcCxYpNGMnwz8F0qbRYUoaQVMw==} engines: {node: '>=14.0'} @@ -2282,6 +2264,6 @@ packages: undici: 5.26.4 dev: false - /youtube-sr@4.3.4: - resolution: {integrity: sha512-olSYcR80XigutCrePEXBX3/RJJrWfonJQj7+/ggBiWU0CzTDLE1q8+lpWTWCG0JpzhzILp/IB/Bq/glGqqr1TQ==} + /youtube-sr@4.3.9: + resolution: {integrity: sha512-wPGEgVevSn32BJu5jiSHdvoryUCTCIM9LYT+yMDDpUfaev2Dh46dB+4qU31NgJ9XOsNxGlEKmc9qxUO5L0CE/Q==} dev: false