From be634fa5637e630a7ed9380144857e0288326be1 Mon Sep 17 00:00:00 2001 From: "Jonny_Bro (Nikita)" Date: Mon, 25 Sep 2023 21:42:43 +0500 Subject: [PATCH] v4.3.5 - http://jababot.ru:8080/updates --- .gitignore | 22 ++------- Disabled events/guildMemberAdd.js | 41 ---------------- Disabled events/guildMemberRemove.js | 41 ---------------- Disabled events/guildMemberUpdate.js | 42 ----------------- base/Guild.js | 3 -- base/JaBa.js | 2 +- commands/!DISABLED/importmee6.js | 1 + commands/Administration/automod.js | 3 ++ commands/Administration/autorole.js | 2 + commands/Administration/config.js | 6 ++- commands/Administration/goodbye.js | 2 + commands/Administration/set.js | 4 ++ commands/Administration/setlang.js | 1 + commands/Administration/welcome.js | 2 + commands/Economy/bank.js | 2 + commands/Economy/birthdate.js | 1 + commands/Economy/divorce.js | 2 + commands/Economy/marry.js | 3 ++ commands/Economy/pay.js | 2 + commands/Economy/rep.js | 2 + commands/Economy/rob.js | 3 +- commands/Economy/setbio.js | 1 + commands/Economy/slots.js | 3 ++ commands/Economy/transactions.js | 1 + commands/Economy/work.js | 8 +++- commands/Fun/tictactoe.js | 1 + commands/General/afk.js | 1 + commands/General/remindme.js | 2 + commands/Moderation/clearwarns.js | 1 + commands/Moderation/warn.js | 1 + commands/Owner/debug.js | 10 ++++ commands/Tickets/createticketembed.js | 1 + dashboard/dashboard.js | 13 +++-- dashboard/docs/updates.md | 5 ++ dashboard/settings.js | 47 ++++++++++++++++++- events/CommandHandler.js | 1 + events/Guild/guildCreate.js | 1 + events/Guild/guildMemberUpdate.js | 1 + events/MessageHandler.js | 2 +- .../Monitoring}/messageDelete.js | 0 getcookie.js | 1 - helpers/checkReminds.js | 1 + languages/en-US/administration/config.json | 3 +- languages/ru-RU/administration/config.json | 1 + languages/uk-UA/administration/config.json | 5 +- package.json | 2 +- 46 files changed, 134 insertions(+), 166 deletions(-) delete mode 100644 Disabled events/guildMemberAdd.js delete mode 100644 Disabled events/guildMemberRemove.js delete mode 100644 Disabled events/guildMemberUpdate.js rename {Disabled events => events/Monitoring}/messageDelete.js (100%) delete mode 100644 getcookie.js diff --git a/.gitignore b/.gitignore index 5d086fff..2f6ade1c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,33 +1,17 @@ +# Mac OS files +.DS_Store + # Bot Configuration /config.js # DB /giveaways.json -# commands.md -**/commands.md - -# Data -/.data - # Clips /clips -# Mac OS files -.DS_Store - -# IDE -.vscode - # Node node_modules # SQlite /json.sqlite - -# Sessions Store -sessions - -# SSL -/*.crt -/*.key \ No newline at end of file diff --git a/Disabled events/guildMemberAdd.js b/Disabled events/guildMemberAdd.js deleted file mode 100644 index 626fb821..00000000 --- a/Disabled events/guildMemberAdd.js +++ /dev/null @@ -1,41 +0,0 @@ -const { EmbedBuilder } = require("discord.js"), - BaseEvent = require("../../base/BaseEvent"); - -class messageDelete extends BaseEvent { - constructor() { - super({ - name: "messageDelete", - once: false, - }); - } - - /** - * - * @param {import("../../base/JaBa")} client The Discord Client - * @param {import("discord.js").GuildMember} member The member that has joined a guild - */ - async execute(client, message) { - if (message.guild && message.guildId === "568120814776614924") return; - if (message.author.bot) return; - - const guildData = await client.findOrCreateGuild({ id: message.guildId }); - - if (guildData.plugins?.monitoring?.messageDelete) { - const embed = new EmbedBuilder() - .setAuthor({ - name: message.author.getUsername(), - iconURL: message.author.displayAvatarURL(), - }) - .setColor(client.config.embed.color) - .setFooter(client.config.embed.footer) - .setTitle(`${message.author.getUsername()} deleted a message!`) - .setDescription(`Message content was: \`\`\`${message.content}\`\`\``); - - message.guild.channels.cache.get(guildData.plugins.monitoring.messageDelete).send({ - embeds: [embed], - }); - } - } -} - -module.exports = messageDelete; diff --git a/Disabled events/guildMemberRemove.js b/Disabled events/guildMemberRemove.js deleted file mode 100644 index 314f0ea8..00000000 --- a/Disabled events/guildMemberRemove.js +++ /dev/null @@ -1,41 +0,0 @@ -const { EmbedBuilder } = require("discord.js"), - BaseEvent = require("../../base/BaseEvent"); - -class messageDelete extends BaseEvent { - constructor() { - super({ - name: "messageDelete", - once: false, - }); - } - - /** - * - * @param {import("../../base/JaBa")} client The Discord Client - * @param {import("discord.js").GuildMember} member The member that has left/been kicked from the guild - */ - async execute(client, member) { - if (message.guild && message.guildId === "568120814776614924") return; - if (message.author.bot) return; - - const guildData = await client.findOrCreateGuild({ id: message.guildId }); - - if (guildData.plugins?.monitoring?.messageDelete) { - const embed = new EmbedBuilder() - .setAuthor({ - name: message.author.getUsername(), - iconURL: message.author.displayAvatarURL(), - }) - .setColor(client.config.embed.color) - .setFooter(client.config.embed.footer) - .setTitle(`${message.author.getUsername()} deleted a message!`) - .setDescription(`Message content was: \`\`\`${message.content}\`\`\``); - - message.guild.channels.cache.get(guildData.plugins.monitoring.messageDelete).send({ - embeds: [embed], - }); - } - } -} - -module.exports = messageDelete; diff --git a/Disabled events/guildMemberUpdate.js b/Disabled events/guildMemberUpdate.js deleted file mode 100644 index 38244555..00000000 --- a/Disabled events/guildMemberUpdate.js +++ /dev/null @@ -1,42 +0,0 @@ -// const { EmbedBuilder } = require("discord.js"), -// BaseEvent = require("../../base/BaseEvent"); - -// class messageDelete extends BaseEvent { -// constructor() { -// super({ -// name: "messageDelete", -// once: false, -// }); -// } - -// /** -// * -// * @param {import("../../base/JaBa")} client The Discord Client -// * @param {import("discord.js").GuildMember} oldMember The member before the update -// * @param {import("discord.js").GuildMember} newMember The member after the update -// */ -// async execute(client, oldMember, newMember) { -// if (oldMember.guild && oldMember.guild.id === "568120814776614924") return; -// if (oldMember.user.bot) return; - -// const guildData = await client.findOrCreateGuild({ id: oldMember.guild.id }); - -// if (guildData.plugins?.monitoring?.messageDelete) { -// const embed = new EmbedBuilder() -// .setAuthor({ -// name: message.author.getUsername(), -// iconURL: message.author.displayAvatarURL(), -// }) -// .setColor(client.config.embed.color) -// .setFooter(client.config.embed.footer) -// .setTitle(`${message.author.getUsername()} deleted a message!`) -// .setDescription(`Message content was: \`\`\`${message.content}\`\`\``); - -// message.guild.channels.cache.get(guildData.plugins.monitoring.messageDelete).send({ -// embeds: [embed], -// }); -// } -// } -// } - -// module.exports = messageDelete; diff --git a/base/Guild.js b/base/Guild.js index 171b1ab8..634cfdd9 100644 --- a/base/Guild.js +++ b/base/Guild.js @@ -37,9 +37,6 @@ module.exports = mongoose.model("Guild", new Schema({ ban: null, }, monitoring: { - memberAdd: null, - memberRemove: null, - memberUpdate: null, messageUpdate: null, messageDelete: null, }, diff --git a/base/JaBa.js b/base/JaBa.js index 38fe5d7d..b5ce3dce 100644 --- a/base/JaBa.js +++ b/base/JaBa.js @@ -281,8 +281,8 @@ class JaBa extends Client { if (guildData) { guildData.members.push(memberData._id); - guildData.markModified("members"); + guildData.markModified("members"); await guildData.save(); } diff --git a/commands/!DISABLED/importmee6.js b/commands/!DISABLED/importmee6.js index d84b16a2..1a5ff95f 100644 --- a/commands/!DISABLED/importmee6.js +++ b/commands/!DISABLED/importmee6.js @@ -38,6 +38,7 @@ class ImportMee6 extends BaseCommand { const level = (await Mee6Api.getUserXp(interaction.guildId, interaction.member)).level; data.memberData.level = level; + data.markModified("memberData.level"); await data.memberData.save(); diff --git a/commands/Administration/automod.js b/commands/Administration/automod.js index e3e2e56a..95e8ecb7 100644 --- a/commands/Administration/automod.js +++ b/commands/Administration/automod.js @@ -64,6 +64,7 @@ class Automod extends BaseCommand { enabled: true, ignored: [], }; + data.guildData.markModified("plugins.automod"); await data.guildData.save(); @@ -71,6 +72,7 @@ class Automod extends BaseCommand { } else { if (channel) { data.guildData.plugins.automod.ignored.push(channel.id); + data.guildData.markModified("plugins.automod"); await data.guildData.save(); @@ -82,6 +84,7 @@ class Automod extends BaseCommand { enabled: false, ignored: [], }; + data.guildData.markModified("plugins.automod"); await data.guildData.save(); diff --git a/commands/Administration/autorole.js b/commands/Administration/autorole.js index 298ee384..f14cac61 100644 --- a/commands/Administration/autorole.js +++ b/commands/Administration/autorole.js @@ -65,6 +65,7 @@ class Autorole extends BaseCommand { enabled: true, role: role.id, }; + data.guildData.markModified("plugins.autorole"); await data.guildData.save(); @@ -76,6 +77,7 @@ class Autorole extends BaseCommand { enabled: false, role: null, }; + data.guildData.markModified("plugins.autorole"); await data.guildData.save(); diff --git a/commands/Administration/config.js b/commands/Administration/config.js index ad9ee5c3..5941eb96 100644 --- a/commands/Administration/config.js +++ b/commands/Administration/config.js @@ -51,6 +51,7 @@ class Config extends BaseCommand { { name: client.translate("administration/config:TICKETLOGS"), value: "tickets.ticketLogs" }, { name: client.translate("administration/config:TRANSCRIPTIONLOGS"), value: "tickets.transcriptionLogs" }, { name: client.translate("administration/config:MESSAGEUPDATE"), value: "monitoring.messageUpdate" }, + { name: client.translate("administration/config:MESSAGEDELETE"), value: "monitoring.messageDelete" }, ) .setRequired(true), ) @@ -151,7 +152,8 @@ class Config extends BaseCommand { { 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`, + `${interaction.translate("administration/config:MESSAGEUPDATE")}: ${guildData.plugins?.monitoring?.messageUpdate ? `<#${guildData.plugins?.monitoring?.messageUpdate}>` : `*${interaction.translate("common:NOT_DEFINED")}*`}\n` + + `${interaction.translate("administration/config:MESSAGEDELETE")}: ${guildData.plugins?.monitoring?.messageDelete ? `<#${guildData.plugins?.monitoring?.messageDelete}>` : `*${interaction.translate("common:NOT_DEFINED")}*`}\n`, }, { name: interaction.translate("administration/config:SPECIAL_CHANNELS"), @@ -200,6 +202,7 @@ async function changeSetting(interaction, setting, state, channel, guildData) { if (!state) { guildData.plugins[settingSplitted[0]][settingSplitted[1]] = null; + guildData.markModified("plugins"); await guildData.save(); @@ -212,6 +215,7 @@ async function changeSetting(interaction, setting, state, channel, guildData) { if (channel) { guildData.plugins[settingSplitted[0]][settingSplitted[1]] = channel.id; + guildData.markModified("plugins"); await guildData.save(); diff --git a/commands/Administration/goodbye.js b/commands/Administration/goodbye.js index a2f84be9..850f366f 100644 --- a/commands/Administration/goodbye.js +++ b/commands/Administration/goodbye.js @@ -107,6 +107,7 @@ class Goodbye extends BaseCommand { channelID: null, withImage: null, }; + data.guildData.markModified("plugins.goodbye"); await data.guildData.save(); @@ -122,6 +123,7 @@ class Goodbye extends BaseCommand { message: message, withImage: image, }; + data.guildData.markModified("plugins.goodbye"); await data.guildData.save(); diff --git a/commands/Administration/set.js b/commands/Administration/set.js index 7f20dcb2..ac8afdae 100644 --- a/commands/Administration/set.js +++ b/commands/Administration/set.js @@ -87,6 +87,7 @@ class Set extends BaseCommand { switch (type) { case "level": { memberData.level = int; + memberData.markModified("level"); await memberData.save(); @@ -98,6 +99,7 @@ class Set extends BaseCommand { case "xp": { memberData.exp = int; + memberData.markModified("exp"); await memberData.save(); @@ -109,6 +111,7 @@ class Set extends BaseCommand { case "credits": { memberData.money = int; + memberData.markModified("money"); await memberData.save(); @@ -120,6 +123,7 @@ class Set extends BaseCommand { case "bank": { memberData.bankSold = int; + memberData.markModified("bankSold"); await memberData.save(); diff --git a/commands/Administration/setlang.js b/commands/Administration/setlang.js index 16bf6e85..e5dc48b9 100644 --- a/commands/Administration/setlang.js +++ b/commands/Administration/setlang.js @@ -51,6 +51,7 @@ class Setlang extends BaseCommand { language = client.languages.find(l => l.name === lang); data.guildData.language = language.name; + data.guildData.markModified("language"); await data.guildData.save(); diff --git a/commands/Administration/welcome.js b/commands/Administration/welcome.js index aee4a683..b25bc15f 100644 --- a/commands/Administration/welcome.js +++ b/commands/Administration/welcome.js @@ -107,6 +107,7 @@ class Welcome extends BaseCommand { channelID: null, withImage: null, }; + data.guildData.markModified("plugins.welcome"); await data.guildData.save(); @@ -122,6 +123,7 @@ class Welcome extends BaseCommand { message: message, withImage: image, }; + data.guildData.markModified("plugins.welcome"); await data.guildData.save(); diff --git a/commands/Economy/bank.js b/commands/Economy/bank.js index 595b5f2a..815b16f3 100644 --- a/commands/Economy/bank.js +++ b/commands/Economy/bank.js @@ -68,6 +68,7 @@ class Bank extends BaseCommand { data.memberData.money -= credits; data.memberData.bankSold += credits; + data.memberData.markModified("money"); data.memberData.markModified("bankSold"); await data.memberData.save(); @@ -102,6 +103,7 @@ class Bank extends BaseCommand { data.memberData.money += credits; data.memberData.bankSold -= credits; + data.memberData.markModified("money"); data.memberData.markModified("bankSold"); await data.memberData.save(); diff --git a/commands/Economy/birthdate.js b/commands/Economy/birthdate.js index e1280fd5..af956487 100644 --- a/commands/Economy/birthdate.js +++ b/commands/Economy/birthdate.js @@ -89,6 +89,7 @@ class Birthdate extends BaseCommand { if (d.getTime() < Date.now() - 2.523e12) return interaction.error("economy/birthdate:DATE_TOO_LOW"); data.userData.birthdate = d; + data.userData.markModified("birthdate"); await data.userData.save(); diff --git a/commands/Economy/divorce.js b/commands/Economy/divorce.js index bd41dbf0..ddeb5d68 100644 --- a/commands/Economy/divorce.js +++ b/commands/Economy/divorce.js @@ -39,6 +39,7 @@ class Divorce extends BaseCommand { const user = client.users.cache.get(data.userData.lover) || (await client.users.fetch(data.userData.lover)); data.userData.lover = null; + data.user.markModified("lover"); await data.userData.save(); @@ -46,6 +47,7 @@ class Divorce extends BaseCommand { id: user.id, }); oldLover.lover = null; + oldLover.markModified("lover"); await oldLover.save(); diff --git a/commands/Economy/marry.js b/commands/Economy/marry.js index 792b9a1d..57f7f50a 100644 --- a/commands/Economy/marry.js +++ b/commands/Economy/marry.js @@ -132,6 +132,7 @@ class Marry extends BaseCommand { data.userData.markModified("lover"); await data.userData.save(); + userData.markModified("lover"); await userData.save(); @@ -151,6 +152,7 @@ class Marry extends BaseCommand { sent = true; userData.achievements.married.achieved = true; userData.achievements.married.progress.now = 1; + userData.markModified("achievements.married"); await userData.save(); } @@ -159,6 +161,7 @@ class Marry extends BaseCommand { if (!sent) interaction.followUp(messageOptions); data.userData.achievements.married.achieved = true; data.userData.achievements.married.progress.now = 1; + data.userData.markModified("achievements.married"); await data.userData.save(); } diff --git a/commands/Economy/pay.js b/commands/Economy/pay.js index c038ae12..aed3866e 100644 --- a/commands/Economy/pay.js +++ b/commands/Economy/pay.js @@ -72,10 +72,12 @@ class Pay extends BaseCommand { }); data.memberData.money -= amount; + data.memberData.markModified("money"); await data.memberData.save(); memberData.money += amount; + memberData.markModified("money"); await memberData.save(); diff --git a/commands/Economy/rep.js b/commands/Economy/rep.js index 65607d62..7f7d09d0 100644 --- a/commands/Economy/rep.js +++ b/commands/Economy/rep.js @@ -61,6 +61,7 @@ class Rep extends BaseCommand { if (!data.userData.cooldowns) data.userData.cooldowns = {}; data.userData.cooldowns.rep = toWait; + data.userData.markModified("cooldowns"); await data.userData.save(); @@ -84,6 +85,7 @@ class Rep extends BaseCommand { ], }); } + userData.markModified("achievements.rep"); } await userData.save(); diff --git a/commands/Economy/rob.js b/commands/Economy/rob.js index c8c9c3bb..b5fd1bb2 100644 --- a/commands/Economy/rob.js +++ b/commands/Economy/rob.js @@ -87,6 +87,7 @@ class Rob extends BaseCommand { randomNum = client.functions.randomNum(1, 2); memberData.cooldowns.rob = toWait; + memberData.markModified("cooldowns"); await memberData.save(); @@ -100,7 +101,6 @@ class Rob extends BaseCommand { data.memberData.markModified("money"); memberData.markModified("money"); - await data.memberData.save(); await memberData.save(); } else { @@ -118,7 +118,6 @@ class Rob extends BaseCommand { data.memberData.markModified("money"); memberData.markModified("money"); - await data.memberData.save(); await memberData.save(); } diff --git a/commands/Economy/setbio.js b/commands/Economy/setbio.js index 7cc44636..12da1b24 100644 --- a/commands/Economy/setbio.js +++ b/commands/Economy/setbio.js @@ -49,6 +49,7 @@ class Setbio extends BaseCommand { if (newBio.length > 150) return interaction.error("economy/setbio:MAX_CHARACTERS"); data.userData.bio = newBio; + data.memberData.markModified("bio"); await data.userData.save(); diff --git a/commands/Economy/slots.js b/commands/Economy/slots.js index a135486a..33bffff6 100644 --- a/commands/Economy/slots.js +++ b/commands/Economy/slots.js @@ -145,6 +145,7 @@ class Slots extends BaseCommand { ], }); } + data.userData.markModified("achievements.slots"); await data.userData.save(); } @@ -195,6 +196,7 @@ class Slots extends BaseCommand { ], }); } + data.userData.markModified("achievements.slots"); await data.userData.save(); } @@ -225,6 +227,7 @@ class Slots extends BaseCommand { if (!data.userData.achievements.slots.achieved) { data.userData.achievements.slots.progress.now = 0; + data.userData.markModified("achievements.slots"); await data.userData.save(); } diff --git a/commands/Economy/transactions.js b/commands/Economy/transactions.js index 7a9e7cfa..a5dbc2e0 100644 --- a/commands/Economy/transactions.js +++ b/commands/Economy/transactions.js @@ -46,6 +46,7 @@ class Transactions extends BaseCommand { async execute(client, interaction, data) { if (interaction.options.getBoolean("clear")) { data.memberData.transactions = []; + data.memberData.markModified("transactions"); await data.memberData.save(); diff --git a/commands/Economy/work.js b/commands/Economy/work.js index 814b95ef..b515b260 100644 --- a/commands/Economy/work.js +++ b/commands/Economy/work.js @@ -46,9 +46,11 @@ class Work extends BaseCommand { const toWait = Date.now() + 24 * 60 * 60 * 1000; // 24 hours data.memberData.cooldowns.work = toWait; - data.memberData.markModified("cooldowns"); - data.memberData.workStreak = (data.memberData.workStreak || 0) + 1; + + data.memberData.markModified("cooldowns"); + data.memberData.markModified("workStreak"); + await data.memberData.save(); const embed = new EmbedBuilder() @@ -98,6 +100,7 @@ class Work extends BaseCommand { } data.memberData.money += won; + data.memberData.markModified("money"); await data.memberData.save(); @@ -124,6 +127,7 @@ class Work extends BaseCommand { ]; data.userData.achievements.work.achieved = true; } + data.userData.markModified("achievements.work"); await data.userData.save(); } diff --git a/commands/Fun/tictactoe.js b/commands/Fun/tictactoe.js index 5d018620..d69557f8 100644 --- a/commands/Fun/tictactoe.js +++ b/commands/Fun/tictactoe.js @@ -57,6 +57,7 @@ class TicTacToe extends BaseCommand { }); memberData.money += 100; + memberData.markModified("money"); await memberData.save(); diff --git a/commands/General/afk.js b/commands/General/afk.js index 92d6fa5d..493f1613 100644 --- a/commands/General/afk.js +++ b/commands/General/afk.js @@ -50,6 +50,7 @@ class Afk extends BaseCommand { const reason = interaction.options.getString("message"); data.userData.afk = reason; + data.userData.markModified("afk"); await data.userData.save(); diff --git a/commands/General/remindme.js b/commands/General/remindme.js index 7ffc0921..1ff59b28 100644 --- a/commands/General/remindme.js +++ b/commands/General/remindme.js @@ -71,8 +71,10 @@ class Remindme extends BaseCommand { }; data.userData.reminds.push(rData); + data.userData.markModified("reminds"); data.userData.save(); + client.databaseCache.usersReminds.set(interaction.member.id, data.userData); interaction.success("general/remindme:SAVED", { diff --git a/commands/Moderation/clearwarns.js b/commands/Moderation/clearwarns.js index e3689b0d..6132216e 100644 --- a/commands/Moderation/clearwarns.js +++ b/commands/Moderation/clearwarns.js @@ -54,6 +54,7 @@ class Clearwarns extends BaseCommand { }); memberData.sanctions = []; + memberData.markModified("sanctions"); memberData.save(); diff --git a/commands/Moderation/warn.js b/commands/Moderation/warn.js index 9f9ce45e..7f8dbd1d 100644 --- a/commands/Moderation/warn.js +++ b/commands/Moderation/warn.js @@ -177,6 +177,7 @@ class Warn extends BaseCommand { .setColor(client.config.embed.color); memberData.sanctions.push(caseInfo); + memberData.markModified("sanctions"); memberData.save(); diff --git a/commands/Owner/debug.js b/commands/Owner/debug.js index 5eb12933..9710f056 100644 --- a/commands/Owner/debug.js +++ b/commands/Owner/debug.js @@ -147,6 +147,7 @@ class Debug extends BaseCommand { switch (type) { case "level": { memberData.level = int; + memberData.markModified("level"); await memberData.save(); @@ -158,6 +159,7 @@ class Debug extends BaseCommand { case "xp": { memberData.exp = int; + memberData.markModified("exp"); await memberData.save(); @@ -169,6 +171,7 @@ class Debug extends BaseCommand { case "credits": { memberData.money = int; + memberData.markModified("money"); await memberData.save(); @@ -180,6 +183,7 @@ class Debug extends BaseCommand { case "bank": { memberData.bankSold = int; + memberData.markModified("bankSold"); await memberData.save(); @@ -191,6 +195,7 @@ class Debug extends BaseCommand { case "rep": { userData.rep = int; + userData.markModified("rep"); await userData.save(); @@ -218,6 +223,7 @@ class Debug extends BaseCommand { switch (type) { case "level": { memberData.level += int; + memberData.markModified("level"); await memberData.save(); @@ -229,6 +235,7 @@ class Debug extends BaseCommand { case "xp": { memberData.exp += int; + memberData.markModified("exp"); await memberData.save(); @@ -240,6 +247,7 @@ class Debug extends BaseCommand { case "credits": { memberData.money += int; + memberData.markModified("money"); await memberData.save(); @@ -251,6 +259,7 @@ class Debug extends BaseCommand { case "bank": { memberData.bankSold += int; + memberData.markModified("bankSold"); await memberData.save(); @@ -262,6 +271,7 @@ class Debug extends BaseCommand { case "rep": { userData.rep += int; + userData.markModified("rep"); await userData.save(); diff --git a/commands/Tickets/createticketembed.js b/commands/Tickets/createticketembed.js index 8a64173e..fa92d2d7 100644 --- a/commands/Tickets/createticketembed.js +++ b/commands/Tickets/createticketembed.js @@ -44,6 +44,7 @@ class CreateTicketEmbed extends BaseCommand { if (guildData.plugins.tickets.count === undefined) guildData.plugins.tickets.count = 0; guildData.plugins.tickets.count++; + guildData.markModified("plugins.tickets"); guildData.save(); diff --git a/dashboard/dashboard.js b/dashboard/dashboard.js index 59436f3e..2ecf62df 100644 --- a/dashboard/dashboard.js +++ b/dashboard/dashboard.js @@ -1,7 +1,6 @@ const SoftUI = require("./dashboard-core/theme/dbd-soft-ui"), DBD = require("./dashboard-core/index"), - settings = require("./settings"), - fs = require("fs"); + settings = require("./settings"); const { PermissionsBitField } = require("discord.js"); @@ -43,11 +42,11 @@ module.exports.load = async client => { id: client.config.userId, secret: client.config.dashboard.secret, }, - SSL: { - enabled: false, - key: fs.readFileSync(`${__dirname}/../jababot-cloudflare.key`, "utf-8"), - cert: fs.readFileSync(`${__dirname}/../jababot-cloudflare.crt`, "utf-8"), - }, + // SSL: { + // enabled: false, + // key: fs.readFileSync(`${__dirname}/../jababot-cloudflare.key`, "utf-8"), + // cert: fs.readFileSync(`${__dirname}/../jababot-cloudflare.crt`, "utf-8"), + // }, cookiesSecret: client.config.dashboard.secret, domain: client.config.dashboard.domain, redirectUri: `${client.config.dashboard.domain}${client.config.dashboard.port !== 80 ? `:${client.config.dashboard.port}` : ""}/discord/callback`, diff --git a/dashboard/docs/updates.md b/dashboard/docs/updates.md index 46078d8a..ba58d04d 100644 --- a/dashboard/docs/updates.md +++ b/dashboard/docs/updates.md @@ -1,3 +1,8 @@ +### JaBa v4.3.5 +* Добавлено + * Логи удаления сообщений!\ + Настройку можно найти в *config set* и в панели управления. + ### JaBa v4.3.3 * Добавлено * Система Тикетов!\ diff --git a/dashboard/settings.js b/dashboard/settings.js index c7515918..986ca65c 100644 --- a/dashboard/settings.js +++ b/dashboard/settings.js @@ -32,6 +32,7 @@ module.exports = client => [ }); guildData.language = newData; + guildData.markModified("language"); await guildData.save(); @@ -61,6 +62,7 @@ module.exports = client => [ }); guildData.plugins.welcome.enabled = newData; + guildData.markModified("plugins.welcome"); await guildData.save(); @@ -85,6 +87,7 @@ module.exports = client => [ }); guildData.plugins.welcome.withImage = newData; + guildData.markModified("plugins.welcome"); await guildData.save(); @@ -109,6 +112,7 @@ module.exports = client => [ }); guildData.plugins.welcome.message = newData !== "" ? newData : null; + guildData.markModified("plugins.welcome"); await guildData.save(); @@ -133,6 +137,7 @@ module.exports = client => [ }); guildData.plugins.welcome.channel = newData !== "" ? newData : null; + guildData.markModified("plugins.welcome"); await guildData.save(); @@ -164,6 +169,7 @@ module.exports = client => [ }); guildData.plugins.goodbye.enabled = newData; + guildData.markModified("plugins.goodbye"); await guildData.save(); @@ -188,6 +194,7 @@ module.exports = client => [ }); guildData.plugins.goodbye.withImage = newData; + guildData.markModified("plugins.goodbye"); await guildData.save(); @@ -212,6 +219,7 @@ module.exports = client => [ }); guildData.plugins.goodbye.message = newData !== "" ? newData : null; + guildData.markModified("plugins.goodbye"); await guildData.save(); @@ -236,6 +244,7 @@ module.exports = client => [ }); guildData.plugins.goodbye.channel = newData !== "" ? newData : null; + guildData.markModified("plugins.goodbye"); await guildData.save(); @@ -267,6 +276,7 @@ module.exports = client => [ }); guildData.plugins.autorole.enabled = newData; + guildData.markModified("plugins.autorole"); await guildData.save(); @@ -291,6 +301,7 @@ module.exports = client => [ }); guildData.plugins.autorole.role = newData !== "" ? newData : null; + guildData.markModified("plugins.autorole"); await guildData.save(); @@ -322,6 +333,7 @@ module.exports = client => [ }); guildData.plugins.automod.enabled = newData; + guildData.markModified("plugins.automod"); await guildData.save(); @@ -346,6 +358,7 @@ module.exports = client => [ }); guildData.plugins.automod.ignored = newData; + guildData.markModified("plugins.automod"); await guildData.save(); @@ -362,7 +375,7 @@ module.exports = client => [ { optionId: "monitoring_messageupdate", optionName: "Message Update Channel", - optionDescription: "Select a channel for messages updates logs to go to. Select \"-\" to disable", + optionDescription: "Select a channel for messages update logs to go to. Select \"-\" to disable", optionType: DBD.formTypes.channelsSelect(false, [ChannelType.GuildText]), getActualSet: async ({ guild }) => { const guildData = await client.findOrCreateGuild({ @@ -379,6 +392,34 @@ module.exports = client => [ if (guildData.plugins.monitoring === undefined) guildData.plugins.monitoring = {}; guildData.plugins.monitoring.messageUpdate = newData !== "" ? newData : null; + + guildData.markModified("plugins.monitoring"); + await guildData.save(); + + return; + }, + }, + { + optionId: "monitoring_messagedelete", + optionName: "Message Deletion Channel", + optionDescription: "Select a channel for messages deletion logs to go to. Select \"-\" to disable", + optionType: DBD.formTypes.channelsSelect(false, [ChannelType.GuildText]), + getActualSet: async ({ guild }) => { + const guildData = await client.findOrCreateGuild({ + id: guild.id, + }); + + return guildData.plugins?.monitoring?.messageDelete; + }, + setNew: async ({ guild, newData }) => { + const guildData = await client.findOrCreateGuild({ + id: guild.id, + }); + + if (guildData.plugins.monitoring === undefined) guildData.plugins.monitoring = {}; + + guildData.plugins.monitoring.messageDelete = newData !== "" ? newData : null; + guildData.markModified("plugins.monitoring"); await guildData.save(); @@ -410,6 +451,7 @@ module.exports = client => [ }); guildData.plugins.suggestions = newData !== "" ? newData : null; + guildData.markModified("plugins.suggestions"); await guildData.save(); @@ -434,6 +476,7 @@ module.exports = client => [ }); guildData.plugins.reports = newData !== "" ? newData : null; + guildData.markModified("plugins.reports"); await guildData.save(); @@ -458,6 +501,7 @@ module.exports = client => [ }); guildData.plugins.birthdays = newData !== "" ? newData : null; + guildData.markModified("plugins.birthdays"); await guildData.save(); @@ -482,6 +526,7 @@ module.exports = client => [ }); guildData.plugins.modlogs = newData !== "" ? newData : null; + guildData.markModified("plugins.modlogs"); await guildData.save(); diff --git a/events/CommandHandler.js b/events/CommandHandler.js index 5b4b4190..01702390 100644 --- a/events/CommandHandler.js +++ b/events/CommandHandler.js @@ -50,6 +50,7 @@ class CommandHandler extends BaseEvent { userData.achievements.firstCommand.progress.now = 1; userData.achievements.firstCommand.achieved = true; + userData.markModified("achievements.firstCommand"); await userData.save(); diff --git a/events/Guild/guildCreate.js b/events/Guild/guildCreate.js index 82e0acbe..4eb19f47 100644 --- a/events/Guild/guildCreate.js +++ b/events/Guild/guildCreate.js @@ -20,6 +20,7 @@ class GuildCreate extends BaseEvent { if (!userData.achievements.invite.achieved) { userData.achievements.invite.progress.now = 1; userData.achievements.invite.achieved = true; + userData.markModified("achievements.invite"); await userData.save(); } diff --git a/events/Guild/guildMemberUpdate.js b/events/Guild/guildMemberUpdate.js index d97417ab..90eeb687 100644 --- a/events/Guild/guildMemberUpdate.js +++ b/events/Guild/guildMemberUpdate.js @@ -24,6 +24,7 @@ class GuildMemberUpdate extends BaseEvent { userData.achievements.tip.progress.now = 1; userData.achievements.tip.achieved = true; + userData.markModified("achievements.tip"); await userData.save(); diff --git a/events/MessageHandler.js b/events/MessageHandler.js index a79327c6..f6612541 100644 --- a/events/MessageHandler.js +++ b/events/MessageHandler.js @@ -102,6 +102,7 @@ class MessageCreate extends BaseEvent { const afkReason = data.userData.afk; if (afkReason) { data.userData.afk = null; + data.userData.markModified("afk"); await data.userData.save(); @@ -152,7 +153,6 @@ async function updateXp(client, msg, memberData) { memberData.markModified("exp"); memberData.markModified("level"); - await memberData.save(); } diff --git a/Disabled events/messageDelete.js b/events/Monitoring/messageDelete.js similarity index 100% rename from Disabled events/messageDelete.js rename to events/Monitoring/messageDelete.js diff --git a/getcookie.js b/getcookie.js deleted file mode 100644 index 026e6811..00000000 --- a/getcookie.js +++ /dev/null @@ -1 +0,0 @@ -require("play-dl").authorization(); \ No newline at end of file diff --git a/helpers/checkReminds.js b/helpers/checkReminds.js index 06f327f2..9c816a43 100644 --- a/helpers/checkReminds.js +++ b/helpers/checkReminds.js @@ -47,6 +47,7 @@ module.exports.init = function (client) { }); }); user.reminds = user.reminds.filter(r => r.sendAt >= dateNow); + user.markModified("reminds"); await user.save(); diff --git a/languages/en-US/administration/config.json b/languages/en-US/administration/config.json index a6a12b43..4fe18045 100644 --- a/languages/en-US/administration/config.json +++ b/languages/en-US/administration/config.json @@ -9,12 +9,13 @@ "REPORTS": "Reports", "SUGGESTIONS": "Suggestions", "TICKETSCATEGORY": "Category For Tickets (They have folder icon)", - "TICKETS_NOT_CATEGORY": "Please select a **categry** channel", + "TICKETS_NOT_CATEGORY": "Please select a **category** channel", "TICKETLOGS": "Tickets Logs", "TRANSCRIPTIONLOGS": "Transcripts Logs", "MONITORING_CHANNELS": "Monitoring Channels", "MESSAGEUPDATE": "Message Update Logs", + "MESSAGEDELETE": "Message Deletion Logs", "AUTOMOD_TITLE": "Automoderation", "AUTOMOD_CONTENT": "Automoderation is enabled.\nIgnored channels: {{channels}}", diff --git a/languages/ru-RU/administration/config.json b/languages/ru-RU/administration/config.json index d4cdd371..277325d3 100644 --- a/languages/ru-RU/administration/config.json +++ b/languages/ru-RU/administration/config.json @@ -15,6 +15,7 @@ "MONITORING_CHANNELS": "Каналы мониторинга", "MESSAGEUPDATE": "Логи изменения сообщений", + "MESSAGEDELETE": "Логи удаления сообщений", "AUTOMOD_TITLE": "Автомодерация", "AUTOMOD_CONTENT": "Автомодерация включена.\nИгнорируемые каналы: {{channels}}", diff --git a/languages/uk-UA/administration/config.json b/languages/uk-UA/administration/config.json index 2ea9da03..23667af3 100644 --- a/languages/uk-UA/administration/config.json +++ b/languages/uk-UA/administration/config.json @@ -13,8 +13,9 @@ "TICKETLOGS": "Логи тікетів", "TRANSCRIPTIONLOGS": "Логи розшифровок", - "MONITORING_CHANNELS": "Каналы мониторинга", - "MESSAGEUPDATE": "Логи изменения сообщений", + "MONITORING_CHANNELS": "Канали моніторингу", + "MESSAGEUPDATE": "Логи зміни повідомлень", + "MESSAGEDELETE": "Логи видалення повідомлень", "AUTOMOD_TITLE": "Автомодерація", "AUTOMOD_CONTENT": "Автомодерація включена.\nІгноровані канали: {{channels}}", diff --git a/package.json b/package.json index 9706919e..d9bb1ab1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "jaba", - "version": "4.3.3", + "version": "4.3.5", "description": "My Discord Bot", "main": "index.js", "scripts": {