diff --git a/base/Guild.js b/base/Guild.js index fb23c2ad..27c01504 100644 --- a/base/Guild.js +++ b/base/Guild.js @@ -8,7 +8,7 @@ module.exports = mongoose.model("Guild", new Schema({ membersData: { type: Object, default: {} }, members: [{ type: Schema.Types.ObjectId, ref: "Member" }], - language: { type: String, default: languages.find((l) => l.default).name }, + language: { type: String, default: languages.find(l => l.default).name }, plugins: { type: Object, default: { welcome: { enabled: false, @@ -40,5 +40,4 @@ module.exports = mongoose.model("Guild", new Schema({ birthdays: false, reports: false, } }, - casesCount: { type: Number, default: 0 }, })); \ No newline at end of file diff --git a/commands/Administration/selectroles.js b/commands/Administration/selectroles.js index 073f6c8d..76d43dff 100644 --- a/commands/Administration/selectroles.js +++ b/commands/Administration/selectroles.js @@ -1,4 +1,4 @@ -const { SlashCommandBuilder, PermissionFlagsBits, ActionRowBuilder, SelectMenuBuilder } = require("discord.js"); +const { SlashCommandBuilder, PermissionFlagsBits, ActionRowBuilder, StringSelectMenuBuilder } = require("discord.js"); const BaseCommand = require("../../base/BaseCommand"); class Selectroles extends BaseCommand { @@ -42,7 +42,7 @@ class Selectroles extends BaseCommand { */ async onLoad(client) { client.on("interactionCreate", async interaction => { - if (!interaction.isSelectMenu()) return; + if (!interaction.isStringSelectMenu()) return; if (interaction.customId === "auto_roles") { const removed = interaction.component.options.filter(option => { @@ -107,14 +107,14 @@ class Selectroles extends BaseCommand { row = ActionRowBuilder.from(row) .setComponents( - SelectMenuBuilder.from(menu) + StringSelectMenuBuilder.from(menu) .setMinValues(0) .setMaxValues(menu.options.length + 1) .addOptions(option), ); } else { row.addComponents( - new SelectMenuBuilder() + new StringSelectMenuBuilder() .setCustomId("auto_roles") .setMinValues(0) .setMaxValues(1) diff --git a/commands/Fun/memes.js b/commands/Fun/memes.js index 89e1316c..0ae3e6b2 100644 --- a/commands/Fun/memes.js +++ b/commands/Fun/memes.js @@ -1,4 +1,4 @@ -const { SlashCommandBuilder, EmbedBuilder, ActionRowBuilder, SelectMenuBuilder } = require("discord.js"); +const { SlashCommandBuilder, EmbedBuilder, ActionRowBuilder, StringSelectMenuBuilder } = require("discord.js"); const BaseCommand = require("../../base/BaseCommand"), fetch = require("node-fetch"); @@ -43,7 +43,7 @@ class Memes extends BaseCommand { const row = new ActionRowBuilder() .addComponents( - new SelectMenuBuilder() + new StringSelectMenuBuilder() .setCustomId("memes_select") .setPlaceholder(client.translate("common:NOTHING_SELECTED")) .addOptions(tags), @@ -59,11 +59,11 @@ class Memes extends BaseCommand { const collector = msg.createMessageComponentCollector({ filter, idle: (2 * 60 * 1000) }); collector.on("collect", async i => { - if (i.isSelectMenu() && i.customId === "memes_select") { + if (i.isStringSelectMenu() && i.customId === "memes_select") { i.deferUpdate(); const tag = i.values[0]; - const res = await fetch(`https://meme-api.herokuapp.com/gimme/${tag}`).then(response => response.json()); + const res = await fetch(`https://meme-api.com/gimme/${tag}`).then(response => response.json()); const embed = new EmbedBuilder() .setColor(client.config.embed.color) diff --git a/commands/General/activity.js b/commands/General/activity.js index 625ac575..52370be7 100644 --- a/commands/General/activity.js +++ b/commands/General/activity.js @@ -1,4 +1,4 @@ -const { SlashCommandBuilder, EmbedBuilder, ActionRowBuilder, SelectMenuBuilder, PermissionsBitField } = require("discord.js"), +const { SlashCommandBuilder, EmbedBuilder, ActionRowBuilder, StringSelectMenuBuilder, PermissionsBitField } = require("discord.js"), { defaultApplications } = require("../../helpers/discordTogether"); const BaseCommand = require("../../base/BaseCommand"); @@ -49,7 +49,7 @@ class Activity extends BaseCommand { const row = new ActionRowBuilder() .addComponents( - new SelectMenuBuilder() + new StringSelectMenuBuilder() .setCustomId("activity_select") .setPlaceholder(client.translate("common:NOTHING_SELECTED")) .addOptions(activities), @@ -64,7 +64,7 @@ class Activity extends BaseCommand { const collector = interaction.channel.createMessageComponentCollector({ filter, idle: (15 * 1000) }); collector.on("collect", async i => { - if (i.isSelectMenu() && i.customId === "activity_select") { + if (i.isStringSelectMenu() && i.customId === "activity_select") { const activity = i?.values[0]; const invite = await client.discordTogether.createTogetherCode(voice.id, activity); diff --git a/commands/General/help.js b/commands/General/help.js index d61d3d14..7f47d41b 100644 --- a/commands/General/help.js +++ b/commands/General/help.js @@ -1,4 +1,4 @@ -const { SlashCommandBuilder, EmbedBuilder, ActionRowBuilder, SelectMenuBuilder, PermissionsBitField } = require("discord.js"); +const { SlashCommandBuilder, EmbedBuilder, ActionRowBuilder, StringSelectMenuBuilder, PermissionsBitField } = require("discord.js"); const BaseCommand = require("../../base/BaseCommand"); class Help extends BaseCommand { @@ -58,7 +58,7 @@ class Help extends BaseCommand { const row = new ActionRowBuilder() .addComponents( - new SelectMenuBuilder() + new StringSelectMenuBuilder() .setCustomId("help_category_select") .setPlaceholder(client.translate("common:NOTHING_SELECTED")) .addOptions(categoriesRows), @@ -74,7 +74,7 @@ class Help extends BaseCommand { const collector = msg.createMessageComponentCollector({ filter, idle: (15 * 1000) }); collector.on("collect", async i => { - if (i.isSelectMenu() && i.customId === "help_category_select") { + if (i.isStringSelectMenu() && i.customId === "help_category_select") { i.deferUpdate(); const arg = i?.values[0]; diff --git a/commands/Moderation/warn.js b/commands/Moderation/warn.js index 8c3c0381..756ff4ae 100644 --- a/commands/Moderation/warn.js +++ b/commands/Moderation/warn.js @@ -69,14 +69,10 @@ class Warn extends BaseCommand { const banCount = data.guildData.plugins.warnsSanctions.ban; const kickCount = data.guildData.plugins.warnsSanctions.kick; - data.guildData.casesCount++; - data.guildData.save(); - const caseInfo = { moderator: interaction.member.id, date: Date.now(), type: "warn", - case: data.guildData.casesCount, reason, }; @@ -107,14 +103,16 @@ class Warn extends BaseCommand { reason, }), }); + caseInfo.type = "ban"; - embed.setAuthor({ - name: interaction.translate("moderation/ban:CASE", { - count: data.guildData.casesCount, - }), - }) + + embed + .setAuthor({ + name: interaction.translate("moderation/warn:BAN"), + }) .setColor(client.config.embed.color); - interaction.guild.members.ban(member); + + interaction.guild.members.ban(member).catch(() => {}); interaction.success("moderation/setwarns:AUTO_BAN", { username: member.user.tag, count: `${banCount} ${client.getNoun(banCount, interaction.translate("misc:NOUNS:WARNS:1"), interaction.translate("misc:NOUNS:WARNS:2"), interaction.translate("misc:NOUNS:WARNS:5"))}`, @@ -132,13 +130,15 @@ class Warn extends BaseCommand { reason, }), }); + caseInfo.type = "kick"; - embed.setAuthor({ - name: interaction.translate("moderation/kick:CASE", { - count: data.guildData.casesCount, - }), - }) + + embed + .setAuthor({ + name: interaction.translate("moderation/warn:KICK"), + }) .setColor(client.config.embed.color); + member.kick().catch(() => {}); interaction.success("moderation/setwarns:AUTO_KICK", { username: member.user.tag, @@ -157,11 +157,11 @@ class Warn extends BaseCommand { }); caseInfo.type = "warn"; - embed.setAuthor({ - name: interaction.translate("moderation/warn:CASE", { - caseNumber: data.guildData.casesCount, - }), - }).setColor(client.config.embed.color); + embed + .setAuthor({ + name: interaction.translate("moderation/warn:WARN"), + }) + .setColor(client.config.embed.color); submitted.reply({ content: interaction.translate("moderation/warn:WARNED", { @@ -176,6 +176,7 @@ class Warn extends BaseCommand { if (data.guildData.plugins.modlogs) { const channel = interaction.guild.channels.cache.get(data.guildData.plugins.modlogs); if (!channel) return; + channel.send({ embeds: [embed], }); diff --git a/commands/NSFW/nsfw.js b/commands/NSFW/nsfw.js index 8c1194d3..aad6f4b1 100644 --- a/commands/NSFW/nsfw.js +++ b/commands/NSFW/nsfw.js @@ -1,4 +1,4 @@ -const { SlashCommandBuilder, EmbedBuilder, ActionRowBuilder, SelectMenuBuilder } = require("discord.js"); +const { SlashCommandBuilder, EmbedBuilder, ActionRowBuilder, StringSelectMenuBuilder } = require("discord.js"); const BaseCommand = require("../../base/BaseCommand"), fetch = require("node-fetch"); @@ -45,7 +45,7 @@ class NSFW extends BaseCommand { const row = new ActionRowBuilder() .addComponents( - new SelectMenuBuilder() + new StringSelectMenuBuilder() .setCustomId("nsfw_select") .setPlaceholder(client.translate("common:NOTHING_SELECTED")) .addOptions(tags), @@ -62,11 +62,11 @@ class NSFW extends BaseCommand { const collector = msg.createMessageComponentCollector({ filter, idle: (2 * 60 * 1000) }); collector.on("collect", async i => { - if (i.isSelectMenu() && i.customId === "nsfw_select") { + if (i.isStringSelectMenu() && i.customId === "nsfw_select") { i.deferUpdate(); const tag = i?.values[0]; - const res = await fetch(`https://meme-api.herokuapp.com/gimme/${tag}`).then(response => response.json()); + const res = await fetch(`https://meme-api.com/gimme/${tag}`).then(response => response.json()); const embed = new EmbedBuilder() .setColor(client.config.embed.color) diff --git a/languages/ru-RU/moderation/warn.json b/languages/ru-RU/moderation/warn.json index 5a8cb328..7956e5ef 100644 --- a/languages/ru-RU/moderation/warn.json +++ b/languages/ru-RU/moderation/warn.json @@ -8,5 +8,7 @@ "MODAL_REASON": "Причина предупреждения", "WARNED_DM": "Вы получили предупреждение на сервере **{{server}}** от пользователя **{{moderator}}** по причине **{{reason}}**", "WARNED": "**{{user}}** получил предупреждение по причине **{{reason}}**", - "CASE": "Предупрежение | #{{caseNumber}}" + "WARN": "Предупрежение", + "BAN": "Бан", + "KICK": "Кик" } \ No newline at end of file diff --git a/languages/uk-UA/moderation/warn.json b/languages/uk-UA/moderation/warn.json index 4ebef357..a89f4c62 100644 --- a/languages/uk-UA/moderation/warn.json +++ b/languages/uk-UA/moderation/warn.json @@ -8,5 +8,7 @@ "MODAL_REASON": "Причина попередження", "WARNED_DM": "Ви отримали попередження на сервері **{{server}}** від користувача **{{moderator}}** через **{{reason}}**", "WARNED": "**{{user}}** отримав попередження через **{{reason}}**", - "CASE": "Попередження | #{{caseNumber}}" + "WARN": "Попередження", + "BAN": "Бан", + "KICK": "Кик" } \ No newline at end of file