mirror of
https://github.com/JonnyBro/JaBa.git
synced 2024-11-22 13:14: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: {} },
|
membersData: { type: Object, default: {} },
|
||||||
members: [{ type: Schema.Types.ObjectId, ref: "Member" }],
|
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: {
|
plugins: { type: Object, default: {
|
||||||
welcome: {
|
welcome: {
|
||||||
enabled: false,
|
enabled: false,
|
||||||
|
@ -40,5 +40,4 @@ module.exports = mongoose.model("Guild", new Schema({
|
||||||
birthdays: false,
|
birthdays: false,
|
||||||
reports: 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");
|
const BaseCommand = require("../../base/BaseCommand");
|
||||||
|
|
||||||
class Selectroles extends BaseCommand {
|
class Selectroles extends BaseCommand {
|
||||||
|
@ -42,7 +42,7 @@ class Selectroles extends BaseCommand {
|
||||||
*/
|
*/
|
||||||
async onLoad(client) {
|
async onLoad(client) {
|
||||||
client.on("interactionCreate", async interaction => {
|
client.on("interactionCreate", async interaction => {
|
||||||
if (!interaction.isSelectMenu()) return;
|
if (!interaction.isStringSelectMenu()) return;
|
||||||
|
|
||||||
if (interaction.customId === "auto_roles") {
|
if (interaction.customId === "auto_roles") {
|
||||||
const removed = interaction.component.options.filter(option => {
|
const removed = interaction.component.options.filter(option => {
|
||||||
|
@ -107,14 +107,14 @@ class Selectroles extends BaseCommand {
|
||||||
|
|
||||||
row = ActionRowBuilder.from(row)
|
row = ActionRowBuilder.from(row)
|
||||||
.setComponents(
|
.setComponents(
|
||||||
SelectMenuBuilder.from(menu)
|
StringSelectMenuBuilder.from(menu)
|
||||||
.setMinValues(0)
|
.setMinValues(0)
|
||||||
.setMaxValues(menu.options.length + 1)
|
.setMaxValues(menu.options.length + 1)
|
||||||
.addOptions(option),
|
.addOptions(option),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
row.addComponents(
|
row.addComponents(
|
||||||
new SelectMenuBuilder()
|
new StringSelectMenuBuilder()
|
||||||
.setCustomId("auto_roles")
|
.setCustomId("auto_roles")
|
||||||
.setMinValues(0)
|
.setMinValues(0)
|
||||||
.setMaxValues(1)
|
.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"),
|
const BaseCommand = require("../../base/BaseCommand"),
|
||||||
fetch = require("node-fetch");
|
fetch = require("node-fetch");
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ class Memes extends BaseCommand {
|
||||||
|
|
||||||
const row = new ActionRowBuilder()
|
const row = new ActionRowBuilder()
|
||||||
.addComponents(
|
.addComponents(
|
||||||
new SelectMenuBuilder()
|
new StringSelectMenuBuilder()
|
||||||
.setCustomId("memes_select")
|
.setCustomId("memes_select")
|
||||||
.setPlaceholder(client.translate("common:NOTHING_SELECTED"))
|
.setPlaceholder(client.translate("common:NOTHING_SELECTED"))
|
||||||
.addOptions(tags),
|
.addOptions(tags),
|
||||||
|
@ -59,11 +59,11 @@ class Memes extends BaseCommand {
|
||||||
const collector = msg.createMessageComponentCollector({ filter, idle: (2 * 60 * 1000) });
|
const collector = msg.createMessageComponentCollector({ filter, idle: (2 * 60 * 1000) });
|
||||||
|
|
||||||
collector.on("collect", async i => {
|
collector.on("collect", async i => {
|
||||||
if (i.isSelectMenu() && i.customId === "memes_select") {
|
if (i.isStringSelectMenu() && i.customId === "memes_select") {
|
||||||
i.deferUpdate();
|
i.deferUpdate();
|
||||||
|
|
||||||
const tag = i.values[0];
|
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()
|
const embed = new EmbedBuilder()
|
||||||
.setColor(client.config.embed.color)
|
.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");
|
{ defaultApplications } = require("../../helpers/discordTogether");
|
||||||
const BaseCommand = require("../../base/BaseCommand");
|
const BaseCommand = require("../../base/BaseCommand");
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ class Activity extends BaseCommand {
|
||||||
|
|
||||||
const row = new ActionRowBuilder()
|
const row = new ActionRowBuilder()
|
||||||
.addComponents(
|
.addComponents(
|
||||||
new SelectMenuBuilder()
|
new StringSelectMenuBuilder()
|
||||||
.setCustomId("activity_select")
|
.setCustomId("activity_select")
|
||||||
.setPlaceholder(client.translate("common:NOTHING_SELECTED"))
|
.setPlaceholder(client.translate("common:NOTHING_SELECTED"))
|
||||||
.addOptions(activities),
|
.addOptions(activities),
|
||||||
|
@ -64,7 +64,7 @@ class Activity extends BaseCommand {
|
||||||
const collector = interaction.channel.createMessageComponentCollector({ filter, idle: (15 * 1000) });
|
const collector = interaction.channel.createMessageComponentCollector({ filter, idle: (15 * 1000) });
|
||||||
|
|
||||||
collector.on("collect", async i => {
|
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 activity = i?.values[0];
|
||||||
|
|
||||||
const invite = await client.discordTogether.createTogetherCode(voice.id, activity);
|
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");
|
const BaseCommand = require("../../base/BaseCommand");
|
||||||
|
|
||||||
class Help extends BaseCommand {
|
class Help extends BaseCommand {
|
||||||
|
@ -58,7 +58,7 @@ class Help extends BaseCommand {
|
||||||
|
|
||||||
const row = new ActionRowBuilder()
|
const row = new ActionRowBuilder()
|
||||||
.addComponents(
|
.addComponents(
|
||||||
new SelectMenuBuilder()
|
new StringSelectMenuBuilder()
|
||||||
.setCustomId("help_category_select")
|
.setCustomId("help_category_select")
|
||||||
.setPlaceholder(client.translate("common:NOTHING_SELECTED"))
|
.setPlaceholder(client.translate("common:NOTHING_SELECTED"))
|
||||||
.addOptions(categoriesRows),
|
.addOptions(categoriesRows),
|
||||||
|
@ -74,7 +74,7 @@ class Help extends BaseCommand {
|
||||||
const collector = msg.createMessageComponentCollector({ filter, idle: (15 * 1000) });
|
const collector = msg.createMessageComponentCollector({ filter, idle: (15 * 1000) });
|
||||||
|
|
||||||
collector.on("collect", async i => {
|
collector.on("collect", async i => {
|
||||||
if (i.isSelectMenu() && i.customId === "help_category_select") {
|
if (i.isStringSelectMenu() && i.customId === "help_category_select") {
|
||||||
i.deferUpdate();
|
i.deferUpdate();
|
||||||
|
|
||||||
const arg = i?.values[0];
|
const arg = i?.values[0];
|
||||||
|
|
|
@ -69,14 +69,10 @@ class Warn extends BaseCommand {
|
||||||
const banCount = data.guildData.plugins.warnsSanctions.ban;
|
const banCount = data.guildData.plugins.warnsSanctions.ban;
|
||||||
const kickCount = data.guildData.plugins.warnsSanctions.kick;
|
const kickCount = data.guildData.plugins.warnsSanctions.kick;
|
||||||
|
|
||||||
data.guildData.casesCount++;
|
|
||||||
data.guildData.save();
|
|
||||||
|
|
||||||
const caseInfo = {
|
const caseInfo = {
|
||||||
moderator: interaction.member.id,
|
moderator: interaction.member.id,
|
||||||
date: Date.now(),
|
date: Date.now(),
|
||||||
type: "warn",
|
type: "warn",
|
||||||
case: data.guildData.casesCount,
|
|
||||||
reason,
|
reason,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -107,14 +103,16 @@ class Warn extends BaseCommand {
|
||||||
reason,
|
reason,
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
caseInfo.type = "ban";
|
caseInfo.type = "ban";
|
||||||
embed.setAuthor({
|
|
||||||
name: interaction.translate("moderation/ban:CASE", {
|
embed
|
||||||
count: data.guildData.casesCount,
|
.setAuthor({
|
||||||
}),
|
name: interaction.translate("moderation/warn:BAN"),
|
||||||
})
|
})
|
||||||
.setColor(client.config.embed.color);
|
.setColor(client.config.embed.color);
|
||||||
interaction.guild.members.ban(member);
|
|
||||||
|
interaction.guild.members.ban(member).catch(() => {});
|
||||||
interaction.success("moderation/setwarns:AUTO_BAN", {
|
interaction.success("moderation/setwarns:AUTO_BAN", {
|
||||||
username: member.user.tag,
|
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"))}`,
|
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,
|
reason,
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
caseInfo.type = "kick";
|
caseInfo.type = "kick";
|
||||||
embed.setAuthor({
|
|
||||||
name: interaction.translate("moderation/kick:CASE", {
|
embed
|
||||||
count: data.guildData.casesCount,
|
.setAuthor({
|
||||||
}),
|
name: interaction.translate("moderation/warn:KICK"),
|
||||||
})
|
})
|
||||||
.setColor(client.config.embed.color);
|
.setColor(client.config.embed.color);
|
||||||
|
|
||||||
member.kick().catch(() => {});
|
member.kick().catch(() => {});
|
||||||
interaction.success("moderation/setwarns:AUTO_KICK", {
|
interaction.success("moderation/setwarns:AUTO_KICK", {
|
||||||
username: member.user.tag,
|
username: member.user.tag,
|
||||||
|
@ -157,11 +157,11 @@ class Warn extends BaseCommand {
|
||||||
});
|
});
|
||||||
|
|
||||||
caseInfo.type = "warn";
|
caseInfo.type = "warn";
|
||||||
embed.setAuthor({
|
embed
|
||||||
name: interaction.translate("moderation/warn:CASE", {
|
.setAuthor({
|
||||||
caseNumber: data.guildData.casesCount,
|
name: interaction.translate("moderation/warn:WARN"),
|
||||||
}),
|
})
|
||||||
}).setColor(client.config.embed.color);
|
.setColor(client.config.embed.color);
|
||||||
|
|
||||||
submitted.reply({
|
submitted.reply({
|
||||||
content: interaction.translate("moderation/warn:WARNED", {
|
content: interaction.translate("moderation/warn:WARNED", {
|
||||||
|
@ -176,6 +176,7 @@ class Warn extends BaseCommand {
|
||||||
if (data.guildData.plugins.modlogs) {
|
if (data.guildData.plugins.modlogs) {
|
||||||
const channel = interaction.guild.channels.cache.get(data.guildData.plugins.modlogs);
|
const channel = interaction.guild.channels.cache.get(data.guildData.plugins.modlogs);
|
||||||
if (!channel) return;
|
if (!channel) return;
|
||||||
|
|
||||||
channel.send({
|
channel.send({
|
||||||
embeds: [embed],
|
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"),
|
const BaseCommand = require("../../base/BaseCommand"),
|
||||||
fetch = require("node-fetch");
|
fetch = require("node-fetch");
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ class NSFW extends BaseCommand {
|
||||||
|
|
||||||
const row = new ActionRowBuilder()
|
const row = new ActionRowBuilder()
|
||||||
.addComponents(
|
.addComponents(
|
||||||
new SelectMenuBuilder()
|
new StringSelectMenuBuilder()
|
||||||
.setCustomId("nsfw_select")
|
.setCustomId("nsfw_select")
|
||||||
.setPlaceholder(client.translate("common:NOTHING_SELECTED"))
|
.setPlaceholder(client.translate("common:NOTHING_SELECTED"))
|
||||||
.addOptions(tags),
|
.addOptions(tags),
|
||||||
|
@ -62,11 +62,11 @@ class NSFW extends BaseCommand {
|
||||||
const collector = msg.createMessageComponentCollector({ filter, idle: (2 * 60 * 1000) });
|
const collector = msg.createMessageComponentCollector({ filter, idle: (2 * 60 * 1000) });
|
||||||
|
|
||||||
collector.on("collect", async i => {
|
collector.on("collect", async i => {
|
||||||
if (i.isSelectMenu() && i.customId === "nsfw_select") {
|
if (i.isStringSelectMenu() && i.customId === "nsfw_select") {
|
||||||
i.deferUpdate();
|
i.deferUpdate();
|
||||||
|
|
||||||
const tag = i?.values[0];
|
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()
|
const embed = new EmbedBuilder()
|
||||||
.setColor(client.config.embed.color)
|
.setColor(client.config.embed.color)
|
||||||
|
|
|
@ -8,5 +8,7 @@
|
||||||
"MODAL_REASON": "Причина предупреждения",
|
"MODAL_REASON": "Причина предупреждения",
|
||||||
"WARNED_DM": "Вы получили предупреждение на сервере **{{server}}** от пользователя **{{moderator}}** по причине **{{reason}}**",
|
"WARNED_DM": "Вы получили предупреждение на сервере **{{server}}** от пользователя **{{moderator}}** по причине **{{reason}}**",
|
||||||
"WARNED": "**{{user}}** получил предупреждение по причине **{{reason}}**",
|
"WARNED": "**{{user}}** получил предупреждение по причине **{{reason}}**",
|
||||||
"CASE": "Предупрежение | #{{caseNumber}}"
|
"WARN": "Предупрежение",
|
||||||
|
"BAN": "Бан",
|
||||||
|
"KICK": "Кик"
|
||||||
}
|
}
|
|
@ -8,5 +8,7 @@
|
||||||
"MODAL_REASON": "Причина попередження",
|
"MODAL_REASON": "Причина попередження",
|
||||||
"WARNED_DM": "Ви отримали попередження на сервері **{{server}}** від користувача **{{moderator}}** через **{{reason}}**",
|
"WARNED_DM": "Ви отримали попередження на сервері **{{server}}** від користувача **{{moderator}}** через **{{reason}}**",
|
||||||
"WARNED": "**{{user}}** отримав попередження через **{{reason}}**",
|
"WARNED": "**{{user}}** отримав попередження через **{{reason}}**",
|
||||||
"CASE": "Попередження | #{{caseNumber}}"
|
"WARN": "Попередження",
|
||||||
|
"BAN": "Бан",
|
||||||
|
"KICK": "Кик"
|
||||||
}
|
}
|
Loading…
Reference in a new issue