This commit is contained in:
Jonny_Bro (Nikita) 2023-07-03 19:30:47 +05:00
parent f56975d1a8
commit 776be20851
42 changed files with 318 additions and 219 deletions

View file

@ -31,12 +31,18 @@ module.exports = mongoose.model("Guild", new Schema({
ignored: [], ignored: [],
}, },
warnsSanctions: { warnsSanctions: {
kick: false, kick: null,
ban: false, ban: null,
}, },
suggestions: false, monitoring: {
reports: false, memberAdd: null,
birthdays: false, memberLeave: null,
modlogs: false, memberUpdate: null,
messageUpdate: null,
},
suggestions: null,
reports: null,
birthdays: null,
modlogs: null,
} }, } },
})); }));

View file

@ -243,29 +243,24 @@ class JaBa extends Client {
/** /**
* Find or create user in DB * Find or create user in DB
* @param {Array} param0 { id: User ID } * @param {Array} param0 { id: User ID }
* @param {Boolean} isLean Return JSON instead Mongoose model?
* @returns {import("./User")} Mongoose model or JSON of this user * @returns {import("./User")} Mongoose model or JSON of this user
*/ */
async findOrCreateUser({ id: userID }, isLean) { async findOrCreateUser({ id: userID }) {
if (this.databaseCache.users.get(userID)) return isLean ? this.databaseCache.users.get(userID).toJSON() : this.databaseCache.users.get(userID); if (this.databaseCache.users.get(userID)) return this.databaseCache.users.get(userID);
else { else {
let userData = (isLean ? await this.usersData.findOne({ let userData = await this.usersData.findOne({ id: userID });
id: userID,
}).lean() : await this.usersData.findOne({
id: userID,
}));
if (userData) { if (userData) {
if (!isLean) this.databaseCache.users.set(userID, userData); this.databaseCache.users.set(userID, userData);
return userData; return userData;
} else { } else {
userData = new this.usersData({ userData = new this.usersData({ id: userID });
id: userID,
});
await userData.save(); await userData.save();
this.databaseCache.users.set(userID, userData); this.databaseCache.users.set(userID, userData);
return isLean ? userData.toJSON() : userData; return userData;
} }
} }
} }
@ -273,70 +268,53 @@ class JaBa extends Client {
/** /**
* Find or create member in DB * Find or create member in DB
* @param {Array} param0 { id: Member ID } * @param {Array} param0 { id: Member ID }
* @param {Boolean} isLean Return JSON instead Mongoose model?
* @returns {import("./Member")} Mongoose model or JSON of this member * @returns {import("./Member")} Mongoose model or JSON of this member
*/ */
async findOrCreateMember({ id: memberID, guildId }, isLean) { async findOrCreateMember({ id: memberID, guildId }) {
if (this.databaseCache.members.get(`${memberID}${guildId}`)) return isLean ? this.databaseCache.members.get(`${memberID}${guildId}`).toJSON() : this.databaseCache.members.get(`${memberID}${guildId}`); let memberData = await this.membersData.findOne({ guildID: guildId, id: memberID });
else {
let memberData = (isLean ? await this.membersData.findOne({
guildID: guildId,
id: memberID,
}).lean() : await this.membersData.findOne({
guildID: guildId,
id: memberID,
}));
if (memberData) { if (memberData) {
if (!isLean) this.databaseCache.members.set(`${memberID}${guildId}`, memberData); this.databaseCache.members.set(`${memberID}${guildId}`, memberData);
return memberData; return memberData;
} else { } else {
memberData = new this.membersData({ memberData = new this.membersData({ id: memberID, guildID: guildId });
id: memberID,
guildID: guildId,
});
await memberData.save(); await memberData.save();
const guild = await this.findOrCreateGuild({
id: guildId, const guildData = await this.findOrCreateGuild({ id: guildId });
});
if (guild) { if (guildData) {
guild.members.push(memberData._id); guildData.members.push(memberData._id);
await guild.save(); guildData.markModified("members");
await guildData.save();
} }
this.databaseCache.members.set(`${memberID}${guildId}`, memberData); this.databaseCache.members.set(`${memberID}${guildId}`, memberData);
return isLean ? memberData.toJSON() : memberData; return memberData;
}
} }
} }
/** /**
* Find or create guild in DB * Find or create guild in DB
* @param {Array} param0 { id: Guild ID } * @param {Array} param0 { id: Guild ID }
* @param {Boolean} isLean Return JSON instead Mongoose model?
* @returns {import("./Guild")} Mongoose model or JSON of this guild * @returns {import("./Guild")} Mongoose model or JSON of this guild
*/ */
async findOrCreateGuild({ id: guildId }, isLean) { async findOrCreateGuild({ id: guildId }) {
if (this.databaseCache.guilds.get(guildId)) return isLean ? this.databaseCache.guilds.get(guildId).toJSON() : this.databaseCache.guilds.get(guildId); let guildData = await this.guildsData.findOne({ id: guildId }).populate("members");
else {
let guildData = (isLean ? await this.guildsData.findOne({
id: guildId,
}).populate("members").lean() : await this.guildsData.findOne({
id: guildId,
}).populate("members"));
if (guildData) { if (guildData) {
if (!isLean) this.databaseCache.guilds.set(guildId, guildData); this.databaseCache.guilds.set(guildId, guildData);
return guildData; return guildData;
} else { } else {
guildData = new this.guildsData({ guildData = new this.guildsData({ id: guildId });
id: guildId,
});
await guildData.save(); await guildData.save();
this.databaseCache.guilds.set(guildId, guildData); this.databaseCache.guilds.set(guildId, guildData);
return isLean ? guildData.toJSON() : guildData; return guildData;
}
} }
} }
} }

View file

