mirror of
https://github.com/JonnyBro/JaBa.git
synced 2024-11-21 20:54:58 +05:00
Обновление устаревших функций. Счётчик не нужон
This commit is contained in:
parent
84d9066a14
commit
2cdd18c22a
9 changed files with 46 additions and 42 deletions
|
@ -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 },
|
||||
}));
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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];
|
||||
|
|
|
@ -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],
|
||||
});
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -8,5 +8,7 @@
|
|||
"MODAL_REASON": "Причина предупреждения",
|
||||
"WARNED_DM": "Вы получили предупреждение на сервере **{{server}}** от пользователя **{{moderator}}** по причине **{{reason}}**",
|
||||
"WARNED": "**{{user}}** получил предупреждение по причине **{{reason}}**",
|
||||
"CASE": "Предупрежение | #{{caseNumber}}"
|
||||
"WARN": "Предупрежение",
|
||||
"BAN": "Бан",
|
||||
"KICK": "Кик"
|
||||
}
|
|
@ -8,5 +8,7 @@
|
|||
"MODAL_REASON": "Причина попередження",
|
||||
"WARNED_DM": "Ви отримали попередження на сервері **{{server}}** від користувача **{{moderator}}** через **{{reason}}**",
|
||||
"WARNED": "**{{user}}** отримав попередження через **{{reason}}**",
|
||||
"CASE": "Попередження | #{{caseNumber}}"
|
||||
"WARN": "Попередження",
|
||||
"BAN": "Бан",
|
||||
"KICK": "Кик"
|
||||
}
|
Loading…
Reference in a new issue