@ -38,6 +38,7 @@ class ImportMee6 extends BaseCommand {
const level = (await Mee6Api.getUserXp(interaction.guildId, interaction.member)).level; const level = (await Mee6Api.getUserXp(interaction.guildId, interaction.member)).level;
data.memberData.level = level; data.memberData.level = level;
data.markModified("memberData.level");
await data.memberData.save(); await data.memberData.save();
interaction.editReply({ interaction.editReply({

View file

@ -41,6 +41,7 @@ class Config extends BaseCommand {
{ name: client.translate("administration/config:MODLOGS"), value: "modlogs" }, { name: client.translate("administration/config:MODLOGS"), value: "modlogs" },
{ name: client.translate("administration/config:REPORTS"), value: "reports" }, { name: client.translate("administration/config:REPORTS"), value: "reports" },
{ name: client.translate("administration/config:SUGGESTIONS"), value: "suggestions" }, { name: client.translate("administration/config:SUGGESTIONS"), value: "suggestions" },
{ name: client.translate("administration/config:MESSAGEUPDATE"), value: "monitoring.messageUpdate" },
) )
.setRequired(true)) .setRequired(true))
.addBooleanOption(option => option.setName("state") .addBooleanOption(option => option.setName("state")
@ -126,20 +127,18 @@ class Config extends BaseCommand {
channels: guildData.plugins.automod.ignored.map(ch => ` ${ch}`), channels: guildData.plugins.automod.ignored.map(ch => ` ${ch}`),
}) : interaction.translate("common:DISABLED"), }) : interaction.translate("common:DISABLED"),
}, },
{
name: interaction.translate("administration/config:MONITORING_CHANNELS"),
value:
`${interaction.translate("administration/config:MESSAGEUPDATE")}: ${guildData.plugins.monitoring.messageUpdate ? `<#${guildData.plugins.monitoring.messageUpdate}>` : `*${interaction.translate("common:NOT_DEFINED")}*`}\n`,
},
{ {
name: interaction.translate("administration/config:SPECIAL_CHANNELS"), name: interaction.translate("administration/config:SPECIAL_CHANNELS"),
value: interaction.translate("administration/config:SUGGESTIONS_LIST", { value:
channel: guildData.plugins.suggestions ? `<#${guildData.plugins.suggestions}>` : `*${interaction.translate("common:NOT_DEFINED")}*`, `${interaction.translate("administration/config:SUGGESTIONS")}: ${guildData.plugins.suggestions ? `<#${guildData.plugins.suggestions}>` : `*${interaction.translate("common:NOT_DEFINED")}*`}\n` +
}) + "\n" + `${interaction.translate("administration/config:REPORTS")}: ${guildData.plugins.reports ? `<#${guildData.plugins.reports}>` : `*${interaction.translate("common:NOT_DEFINED")}*`}\n` +
interaction.translate("administration/config:REPORTS_LIST", { `${interaction.translate("administration/config:MODLOGS")}: ${guildData.plugins.modlogs ? `<#${guildData.plugins.modlogs}>` : `*${interaction.translate("common:NOT_DEFINED")}*`}\n` +
channel: guildData.plugins.reports ? `<#${guildData.plugins.reports}>` : `*${interaction.translate("common:NOT_DEFINED")}*`, `${interaction.translate("administration/config:BIRTHDAYS")}: ${guildData.plugins.birthdays ? `<#${guildData.plugins.birthdays}>` : `*${interaction.translate("common:NOT_DEFINED")}*`}`,
}) + "\n" +
interaction.translate("administration/config:MODLOGS_LIST", {
channel: guildData.plugins.modlogs ? `<#${guildData.plugins.modlogs}>` : `*${interaction.translate("common:NOT_DEFINED")}*`,
}) + "\n" +
interaction.translate("administration/config:BIRTHDAYS_LIST", {
channel: guildData.plugins.birthdays ? `<#${guildData.plugins.birthdays}>` : `*${interaction.translate("common:NOT_DEFINED")}*`,
}),
}, },
{ {
name: interaction.translate("administration/config:DASHBOARD_TITLE"), name: interaction.translate("administration/config:DASHBOARD_TITLE"),

View file

@ -78,7 +78,9 @@ class Set extends BaseCommand {
switch (type) { switch (type) {
case "level": { case "level": {
memberData.level = int; memberData.level = int;
memberData.markModified("level");
await memberData.save(); await memberData.save();
return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, { return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, {
user: member.toString(), user: member.toString(),
amount: int, amount: int,
@ -87,7 +89,9 @@ class Set extends BaseCommand {
case "xp": { case "xp": {
memberData.exp = int; memberData.exp = int;
memberData.markModified("exp");
await memberData.save(); await memberData.save();
return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, { return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, {
user: member.toString(), user: member.toString(),
amount: int, amount: int,
@ -96,7 +100,9 @@ class Set extends BaseCommand {
case "credits": { case "credits": {
memberData.money = int; memberData.money = int;
memberData.markModified("money");
await memberData.save(); await memberData.save();
return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, { return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, {
user: member.toString(), user: member.toString(),
amount: int, amount: int,
@ -105,7 +111,9 @@ class Set extends BaseCommand {
case "bank": { case "bank": {
memberData.bankSold = int; memberData.bankSold = int;
memberData.markModified("bankSold");
await memberData.save(); await memberData.save();
return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, { return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, {
user: member.toString(), user: member.toString(),
amount: int, amount: int,

View file

@ -52,6 +52,7 @@ class Setlang extends BaseCommand {
language = client.languages.find(l => l.name === lang); language = client.languages.find(l => l.name === lang);
data.guildData.language = language.name; data.guildData.language = language.name;
data.guildData.markModified("language");
await data.guildData.save(); await data.guildData.save();
return interaction.success("administration/setlang:SUCCESS", { return interaction.success("administration/setlang:SUCCESS", {

View file

@ -62,6 +62,8 @@ class Bank extends BaseCommand {
data.memberData.money -= credits; data.memberData.money -= credits;
data.memberData.bankSold += credits; data.memberData.bankSold += credits;
data.memberData.markModified("money");
data.memberData.markModified("bankSold");
await data.memberData.save(); await data.memberData.save();
const info = { const info = {
@ -91,6 +93,8 @@ class Bank extends BaseCommand {
data.memberData.money += credits; data.memberData.money += credits;
data.memberData.bankSold -= credits; data.memberData.bankSold -= credits;
data.memberData.markModified("money");
data.memberData.markModified("bankSold");
await data.memberData.save(); await data.memberData.save();
interaction.success("economy/bank:SUCCESS_WD", { interaction.success("economy/bank:SUCCESS_WD", {

View file

@ -80,6 +80,7 @@ class Birthdate extends BaseCommand {
if (d.getTime() < (Date.now() - 2.523e+12)) return interaction.error("economy/birthdate:DATE_TOO_LOW"); if (d.getTime() < (Date.now() - 2.523e+12)) return interaction.error("economy/birthdate:DATE_TOO_LOW");
data.userData.birthdate = d; data.userData.birthdate = d;
data.userData.markModified("birthdate");
await data.userData.save(); await data.userData.save();
interaction.success("economy/birthdate:SUCCESS", { interaction.success("economy/birthdate:SUCCESS", {

View file

@ -39,12 +39,14 @@ class Divorce extends BaseCommand {
const user = client.users.cache.get(data.userData.lover) || await client.users.fetch(data.userData.lover); const user = client.users.cache.get(data.userData.lover) || await client.users.fetch(data.userData.lover);
data.userData.lover = null; data.userData.lover = null;
data.user.markModified("lover");
await data.userData.save(); await data.userData.save();
const oldLover = await client.findOrCreateUser({ const oldLover = await client.findOrCreateUser({
id: user.id, id: user.id,
}); });
oldLover.lover = null; oldLover.lover = null;
oldLover.markModified("lover");
await oldLover.save(); await oldLover.save();
interaction.success("economy/divorce:DIVORCED", { interaction.success("economy/divorce:DIVORCED", {

View file

@ -128,8 +128,11 @@ class Marry extends BaseCommand {
if (reason) { if (reason) {
data.userData.lover = member.id; data.userData.lover = member.id;
await data.userData.save();
userData.lover = interaction.member.id; userData.lover = interaction.member.id;
data.userData.markModified("lover");
await data.userData.save();
userData.markModified("lover");
await userData.save(); await userData.save();
const messageOptions = { const messageOptions = {

View file

@ -65,9 +65,11 @@ class Pay extends BaseCommand {
}); });
data.memberData.money -= amount; data.memberData.money -= amount;
data.memberData.markModified("money");
await data.memberData.save(); await data.memberData.save();
memberData.money += amount; memberData.money += amount;
memberData.markModified("money");
await memberData.save(); await memberData.save();
const info1 = { const info1 = {

View file

@ -91,8 +91,11 @@ class Rob extends BaseCommand {
data.memberData.money += amount; data.memberData.money += amount;
memberData.money -= amount; memberData.money -= amount;
await memberData.save(); data.memberData.markModified("money");
memberData.markModified("money");
await data.memberData.save(); await data.memberData.save();
await memberData.save();
} else { } else {
const won = Math.floor(amount * 0.9), const won = Math.floor(amount * 0.9),
randomNum = client.functions.randomNum(1, 2); randomNum = client.functions.randomNum(1, 2);
@ -106,8 +109,11 @@ class Rob extends BaseCommand {
data.memberData.money -= potentiallyLose; data.memberData.money -= potentiallyLose;
memberData.money += won; memberData.money += won;
await memberData.save(); data.memberData.markModified("money");
memberData.markModified("money");
await data.memberData.save(); await data.memberData.save();
await memberData.save();
} }
} }
} }

View file

@ -46,7 +46,9 @@ class Setbio extends BaseCommand {
if (newBio.length > 150) return interaction.error("economy/setbio:MAX_CHARACTERS"); if (newBio.length > 150) return interaction.error("economy/setbio:MAX_CHARACTERS");
data.userData.bio = newBio; data.userData.bio = newBio;
data.memberData.markModified("bio");
await data.userData.save(); await data.userData.save();
interaction.success("economy/setbio:SUCCESS"); interaction.success("economy/setbio:SUCCESS");
} }
} }

View file

@ -109,16 +109,19 @@ class Slots extends BaseCommand {
const toAdd = credits - amount; const toAdd = credits - amount;
data.memberData.money += toAdd;
const info = { const info = {
user: interaction.translate("economy/slots:DESCRIPTION"), user: interaction.translate("economy/slots:DESCRIPTION"),
amount: toAdd, amount: toAdd,
date: Date.now(), date: Date.now(),
type: "got", type: "got",
}; };
data.memberData.money += toAdd;
data.memberData.transactions.push(info); data.memberData.transactions.push(info);
data.memberData.markModified("money");
data.memberData.markModified("transactions");
if (!data.userData.achievements.slots.achieved) { if (!data.userData.achievements.slots.achieved) {
data.userData.achievements.slots.progress.now += 1; data.userData.achievements.slots.progress.now += 1;
if (data.userData.achievements.slots.progress.now === data.userData.achievements.slots.progress.total) { if (data.userData.achievements.slots.progress.now === data.userData.achievements.slots.progress.total) {
@ -134,6 +137,7 @@ class Slots extends BaseCommand {
await data.userData.save(); await data.userData.save();
} }
await data.memberData.save(); await data.memberData.save();
return; return;
} }
@ -159,8 +163,12 @@ class Slots extends BaseCommand {
date: Date.now(), date: Date.now(),
type: "got", type: "got",
}; };
data.memberData.transactions.push(info);
data.memberData.money += toAdd; data.memberData.money += toAdd;
data.memberData.transactions.push(info);
data.memberData.markModified("money");
data.memberData.markModified("transactions");
if (!data.userData.achievements.slots.achieved) { if (!data.userData.achievements.slots.achieved) {
data.userData.achievements.slots.progress.now += 1; data.userData.achievements.slots.progress.now += 1;
@ -194,8 +202,12 @@ class Slots extends BaseCommand {
date: Date.now(), date: Date.now(),
type: "send", type: "send",
}; };
data.memberData.transactions.push(info);
data.memberData.money -= amount; data.memberData.money -= amount;
data.memberData.transactions.push(info);
data.memberData.markModified("money");
data.memberData.markModified("transactions");
if (!data.userData.achievements.slots.achieved) { if (!data.userData.achievements.slots.achieved) {
data.userData.achievements.slots.progress.now = 0; data.userData.achievements.slots.progress.now = 0;

View file

@ -43,6 +43,7 @@ class Transactions extends BaseCommand {
async execute(client, interaction, data) { async execute(client, interaction, data) {
if (interaction.options.getBoolean("clear")) { if (interaction.options.getBoolean("clear")) {
data.memberData.transactions = []; data.memberData.transactions = [];
data.memberData.markModified("transactions");
await data.memberData.save(); await data.memberData.save();
return interaction.success("economy/transactions:CLEARED", null, { ephemeral: true }); return interaction.success("economy/transactions:CLEARED", null, { ephemeral: true });

View file

@ -103,6 +103,7 @@ class Work extends BaseCommand {
} }
data.memberData.money += won; data.memberData.money += won;
data.memberData.markModified("money");
await data.memberData.save(); await data.memberData.save();
const info = { const info = {

View file

@ -96,6 +96,7 @@ class Number extends BaseCommand {
}; };
data.memberData.transactions.push(info); data.memberData.transactions.push(info);
data.memberData.markModified("transactions");
await memberData.save(); await memberData.save();
} }
collector.stop(); collector.stop();

View file

@ -54,6 +54,7 @@ class TicTacToe extends BaseCommand {
}); });
memberData.money += 100; memberData.money += 100;
memberData.markModified("money");
await memberData.save(); await memberData.save();
const info = { const info = {

View file

@ -47,6 +47,7 @@ class Afk extends BaseCommand {
const reason = interaction.options.getString("message"); const reason = interaction.options.getString("message");
data.userData.afk = reason; data.userData.afk = reason;
data.userData.markModified("afk");
await data.userData.save(); await data.userData.save();
interaction.success("general/afk:SUCCESS", { interaction.success("general/afk:SUCCESS", {

View file

@ -51,6 +51,7 @@ class Clearwarns extends BaseCommand {
}); });
memberData.sanctions = []; memberData.sanctions = [];
memberData.markModified("sanctions");
memberData.save(); memberData.save();
interaction.success("moderation/clearwarns:SUCCESS", { interaction.success("moderation/clearwarns:SUCCESS", {

View file

@ -178,6 +178,7 @@ class Warn extends BaseCommand {
.setColor(client.config.embed.color); .setColor(client.config.embed.color);
memberData.sanctions.push(caseInfo); memberData.sanctions.push(caseInfo);
memberData.markModified("sanctions");
memberData.save(); memberData.save();
if (data.guildData.plugins.modlogs) { if (data.guildData.plugins.modlogs) {

View file

@ -126,7 +126,9 @@ class Debug extends BaseCommand {
switch (type) { switch (type) {
case "level": { case "level": {
memberData.level = int; memberData.level = int;
memberData.markModified("level");
await memberData.save(); await memberData.save();
return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, { return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, {
user: member.toString(), user: member.toString(),
amount: int, amount: int,
@ -135,7 +137,9 @@ class Debug extends BaseCommand {
case "xp": { case "xp": {
memberData.exp = int; memberData.exp = int;
memberData.markModified("exp");
await memberData.save(); await memberData.save();
return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, { return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, {
user: member.toString(), user: member.toString(),
amount: int, amount: int,
@ -144,7 +148,9 @@ class Debug extends BaseCommand {
case "credits": { case "credits": {
memberData.money = int; memberData.money = int;
memberData.markModified("money");
await memberData.save(); await memberData.save();
return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, { return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, {
user: member.toString(), user: member.toString(),
amount: int, amount: int,
@ -153,7 +159,9 @@ class Debug extends BaseCommand {
case "bank": { case "bank": {
memberData.bankSold = int; memberData.bankSold = int;
memberData.markModified("bankSold");
await memberData.save(); await memberData.save();
return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, { return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, {
user: member.toString(), user: member.toString(),
amount: int, amount: int,
@ -162,7 +170,9 @@ class Debug extends BaseCommand {
case "rep": { case "rep": {
userData.rep = int; userData.rep = int;
userData.markModified("rep");
await userData.save(); await userData.save();
return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, { return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, {
user: member.toString(), user: member.toString(),
amount: int, amount: int,
@ -187,7 +197,9 @@ class Debug extends BaseCommand {
switch (type) { switch (type) {
case "level": { case "level": {
memberData.level += int; memberData.level += int;
memberData.markModified("level");
await memberData.save(); await memberData.save();
return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, { return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, {
user: member.toString(), user: member.toString(),
amount: int, amount: int,
@ -196,7 +208,9 @@ class Debug extends BaseCommand {
case "xp": { case "xp": {
memberData.exp += int; memberData.exp += int;
memberData.markModified("exp");
await memberData.save(); await memberData.save();
return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, { return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, {
user: member.toString(), user: member.toString(),
amount: int, amount: int,
@ -205,7 +219,9 @@ class Debug extends BaseCommand {
case "credits": { case "credits": {
memberData.money += int; memberData.money += int;
memberData.markModified("money");
await memberData.save(); await memberData.save();
return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, { return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, {
user: member.toString(), user: member.toString(),
amount: int, amount: int,
@ -214,7 +230,9 @@ class Debug extends BaseCommand {
case "bank": { case "bank": {
memberData.bankSold += int; memberData.bankSold += int;
memberData.markModified("bankSold");
await memberData.save(); await memberData.save();
return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, { return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, {
user: member.toString(), user: member.toString(),
amount: int, amount: int,
@ -223,7 +241,9 @@ class Debug extends BaseCommand {
case "rep": { case "rep": {
userData.rep += int; userData.rep += int;
userData.markModified("rep");
await userData.save(); await userData.save();
return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, { return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, {
user: member.toString(), user: member.toString(),
amount: int, amount: int,

View file

@ -49,7 +49,7 @@ class Eval extends BaseCommand {
const result = new Promise(resolve => resolve(eval(code))); const result = new Promise(resolve => resolve(eval(code)));
return result.then(output => { return result.then(output => {
if (typeof output != "string") output = require("util").inspect(output, { depth: 0 }); if (typeof output !== "string") output = require("util").inspect(output);
if (output.includes(client.token)) output = output.replace(client.token, "T0K3N"); if (output.includes(client.token)) output = output.replace(client.token, "T0K3N");
interaction.editReply({ interaction.editReply({

View file

@ -240,6 +240,7 @@ module.exports.load = async client => {
}); });
guildData.language = newData; guildData.language = newData;
guildData.markModified("language");
await guildData.save(); await guildData.save();
return; return;
@ -268,6 +269,7 @@ module.exports.load = async client => {
}); });
guildData.plugins.welcome.enabled = newData; guildData.plugins.welcome.enabled = newData;
guildData.markModified("plugins.welcome");
await guildData.save(); await guildData.save();
return; return;
@ -291,6 +293,7 @@ module.exports.load = async client => {
}); });
guildData.plugins.welcome.withImage = newData; guildData.plugins.welcome.withImage = newData;
guildData.markModified("plugins.welcome");
await guildData.save(); await guildData.save();
return; return;
@ -314,6 +317,7 @@ module.exports.load = async client => {
}); });
guildData.plugins.welcome.message = newData !== "" ? newData : null; guildData.plugins.welcome.message = newData !== "" ? newData : null;
guildData.markModified("plugins.welcome");
await guildData.save(); await guildData.save();
return; return;
@ -337,6 +341,7 @@ module.exports.load = async client => {
}); });
guildData.plugins.welcome.channel = newData !== "" ? newData : null; guildData.plugins.welcome.channel = newData !== "" ? newData : null;
guildData.markModified("plugins.welcome");
await guildData.save(); await guildData.save();
return; return;
@ -367,6 +372,7 @@ module.exports.load = async client => {
}); });
guildData.plugins.goodbye.enabled = newData; guildData.plugins.goodbye.enabled = newData;
guildData.markModified("plugins.goodbye");
await guildData.save(); await guildData.save();
return; return;
@ -390,6 +396,7 @@ module.exports.load = async client => {
}); });
guildData.plugins.goodbye.withImage = newData; guildData.plugins.goodbye.withImage = newData;
guildData.markModified("plugins.goodbye");
await guildData.save(); await guildData.save();
return; return;
@ -413,6 +420,7 @@ module.exports.load = async client => {
}); });
guildData.plugins.goodbye.message = newData !== "" ? newData : null; guildData.plugins.goodbye.message = newData !== "" ? newData : null;
guildData.markModified("plugins.goodbye");
await guildData.save(); await guildData.save();
return; return;
@ -436,6 +444,7 @@ module.exports.load = async client => {
}); });
guildData.plugins.goodbye.channel = newData !== "" ? newData : null; guildData.plugins.goodbye.channel = newData !== "" ? newData : null;
guildData.markModified("plugins.goodbye");
await guildData.save(); await guildData.save();
return; return;
@ -466,6 +475,7 @@ module.exports.load = async client => {
}); });
guildData.plugins.autorole.enabled = newData; guildData.plugins.autorole.enabled = newData;
guildData.markModified("plugins.autorole");
await guildData.save(); await guildData.save();
return; return;
@ -489,6 +499,7 @@ module.exports.load = async client => {
}); });
guildData.plugins.autorole.role = newData !== "" ? newData : null; guildData.plugins.autorole.role = newData !== "" ? newData : null;
guildData.markModified("plugins.autorole");
await guildData.save(); await guildData.save();
return; return;
@ -519,6 +530,7 @@ module.exports.load = async client => {
}); });
guildData.plugins.automod.enabled = newData; guildData.plugins.automod.enabled = newData;
guildData.markModified("plugins.automod");
await guildData.save(); await guildData.save();
return; return;
@ -526,8 +538,8 @@ module.exports.load = async client => {
}, },
{ {
optionId: "automod_ignore", optionId: "automod_ignore",
optionName: "Ignore channels", optionName: "Ignore Channels",
optionDescription: "Select channels for auto mod to ignore", optionDescription: "Select a channels for auto mod to ignore",
optionType: DBD.formTypes.channelsMultiSelect(false, false, [ ChannelType.GuildText ]), optionType: DBD.formTypes.channelsMultiSelect(false, false, [ ChannelType.GuildText ]),
getActualSet: async ({ guild }) => { getActualSet: async ({ guild }) => {
const guildData = await client.findOrCreateGuild({ const guildData = await client.findOrCreateGuild({
@ -542,6 +554,38 @@ module.exports.load = async client => {
}); });
guildData.plugins.automod.ignored = newData; guildData.plugins.automod.ignored = newData;
guildData.markModified("plugins.automod");
await guildData.save();
return;
},
},
]),
},
{
optionId: "monitoring",
optionName: "Monitoring Channels",
optionDescription: "Setup monitoring channels on the server",
optionType: SoftUI.formTypes.multiRow([
{
optionId: "monitoring_messageupdate",
optionName: "Message Update Channel",
optionDescription: "Select a channel for messages updates logs to go to",
optionType: DBD.formTypes.channelsSelect(false, [ ChannelType.GuildText ]),
getActualSet: async ({ guild }) => {
const guildData = await client.findOrCreateGuild({
id: guild.id,
});
return guildData.plugins.monitoring.messageUpdate;
},
setNew: async ({ guild, newData }) => {
const guildData = await client.findOrCreateGuild({
id: guild.id,
});
guildData.plugins.monitoring.messageUpdate = newData !== "" ? newData : null;
guildData.markModified("plugins.monitoring");
await guildData.save(); await guildData.save();
return; return;
@ -556,8 +600,8 @@ module.exports.load = async client => {
optionType: SoftUI.formTypes.multiRow([ optionType: SoftUI.formTypes.multiRow([
{ {
optionId: "channels_suggestions", optionId: "channels_suggestions",
optionName: "Suggestions channel", optionName: "Suggestions Channel",
optionDescription: "Select channel for suggestions to go to", optionDescription: "Select a channel for suggestions to go to",
optionType: DBD.formTypes.channelsSelect(false, [ ChannelType.GuildText ]), optionType: DBD.formTypes.channelsSelect(false, [ ChannelType.GuildText ]),
getActualSet: async ({ guild }) => { getActualSet: async ({ guild }) => {
const guildData = await client.findOrCreateGuild({ const guildData = await client.findOrCreateGuild({
@ -571,7 +615,8 @@ module.exports.load = async client => {
id: guild.id, id: guild.id,
}); });
guildData.plugins.suggestions = newData; guildData.plugins.suggestions = newData !== "" ? newData : null;
guildData.markModified("plugins.suggestions");
await guildData.save(); await guildData.save();
return; return;
@ -579,8 +624,8 @@ module.exports.load = async client => {
}, },
{ {
optionId: "channels_reports", optionId: "channels_reports",
optionName: "Reports channel", optionName: "Reports Channel",
optionDescription: "Select channel for reports to go to", optionDescription: "Select a channel for reports to go to",
optionType: DBD.formTypes.channelsSelect(false, [ ChannelType.GuildText ]), optionType: DBD.formTypes.channelsSelect(false, [ ChannelType.GuildText ]),
getActualSet: async ({ guild }) => { getActualSet: async ({ guild }) => {
const guildData = await client.findOrCreateGuild({ const guildData = await client.findOrCreateGuild({
@ -594,7 +639,8 @@ module.exports.load = async client => {
id: guild.id, id: guild.id,
}); });
guildData.plugins.reports = newData; guildData.plugins.reports = newData !== "" ? newData : null;
guildData.markModified("plugins.reports");
await guildData.save(); await guildData.save();
return; return;
@ -602,8 +648,8 @@ module.exports.load = async client => {
}, },
{ {
optionId: "channels_birthdays", optionId: "channels_birthdays",
optionName: "Birthdays channel", optionName: "Birthdays Channel",
optionDescription: "Select channel for birthdays message to go to", optionDescription: "Select a channel for birthdays message to go to",
optionType: DBD.formTypes.channelsSelect(false, [ ChannelType.GuildText ]), optionType: DBD.formTypes.channelsSelect(false, [ ChannelType.GuildText ]),
getActualSet: async ({ guild }) => { getActualSet: async ({ guild }) => {
const guildData = await client.findOrCreateGuild({ const guildData = await client.findOrCreateGuild({
@ -617,7 +663,8 @@ module.exports.load = async client => {
id: guild.id, id: guild.id,
}); });
guildData.plugins.birthdays = newData; guildData.plugins.birthdays = newData !== "" ? newData : null;
guildData.markModified("plugins.birthdays");
await guildData.save(); await guildData.save();
return; return;
@ -625,8 +672,8 @@ module.exports.load = async client => {
}, },
{ {
optionId: "channels_modlogs", optionId: "channels_modlogs",
optionName: "Moderation logs channel", optionName: "Moderation Logs Channel",
optionDescription: "Select channel for moderation logs to go to (warns)", optionDescription: "Select a channel for moderation logs to go to (warns)",
optionType: DBD.formTypes.channelsSelect(false, [ ChannelType.GuildText ]), optionType: DBD.formTypes.channelsSelect(false, [ ChannelType.GuildText ]),
getActualSet: async ({ guild }) => { getActualSet: async ({ guild }) => {
const guildData = await client.findOrCreateGuild({ const guildData = await client.findOrCreateGuild({
@ -640,7 +687,8 @@ module.exports.load = async client => {
id: guild.id, id: guild.id,
}); });
guildData.plugins.modlogs = newData; guildData.plugins.modlogs = newData !== "" ? newData : null;
guildData.markModified("plugins.modlogs");
await guildData.save(); await guildData.save();
return; return;
@ -661,11 +709,6 @@ module.exports.load = async client => {
username: "JaBa", username: "JaBa",
avatarURL: "https://cdn.discordapp.com/avatars/708637495054565426/af98d49ebc9bf28b40b45ed5a0a623b4.png?size=4096", avatarURL: "https://cdn.discordapp.com/avatars/708637495054565426/af98d49ebc9bf28b40b45ed5a0a623b4.png?size=4096",
}), }),
setNew: async ({ guild, user, newData }) => {
console.log(guild);
console.log(user);
console.log(newData);
},
}, },
], ],
}, },

View file

@ -1,3 +1,11 @@
### JaBa v4.3.1
* Добавлено
* Мониторинг изменения сообщений!\
Скоро добавлю другие эвенты, по типу входа, выхода, обновление участника.
* Исправления
* Серьёзная ошибка, из-за которой данные не сохранялись в базу данных 🤯.
### JaBa v4.3.0 ### JaBa v4.3.0
* Добавлено * Добавлено
* Полностью переделанная панель управления!\ * Полностью переделанная панель управления!\
@ -53,7 +61,7 @@
* *seek* теперь работает нормально. * *seek* теперь работает нормально.
* Переписана команда *clips*. * Переписана команда *clips*.
* Исправление * Исправления
* Старые баги. * Старые баги.
* Добавлено * Добавлено

View file

@ -29,8 +29,7 @@ class CommandHandler extends BaseEvent {
data.memberData = memberData; data.memberData = memberData;
} }
if (interaction.isAutocomplete()) if (interaction.isAutocomplete()) return await command.autocompleteRun(client, interaction);
return await command.autocompleteRun(client, interaction);
if (interaction.type !== InteractionType.ApplicationCommand && !interaction.isCommand()) return; if (interaction.type !== InteractionType.ApplicationCommand && !interaction.isCommand()) return;
if (command.ownerOnly && interaction.user.id !== client.config.owner.id) return interaction.error("misc:OWNER_ONLY", null, { ephemeral: true }); if (command.ownerOnly && interaction.user.id !== client.config.owner.id) return interaction.error("misc:OWNER_ONLY", null, { ephemeral: true });

View file

@ -17,11 +17,12 @@ class guildBanAdd extends BaseEvent {
async execute(client, ban) { async execute(client, ban) {
const embed = new EmbedBuilder() const embed = new EmbedBuilder()
.setAuthor({ .setAuthor({
name: client.user.username, name: client.user.getUsername(),
iconURL: ban.guild.iconURL(), iconURL: ban.guild.iconURL(),
}) })
.setColor("#FF0000") .setColor(client.config.embed.color)
.setDescription(`Вы были забанены на **${ban.guild.name}** по причине **${ban.reason || "Не указана"}**`); .setFooter({ text: client.config.embed.footer })
.setDescription(`You were banned from **${ban.guild.name}**!\nReason: **${ban.reason || "Not specified"}**`);
ban.user.send({ ban.user.send({
embeds: [embed], embeds: [embed],

View file

@ -54,7 +54,8 @@ class GuildCreate extends BaseEvent {
name: guild.name, name: guild.name,
iconURL: guild.iconURL(), iconURL: guild.iconURL(),
}) })
.setColor("#32CD32") .setColor(client.config.embed.color)
.setFooter({ text: client.config.embed.footer })
.setDescription(`Зашёл на сервер **${guild.name}**. На нём **${users}** ${client.functions.getNoun(users, client.translate("misc:NOUNS:USERS:1"), client.translate("misc:NOUNS:USERS:2"), client.translate("misc:NOUNS:USERS:5"))} и **${bots}** ${client.functions.getNoun(bots, client.translate("misc:NOUNS:BOTS:1"), client.translate("misc:NOUNS:BOTS:2"), client.translate("misc:NOUNS:BOTS:5"))}`); .setDescription(`Зашёл на сервер **${guild.name}**. На нём **${users}** ${client.functions.getNoun(users, client.translate("misc:NOUNS:USERS:1"), client.translate("misc:NOUNS:USERS:2"), client.translate("misc:NOUNS:USERS:5"))} и **${bots}** ${client.functions.getNoun(bots, client.translate("misc:NOUNS:BOTS:1"), client.translate("misc:NOUNS:BOTS:2"), client.translate("misc:NOUNS:BOTS:5"))}`);
client.channels.cache.get(client.config.support.logs).send({ client.channels.cache.get(client.config.support.logs).send({
embeds: [embed], embeds: [embed],

View file

@ -20,7 +20,8 @@ class GuildDelete extends BaseEvent {
name: guild.name, name: guild.name,
iconURL: guild.iconURL(), iconURL: guild.iconURL(),
}) })
.setColor("#FF0000") .setColor(client.config.embed.color)
.setFooter({ text: client.config.embed.footer })
.setDescription(`Вышел с сервера **${guild.name}**.`); .setDescription(`Вышел с сервера **${guild.name}**.`);
client.channels.cache.get(client.config.support.logs).send({ client.channels.cache.get(client.config.support.logs).send({
embeds: [embed], embeds: [embed],

View file

@ -28,12 +28,12 @@ class GuildMemberAdd extends BaseEvent {
* @param {import("discord.js").GuildMember} member * @param {import("discord.js").GuildMember} member
*/ */
async execute(client, member) { async execute(client, member) {
if (member.guild && member.guild.id === "568120814776614924") return; if (member.guild && member.guildId === "568120814776614924") return;
await member.guild.members.fetch(); await member.guild.members.fetch();
const guildData = await client.findOrCreateGuild({ const guildData = await client.findOrCreateGuild({
id: member.guild.id, id: member.guildId,
}); });
if (guildData.plugins.autorole.enabled) member.roles.add(guildData.plugins.autorole.role); if (guildData.plugins.autorole.enabled) member.roles.add(guildData.plugins.autorole.role);

View file

@ -28,12 +28,12 @@ class GuildMemberRemove extends BaseEvent {
* @param {import("discord.js").GuildMember} member * @param {import("discord.js").GuildMember} member
*/ */
async execute(client, member) { async execute(client, member) {
if (member.guild && member.guild.id === "568120814776614924") return; if (member.guild && member.guildId === "568120814776614924") return;
await member.guild.members.fetch(); await member.guild.members.fetch();
const guildData = await client.findOrCreateGuild({ const guildData = await client.findOrCreateGuild({
id: member.guild.id, id: member.guildId,
}); });
if (guildData.plugins.goodbye.enabled) { if (guildData.plugins.goodbye.enabled) {

View file

@ -15,8 +15,8 @@ class GuildMemberUpdate extends BaseEvent {
* @param {import("discord.js").GuildMember} newMember * @param {import("discord.js").GuildMember} newMember
*/ */
async execute(client, oldMember, newMember) { async execute(client, oldMember, newMember) {
if (oldMember.guild && oldMember.guild.id === "568120814776614924") return; if (oldMember.guild && oldMember.guildId === "568120814776614924") return;
if (oldMember.guild.id !== client.config.support.id) return; if (oldMember.guildId !== client.config.support.id) return;
if (oldMember.roles.cache.some(r => r.id === "940149470975365191")) return; if (oldMember.roles.cache.some(r => r.id === "940149470975365191")) return;
if (newMember?.roles.cache.some(r => r.id === "940149470975365191")) { if (newMember?.roles.cache.some(r => r.id === "940149470975365191")) {

View file

@ -105,7 +105,9 @@ class MessageCreate extends BaseEvent {
const afkReason = data.userData.afk; const afkReason = data.userData.afk;
if (afkReason) { if (afkReason) {
data.userData.afk = null; data.userData.afk = null;
data.userData.markModified("afk");
await data.userData.save(); await data.userData.save();
message.replyT("general/afk:DELETED", { message.replyT("general/afk:DELETED", {
user: message.author.username, user: message.author.username,
}, { mention: true }); }, { mention: true });
@ -154,6 +156,9 @@ async function updateXp(client, msg, memberData) {
}, { mention: false }); }, { mention: false });
} else memberData.exp = parseInt(newXp, 10); } else memberData.exp = parseInt(newXp, 10);
memberData.markModified("exp");
memberData.markModified("level");
await memberData.save(); await memberData.save();
} }

View file

@ -0,0 +1,45 @@
const { EmbedBuilder } = require("discord.js"),
BaseEvent = require("../../base/BaseEvent");
class messageUpdate extends BaseEvent {
constructor() {
super({
name: "messageUpdate",
once: false,
});
}
/**
*
* @param {import("../../base/JaBa")} client
* @param {import("discord.js").Message} oldMessage
* @param {import("discord.js").Message} newMessage
*/
async execute(client, oldMessage, newMessage) {
if (oldMessage.guild && oldMessage.guildId === "568120814776614924") return;
if (oldMessage.author.bot) return;
if (oldMessage.content === newMessage.content) return;
const guildData = await client.findOrCreateGuild({ id: oldMessage.guildId });
if (guildData.plugins.monitoring.messageUpdate) {
const embed = new EmbedBuilder()
.setAuthor({
name: newMessage.author.getUsername(),
iconURL: newMessage.author.displayAvatarURL(),
})
.setColor(client.config.embed.color)
.setFooter({ text: client.config.embed.footer })
.setTitle(`${newMessage.author.getUsername()} edited a message!`)
.setDescription(`Old Message: \`\`\`${oldMessage.content}\`\`\`\nNew Message: \`\`\`${newMessage.content}\`\`\`\nJump to message: ${newMessage.url}`);
newMessage.guild.channels.cache.get(guildData.plugins.monitoring.messageUpdate).send({
embeds: [embed],
});
}
}
}
module.exports = messageUpdate;

View file

@ -48,6 +48,7 @@ module.exports.init = function (client) {
}); });
}); });
user.reminds = user.reminds.filter(r => r.sendAt >= dateNow); user.reminds = user.reminds.filter(r => r.sendAt >= dateNow);
user.markModified("reminds");
user.save(); user.save();
if (user.reminds.length === 0) client.databaseCache.usersReminds.delete(user.id); if (user.reminds.length === 0) client.databaseCache.usersReminds.delete(user.id);

View file

@ -29,6 +29,8 @@ module.exports.init = async function (client) {
if (transaction.date < timestamp) { if (transaction.date < timestamp) {
const index = transactions.indexOf(transaction); const index = transactions.indexOf(transaction);
transactions.splice(index, 1); transactions.splice(index, 1);
member.markModified("transactions");
await member.save(); await member.save();
} }
} }

View file

@ -3,33 +3,30 @@
"USAGE": "list\nset [setting] (state) (#channel)", "USAGE": "list\nset [setting] (state) (#channel)",
"EXAMPLES": "config list\nconfig set setting:reports state:True channel:#reports", "EXAMPLES": "config list\nconfig set setting:reports state:True channel:#reports",
"SPECIAL_CHANNELS": "Special Channels",
"BIRTHDAYS": "Birthday Greetings", "BIRTHDAYS": "Birthday Greetings",
"MODLOGS": "Moderation Logs", "MODLOGS": "Moderation Logs",
"REPORTS": "Reports", "REPORTS": "Reports",
"SUGGESTIONS": "Suggestions", "SUGGESTIONS": "Suggestions",
"BIRTHDAYS_LIST": "Birthday Greetings: {{channel}}", "MONITORING_CHANNELS": "Monitoring Channels",
"MODLOGS_LIST": "Moderation Logs: {{channel}}", "MESSAGEUPDATE": "Message Update Logs",
"NEWS_LIST": "Bot News: {{channel}}",
"REPORTS_LIST": "Reports: {{channel}}",
"SUGGESTIONS_LIST": "Suggestions: {{channel}}",
"AUTOMOD_CONTENT": "Automoderation is enabled.\nIgnored channels: {{channels}}",
"AUTOMOD_TITLE": "Automoderation", "AUTOMOD_TITLE": "Automoderation",
"AUTOMOD_CONTENT": "Automoderation is enabled.\nIgnored channels: {{channels}}",
"AUTOROLE_TITLE": "Automatic Role Assignment", "AUTOROLE_TITLE": "Automatic Role Assignment",
"AUTO_SANCTIONS": "Automatic Sanctions", "AUTO_SANCTIONS": "Automatic Sanctions",
"BAN_CONTENT": "Ban: After **{{count}}** warnings", "BAN_CONTENT": "Ban: After **{{count}}** warnings",
"BAN_NOT_DEFINED": "Ban: Not set", "BAN_NOT_DEFINED": "Ban: Not set",
"DASHBOARD_CONTENT": "Click here to go to the dashboard",
"DASHBOARD_TITLE": "Modify Settings", "DASHBOARD_TITLE": "Modify Settings",
"GOODBYE_CONTENT": "Channel: {{channel}}\nCard: {{withImage}}", "DASHBOARD_CONTENT": "Click here to go to the dashboard",
"GOODBYE_TITLE": "Farewell", "GOODBYE_TITLE": "Farewell",
"GOODBYE_CONTENT": "Channel: {{channel}}\nCard: {{withImage}}",
"KICK_CONTENT": "Kick: After **{{count}}** warnings", "KICK_CONTENT": "Kick: After **{{count}}** warnings",
"KICK_NOT_DEFINED": "Kick: Not set", "KICK_NOT_DEFINED": "Kick: Not set",
"LIST": "Display server settings", "LIST": "Display server settings",
"SET": "Modify server settings", "SET": "Modify server settings",
"SETTING": "Settings", "SETTING": "Settings",
"SPECIAL_CHANNELS": "Special Channels", "WELCOME_TITLE": "Welcome",
"WELCOME_CONTENT": "Channel: {{channel}}\nCard: {{withImage}}", "WELCOME_CONTENT": "Channel: {{channel}}\nCard: {{withImage}}"
"WELCOME_TITLE": "Welcome"
} }

View file

@ -3,33 +3,30 @@
"USAGE": "list\nset [setting] (state) (#channel)", "USAGE": "list\nset [setting] (state) (#channel)",
"EXAMPLES": "config list\nconfig set setting:reports state:True channel:#reports", "EXAMPLES": "config list\nconfig set setting:reports state:True channel:#reports",
"SPECIAL_CHANNELS": "Специальные каналы",
"BIRTHDAYS": "Поздравления с днём рождения", "BIRTHDAYS": "Поздравления с днём рождения",
"MODLOGS": "Логи модерации", "MODLOGS": "Логи модерации",
"REPORTS": "Жалобы", "REPORTS": "Жалобы",
"SUGGESTIONS": "Предложения", "SUGGESTIONS": "Предложения",
"BIRTHDAYS_LIST": "Поздравления с днём рождения: {{channel}}", "MONITORING_CHANNELS": "Каналы мониторинга",
"MODLOGS_LIST": "Логи модерации: {{channel}}", "MESSAGEUPDATE": "Логи изменения сообщений",
"NEWS_LIST": "Новости бота: {{channel}}",
"REPORTS_LIST": "Жалобы: {{channel}}",
"SUGGESTIONS_LIST": "Предложения: {{channel}}",
"AUTOMOD_CONTENT": "Автомодерация включена.\nИгнорируемые каналы: {{channels}}",
"AUTOMOD_TITLE": "Автомодерация", "AUTOMOD_TITLE": "Автомодерация",
"AUTOMOD_CONTENT": "Автомодерация включена.\nИгнорируемые каналы: {{channels}}",
"AUTOROLE_TITLE": "Автоназначение роли при входе", "AUTOROLE_TITLE": "Автоназначение роли при входе",
"AUTO_SANCTIONS": "Автоматические наказания", "AUTO_SANCTIONS": "Автоматические наказания",
"BAN_CONTENT": "Бан: После **{{count}}** предупреждений", "BAN_CONTENT": "Бан: После **{{count}}** предупреждений",
"BAN_NOT_DEFINED": "Бан: Не назначено", "BAN_NOT_DEFINED": "Бан: Не назначено",
"DASHBOARD_CONTENT": "Нажмите сюда, чтобы перейти в панель управления",
"DASHBOARD_TITLE": "Изменить настройки", "DASHBOARD_TITLE": "Изменить настройки",
"GOODBYE_CONTENT": "Канал: {{channel}}\nКарточка: {{withImage}}", "DASHBOARD_CONTENT": "Нажмите сюда, чтобы перейти в панель управления",
"GOODBYE_TITLE": "Прощание", "GOODBYE_TITLE": "Прощание",
"GOODBYE_CONTENT": "Канал: {{channel}}\nКарточка: {{withImage}}",
"KICK_CONTENT": "Кик: После **{{count}}** предупреждений", "KICK_CONTENT": "Кик: После **{{count}}** предупреждений",
"KICK_NOT_DEFINED": "Кик: Не назначено", "KICK_NOT_DEFINED": "Кик: Не назначено",
"LIST": "Показать настройки сервера", "LIST": "Показать настройки сервера",
"SET": "Изменить настройки сервера", "SET": "Изменить настройки сервера",
"SETTING": "Параметр", "SETTING": "Параметр",
"SPECIAL_CHANNELS": "Специальные каналы", "WELCOME_TITLE": "Приветствие",
"WELCOME_CONTENT": "Канал: {{channel}}\nКарточка: {{withImage}}", "WELCOME_CONTENT": "Канал: {{channel}}\nКарточка: {{withImage}}"
"WELCOME_TITLE": "Приветствие"
} }

View file

@ -2,23 +2,31 @@
"DESCRIPTION": "Показати налаштування сервера", "DESCRIPTION": "Показати налаштування сервера",
"USAGE": "", "USAGE": "",
"EXAMPLES": "config", "EXAMPLES": "config",
"AUTOROLE_TITLE": "Автопризначення ролі при вході",
"WELCOME_TITLE": "Привітання",
"WELCOME_CONTENT": "Канал: {{channel}}\nКартка: {{withImage}}",
"GOODBYE_TITLE": "Прощання",
"GOODBYE_CONTENT": "Канал: {{channel}}\nКартка: {{withImage}}",
"SPECIAL_CHANNELS": "Спеціальні канали", "SPECIAL_CHANNELS": "Спеціальні канали",
"MODLOGS": "Логи модерації: {{channel}}", "BIRTHDAYS": "Привітання з днем ​​народження",
"BIRTHDAYS": "Привітання з днем ​​народження: {{channel}}", "MODLOGS": "Логи модерації",
"SUGGESTIONS": "Пропозиції: {{channel}}", "REPORTS": "Скарги",
"REPORTS": "Скарги: {{channel}}", "SUGGESTIONS": "Пропозиції",
"MONITORING_CHANNELS": "Каналы мониторинга",
"MESSAGEUPDATE": "Логи изменения сообщений",
"AUTOMOD_TITLE": "Автомодерація", "AUTOMOD_TITLE": "Автомодерація",
"AUTOMOD_CONTENT": "Автомодерація включена.\nІгноровані канали: {{channels}}", "AUTOMOD_CONTENT": "Автомодерація включена.\nІгноровані канали: {{channels}}",
"AUTOROLE_TITLE": "Автопризначення ролі при вході",
"AUTO_SANCTIONS": "Автоматичні покарання", "AUTO_SANCTIONS": "Автоматичні покарання",
"KICK_CONTENT": "Кік: Після **{{count}}** попереджень",
"KICK_NOT_DEFINED": "Кік: Не призначено",
"BAN_CONTENT": "Бан: Після **{{count}}** попереджень", "BAN_CONTENT": "Бан: Після **{{count}}** попереджень",
"BAN_NOT_DEFINED": "Бан: Не призначено", "BAN_NOT_DEFINED": "Бан: Не призначено",
"DASHBOARD_TITLE": "Змінити налаштування", "DASHBOARD_TITLE": "Змінити налаштування",
"DASHBOARD_CONTENT": "Натисніть сюди, щоб перейти до панелі керування" "DASHBOARD_CONTENT": "Натисніть сюди, щоб перейти до панелі керування",
"GOODBYE_TITLE": "Прощання",
"GOODBYE_CONTENT": "Канал: {{channel}}\nКартка: {{withImage}}",
"KICK_CONTENT": "Кік: Після **{{count}}** попереджень",
"KICK_NOT_DEFINED": "Кік: Не призначено",
"LIST": "Показати налаштування серверу",
"SET": "Змінити налаштування серверу ",
"SETTING": "Параметр",
"WELCOME_TITLE": "Привітання",
"WELCOME_CONTENT": "Канал: {{channel}}\nКартка: {{withImage}}"
} }

4
package-lock.json generated
View file

@ -1,12 +1,12 @@
{ {
"name": "jaba", "name": "jaba",
"version": "4.3.0", "version": "4.3.1",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "jaba", "name": "jaba",
"version": "4.3.0", "version": "4.3.1",
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"@discord-player/extractor": "^4.3.1", "@discord-player/extractor": "^4.3.1",

View file

@ -1,6 +1,6 @@
{ {
"name": "jaba", "name": "jaba",
"version": "4.3.0", "version": "4.3.1",
"description": "My Discord Bot", "description": "My Discord Bot",
"main": "index.js", "main": "index.js",
"private": true, "private": true,

View file

@ -1,61 +0,0 @@
const chalk = require("chalk");
console.log(chalk.blue("Creating database indexes...\n\n"));
let MongoClient;
try {
MongoClient = require("mongodb").MongoClient;
} catch (e) {
console.log(chalk.red("Cannot find module mongodb. Please install it using \"npm install mongodb\" before executing script."));
process.exit(1);
}
const config = require("../config");
const dbName = config.mongoDB.split("/").pop();
const baseURL = config.mongoDB.substr(0, config.mongoDB.length - dbName.length);
const client = new MongoClient(baseURL, {
useNewUrlParser: true,
useUnifiedTopology: true,
});
client.connect().then(async () => {
console.log(chalk.green("Connected successfully to mongoDB database."));
const db = client.db(dbName);
const guilds = db.collection("guilds");
const members = db.collection("members");
const users = db.collection("users");
console.log(chalk.yellow("Creating guilds index..."));
await guilds.createIndex({
id: 1,
});
console.log(chalk.green("Guilds index created."));
console.log(chalk.yellow("Creating members index..."));
await members.createIndex({
guildID: 1,
id: -1,
});
console.log(chalk.green("Members index created."));
console.log(chalk.yellow("Creating users index..."));
await users.createIndex({
id: 1,
});
console.log(chalk.green("Users index created."));
console.log(chalk.blue("\n\nIndexes created."));
process.exit(0);
}).catch(() => {
console.log(chalk.red("Couldn't connect to mongoDB database..."));
process.exit(1);
});