update depends

This commit is contained in:
Jonny_Bro (Nikita) 2023-10-30 21:45:10 +05:00
parent 3410fb2091
commit 113f4ae3e0
41 changed files with 347 additions and 376 deletions

View file

@ -249,6 +249,8 @@ class JaBa extends Client {
return userData; return userData;
} else { } else {
userData = new this.usersData({ id: userID }); userData = new this.usersData({ id: userID });
userData.markModified();
await userData.save(); await userData.save();
this.databaseCache.users.set(userID, userData); this.databaseCache.users.set(userID, userData);
@ -272,6 +274,8 @@ class JaBa extends Client {
return memberData; return memberData;
} else { } else {
memberData = new this.membersData({ id: memberID, guildID: guildId }); memberData = new this.membersData({ id: memberID, guildID: guildId });
memberData.markModified();
await memberData.save(); await memberData.save();
const guildData = await this.findOrCreateGuild(guildId); const guildData = await this.findOrCreateGuild(guildId);
@ -279,6 +283,7 @@ class JaBa extends Client {
if (guildData) { if (guildData) {
guildData.members.push(memberData._id); guildData.members.push(memberData._id);
guildData.markModified("members");
await guildData.save(); await guildData.save();
} }
@ -302,6 +307,8 @@ class JaBa extends Client {
return guildData; return guildData;
} else { } else {
guildData = new this.guildsData({ id: guildId }); guildData = new this.guildsData({ id: guildId });
guildData.markModified();
await guildData.save(); await guildData.save();
this.databaseCache.guilds.set(guildId, guildData); this.databaseCache.guilds.set(guildId, guildData);

View file

@ -39,6 +39,7 @@ class ImportMee6 extends BaseCommand {
data.memberData.level = level; data.memberData.level = level;
data.memberData.markModified();
await data.memberData.save(); await data.memberData.save();
interaction.editReply({ interaction.editReply({

View file

@ -85,12 +85,14 @@ class Automod extends BaseCommand {
ignored: [], ignored: [],
}; };
data.guildData.markModified("plugins.automod");
await data.guildData.save(); await data.guildData.save();
interaction.success(`administration/automod:${state ? "ENABLED" : "DISABLED"}`); interaction.success(`administration/automod:${state ? "ENABLED" : "DISABLED"}`);
} else if (command === "ignore") { } else if (command === "ignore") {
data.guildData.plugins.automod.ignored.push(channel.id); data.guildData.plugins.automod.ignored.push(channel.id);
data.guildData.markModified("plugins.automod");
await data.guildData.save(); await data.guildData.save();
interaction.success("administration/automod:DISABLED_CHANNEL", { interaction.success("administration/automod:DISABLED_CHANNEL", {

View file

@ -66,6 +66,7 @@ class Autorole extends BaseCommand {
role: role.id, role: role.id,
}; };
data.guildData.markModified("plugins.autorole");
await data.guildData.save(); await data.guildData.save();
interaction.success("administration/autorole:SUCCESS_ENABLED", { interaction.success("administration/autorole:SUCCESS_ENABLED", {
@ -77,6 +78,7 @@ class Autorole extends BaseCommand {
role: null, role: null,
}; };
data.guildData.markModified("plugins.autorole");
await data.guildData.save(); await data.guildData.save();
interaction.success("administration/autorole:SUCCESS_DISABLED"); interaction.success("administration/autorole:SUCCESS_DISABLED");

View file

@ -203,6 +203,7 @@ async function changeSetting(interaction, setting, state, channel, guildData) {
if (!state) { if (!state) {
guildData.plugins[settingSplitted[0]][settingSplitted[1]] = null; guildData.plugins[settingSplitted[0]][settingSplitted[1]] = null;
guildData.markModified(`plugins.${settingSplitted[0]}`);
await guildData.save(); await guildData.save();
return interaction.reply({ return interaction.reply({
@ -215,6 +216,7 @@ async function changeSetting(interaction, setting, state, channel, guildData) {
if (channel) { if (channel) {
guildData.plugins[settingSplitted[0]][settingSplitted[1]] = channel.id; guildData.plugins[settingSplitted[0]][settingSplitted[1]] = channel.id;
guildData.markModified(`plugins.${settingSplitted[0]}`);
await guildData.save(); await guildData.save();
return interaction.reply({ return interaction.reply({

View file

@ -108,6 +108,7 @@ class Goodbye extends BaseCommand {
withImage: null, withImage: null,
}; };
data.guildData.markModified("plugins.goodbye");
await data.guildData.save(); await data.guildData.save();
interaction.success("administration/goodbye:DISABLED"); interaction.success("administration/goodbye:DISABLED");
@ -123,6 +124,7 @@ class Goodbye extends BaseCommand {
withImage: image, withImage: image,
}; };
data.guildData.markModified("plugins.goodbye");
await data.guildData.save(); await data.guildData.save();
interaction.success("administration/goodbye:ENABLED", { interaction.success("administration/goodbye:ENABLED", {

View file

@ -88,6 +88,7 @@ class Set extends BaseCommand {
case "level": { case "level": {
memberData.level = int; memberData.level = int;
memberData.markModified();
await memberData.save(); await memberData.save();
return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, { return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, {
@ -99,6 +100,7 @@ class Set extends BaseCommand {
case "xp": { case "xp": {
memberData.exp = int; memberData.exp = int;
memberData.markModified();
await memberData.save(); await memberData.save();
return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, { return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, {
@ -110,6 +112,7 @@ class Set extends BaseCommand {
case "credits": { case "credits": {
memberData.money = int; memberData.money = int;
memberData.markModified();
await memberData.save(); await memberData.save();
return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, { return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, {
@ -121,6 +124,7 @@ class Set extends BaseCommand {
case "bank": { case "bank": {
memberData.bankSold = int; memberData.bankSold = int;
memberData.markModified();
await memberData.save(); await memberData.save();
return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, { return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, {

View file

@ -52,6 +52,7 @@ class Setlang extends BaseCommand {
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

@ -108,6 +108,7 @@ class Welcome extends BaseCommand {
withImage: null, withImage: null,
}; };
data.guildData.markModified("plugins.welcome");
await data.guildData.save(); await data.guildData.save();
interaction.success("administration/welcome:DISABLED"); interaction.success("administration/welcome:DISABLED");
@ -123,6 +124,7 @@ class Welcome extends BaseCommand {
withImage: image, withImage: image,
}; };
data.guildData.markModified("plugins.welcome");
await data.guildData.save(); await data.guildData.save();
interaction.success("administration/welcome:ENABLED", { interaction.success("administration/welcome:ENABLED", {

View file

@ -47,7 +47,7 @@ class Achievements extends BaseCommand {
const user = interaction.options.getUser("user") || interaction.member; const user = interaction.options.getUser("user") || interaction.member;
if (user.bot) return interaction.error("economy/profile:BOT_USER"); if (user.bot) return interaction.error("economy/profile:BOT_USER");
const userData = user.id === interaction.user.id ? data.userData : await client.findOrCreateUser({ id: user.id }); const userData = user.id === interaction.user.id ? data.userData : await client.findOrCreateUser(user.id);
const embed = new EmbedBuilder() const embed = new EmbedBuilder()
.setAuthor({ .setAuthor({

View file

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

View file

@ -90,6 +90,7 @@ class Birthdate extends BaseCommand {
data.userData.birthdate = d; data.userData.birthdate = d;
data.userData.markModified();
await data.userData.save(); await data.userData.save();
interaction.success("economy/birthdate:SUCCESS", { interaction.success("economy/birthdate:SUCCESS", {

View file

@ -40,13 +40,13 @@ class Divorce extends BaseCommand {
data.userData.lover = null; data.userData.lover = null;
data.userData.markModified();
await data.userData.save(); await data.userData.save();
const oldLover = await client.findOrCreateUser({ const oldLover = await client.findOrCreateUser(user.id);
id: user.id,
});
oldLover.lover = null; oldLover.lover = null;
oldLover.markModified();
await oldLover.save(); await oldLover.save();
interaction.success("economy/divorce:DIVORCED", { interaction.success("economy/divorce:DIVORCED", {

View file

@ -52,9 +52,7 @@ class Marry extends BaseCommand {
if (member.user.bot) return interaction.error("economy/marry:BOT_USER"); if (member.user.bot) return interaction.error("economy/marry:BOT_USER");
if (member.id === interaction.member.id) return interaction.error("economy/marry:YOURSELF"); if (member.id === interaction.member.id) return interaction.error("economy/marry:YOURSELF");
const userData = await client.findOrCreateUser({ const userData = await client.findOrCreateUser(member.id);
id: member.id,
});
if (userData.lover) return interaction.error("economy/marry:ALREADY_MARRIED_USER", { user: member.toString() }); if (userData.lover) return interaction.error("economy/marry:ALREADY_MARRIED_USER", { user: member.toString() });
for (const requester in pendings) { for (const requester in pendings) {
@ -130,6 +128,8 @@ class Marry extends BaseCommand {
data.userData.lover = member.id; data.userData.lover = member.id;
userData.lover = interaction.member.id; userData.lover = interaction.member.id;
data.userData.markModified();
userData.markModified();
await data.userData.save(); await data.userData.save();
await userData.save(); await userData.save();
@ -150,6 +150,7 @@ class Marry extends BaseCommand {
userData.achievements.married.achieved = true; userData.achievements.married.achieved = true;
userData.achievements.married.progress.now = 1; userData.achievements.married.progress.now = 1;
userData.markModified();
await userData.save(); await userData.save();
} }
@ -158,6 +159,7 @@ class Marry extends BaseCommand {
data.userData.achievements.married.achieved = true; data.userData.achievements.married.achieved = true;
data.userData.achievements.married.progress.now = 1; data.userData.achievements.married.progress.now = 1;
data.userData.markModified();
await data.userData.save(); await data.userData.save();
} }

View file

@ -73,10 +73,12 @@ class Pay extends BaseCommand {
data.memberData.money -= amount; data.memberData.money -= amount;
data.memberData.markModified();
await data.memberData.save(); await data.memberData.save();
memberData.money += amount; memberData.money += amount;
memberData.markModified();
await memberData.save(); await memberData.save();
const info1 = { const info1 = {

View file

@ -50,7 +50,7 @@ class Profile extends BaseCommand {
if (member.user.bot) return interaction.error("economy/profile:BOT_USER"); if (member.user.bot) return interaction.error("economy/profile:BOT_USER");
const memberData = member.id === interaction.user.id ? data.memberData : await client.findOrCreateMember({ id: member.id, guildId: interaction.guildId }); const memberData = member.id === interaction.user.id ? data.memberData : await client.findOrCreateMember({ id: member.id, guildId: interaction.guildId });
const userData = member.id === interaction.user.id ? data.userData : await client.findOrCreateUser({ id: member.id }); const userData = member.id === interaction.user.id ? data.userData : await client.findOrCreateUser(member.id);
if (userData.lover && !client.users.cache.find(u => u.id === userData.lover)) await client.users.fetch(userData.lover, true); if (userData.lover && !client.users.cache.find(u => u.id === userData.lover)) await client.users.fetch(userData.lover, true);
const guilds = client.guilds.cache.filter(g => g.members.cache.find(m => m.id === member.id)); const guilds = client.guilds.cache.filter(g => g.members.cache.find(m => m.id === member.id));

View file

@ -62,11 +62,10 @@ class Rep extends BaseCommand {
data.userData.cooldowns.rep = toWait; data.userData.cooldowns.rep = toWait;
data.userData.markModified();
await data.userData.save(); await data.userData.save();
const userData = await client.findOrCreateUser({ const userData = await client.findOrCreateUser(user.id);
id: user.id,
});
userData.rep++; userData.rep++;
@ -86,6 +85,7 @@ class Rep extends BaseCommand {
} }
} }
userData.markModified();
await userData.save(); await userData.save();
interaction.success("economy/rep:SUCCESS", { interaction.success("economy/rep:SUCCESS", {

View file

@ -88,6 +88,7 @@ class Rob extends BaseCommand {
memberData.cooldowns.rob = toWait; memberData.cooldowns.rob = toWait;
memberData.markModified();
await memberData.save(); await memberData.save();
interaction.replyT("economy/rob:ROB_WON_" + randomNum, { interaction.replyT("economy/rob:ROB_WON_" + randomNum, {
@ -98,6 +99,8 @@ class Rob extends BaseCommand {
data.memberData.money += amount; data.memberData.money += amount;
memberData.money -= amount; memberData.money -= amount;
data.memberData.markModified();
memberData.markModified();
await data.memberData.save(); await data.memberData.save();
await memberData.save(); await memberData.save();
} else { } else {
@ -113,6 +116,8 @@ class Rob extends BaseCommand {
data.memberData.money -= potentiallyLose; data.memberData.money -= potentiallyLose;
memberData.money += won; memberData.money += won;
data.memberData.markModified();
memberData.markModified();
await data.memberData.save(); await data.memberData.save();
await memberData.save(); await memberData.save();
} }

View file

@ -50,6 +50,7 @@ class Setbio extends BaseCommand {
data.userData.bio = newBio; data.userData.bio = newBio;
data.userData.markModified();
await data.userData.save(); await data.userData.save();
interaction.success("economy/setbio:SUCCESS"); interaction.success("economy/setbio:SUCCESS");

View file

@ -143,9 +143,11 @@ class Slots extends BaseCommand {
}); });
} }
data.userData.markModified();
await data.userData.save(); await data.userData.save();
} }
data.memberData.markModified();
await data.memberData.save(); await data.memberData.save();
return; return;
@ -191,9 +193,11 @@ class Slots extends BaseCommand {
}); });
} }
data.userData.markModified();
await data.userData.save(); await data.userData.save();
} }
data.memberData.markModified();
await data.memberData.save(); await data.memberData.save();
return; return;
@ -220,9 +224,11 @@ class Slots extends BaseCommand {
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;
data.userData.markModified();
await data.userData.save(); await data.userData.save();
} }
data.memberData.markModified();
await data.memberData.save(); await data.memberData.save();
return; return;

View file

@ -47,6 +47,7 @@ class Transactions extends BaseCommand {
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

@ -48,6 +48,7 @@ class Work extends BaseCommand {
data.memberData.cooldowns.work = toWait; data.memberData.cooldowns.work = toWait;
data.memberData.workStreak = (data.memberData.workStreak || 0) + 1; data.memberData.workStreak = (data.memberData.workStreak || 0) + 1;
data.memberData.markModified();
await data.memberData.save(); await data.memberData.save();
const embed = new EmbedBuilder() const embed = new EmbedBuilder()
@ -98,6 +99,7 @@ class Work extends BaseCommand {
data.memberData.money += won; data.memberData.money += won;
data.memberData.markModified();
await data.memberData.save(); await data.memberData.save();
const info = { const info = {
@ -124,6 +126,7 @@ class Work extends BaseCommand {
data.userData.achievements.work.achieved = true; data.userData.achievements.work.achieved = true;
} }
data.userData.markModified();
await data.userData.save(); await data.userData.save();
} }

View file

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

View file

@ -58,15 +58,17 @@ class TicTacToe extends BaseCommand {
memberData.money += 100; memberData.money += 100;
await memberData.save();
const info = { const info = {
user: interaction.translate("economy/transactions:TTT"), user: interaction.translate("economy/transactions:TTT"),
amount: 100, amount: 100,
date: Date.now(), date: Date.now(),
type: "got", type: "got",
}; };
memberData.transactions.push(info); memberData.transactions.push(info);
memberData.markModified();
await memberData.save();
}); });
} }
} }

View file

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

View file

@ -72,6 +72,7 @@ class Remindme extends BaseCommand {
data.userData.reminds.push(rData); data.userData.reminds.push(rData);
data.userData.markModified("reminds");
await data.userData.save(); await data.userData.save();
client.databaseCache.usersReminds.set(interaction.user.id, data.userData); client.databaseCache.usersReminds.set(interaction.user.id, data.userData);

View file

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

View file

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

View file

@ -136,9 +136,7 @@ class Debug extends BaseCommand {
const member = interaction.options.getMember("user"); const member = interaction.options.getMember("user");
if (member.user.bot) return interaction.error("misc:BOT_USER", null, { ephemeral: true }); if (member.user.bot) return interaction.error("misc:BOT_USER", null, { ephemeral: true });
const userData = await client.findOrCreateUser({ const userData = await client.findOrCreateUser(member.id),
id: member.id,
}),
memberData = await client.findOrCreateMember({ memberData = await client.findOrCreateMember({
id: member.id, id: member.id,
guildId: interaction.guildId, guildId: interaction.guildId,
@ -148,6 +146,7 @@ class Debug extends BaseCommand {
case "level": { case "level": {
memberData.level = int; memberData.level = int;
memberData.markModified();
await memberData.save(); await memberData.save();
return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, { return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, {
@ -159,6 +158,7 @@ class Debug extends BaseCommand {
case "xp": { case "xp": {
memberData.exp = int; memberData.exp = int;
memberData.markModified();
await memberData.save(); await memberData.save();
return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, { return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, {
@ -170,6 +170,7 @@ class Debug extends BaseCommand {
case "credits": { case "credits": {
memberData.money = int; memberData.money = int;
memberData.markModified();
await memberData.save(); await memberData.save();
return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, { return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, {
@ -181,6 +182,7 @@ class Debug extends BaseCommand {
case "bank": { case "bank": {
memberData.bankSold = int; memberData.bankSold = int;
memberData.markModified();
await memberData.save(); await memberData.save();
return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, { return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, {
@ -192,6 +194,7 @@ class Debug extends BaseCommand {
case "rep": { case "rep": {
userData.rep = int; userData.rep = int;
userData.markModified();
await userData.save(); await userData.save();
return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, { return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, {
@ -207,9 +210,7 @@ class Debug extends BaseCommand {
const member = interaction.options.getMember("target"); const member = interaction.options.getMember("target");
if (member.user.bot) return interaction.error("misc:BOT_USER", null, { ephemeral: true }); if (member.user.bot) return interaction.error("misc:BOT_USER", null, { ephemeral: true });
const userData = await client.findOrCreateUser({ const userData = await client.findOrCreateUser(member.id),
id: member.id,
}),
memberData = await client.findOrCreateMember({ memberData = await client.findOrCreateMember({
id: member.id, id: member.id,
guildId: interaction.guildId, guildId: interaction.guildId,
@ -219,6 +220,7 @@ class Debug extends BaseCommand {
case "level": { case "level": {
memberData.level += int; memberData.level += int;
memberData.markModified();
await memberData.save(); await memberData.save();
return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, { return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, {
@ -230,6 +232,7 @@ class Debug extends BaseCommand {
case "xp": { case "xp": {
memberData.exp += int; memberData.exp += int;
memberData.markModified();
await memberData.save(); await memberData.save();
return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, { return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, {
@ -241,6 +244,7 @@ class Debug extends BaseCommand {
case "credits": { case "credits": {
memberData.money += int; memberData.money += int;
memberData.markModified();
await memberData.save(); await memberData.save();
return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, { return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, {
@ -252,6 +256,7 @@ class Debug extends BaseCommand {
case "bank": { case "bank": {
memberData.bankSold += int; memberData.bankSold += int;
memberData.markModified();
await memberData.save(); await memberData.save();
return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, { return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, {
@ -263,6 +268,7 @@ class Debug extends BaseCommand {
case "rep": { case "rep": {
userData.rep += int; userData.rep += int;
userData.markModified();
await userData.save(); await userData.save();
return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, { return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, {

View file

@ -45,6 +45,7 @@ class CreateTicketEmbed extends BaseCommand {
guildData.plugins.tickets.count++; guildData.plugins.tickets.count++;
guildData.markModified("plugins.tickets");
await guildData.save(); await guildData.save();
const channel = await interaction.guild.channels.create({ const channel = await interaction.guild.channels.create({

View file

@ -29,6 +29,7 @@ module.exports = client => [
guildData.language = newData; guildData.language = newData;
guildData.markModified();
await guildData.save(); await guildData.save();
return; return;
@ -54,6 +55,7 @@ module.exports = client => [
guildData.plugins.welcome.enabled = newData; guildData.plugins.welcome.enabled = newData;
guildData.markModified("plugins");
await guildData.save(); await guildData.save();
return; return;
@ -74,6 +76,7 @@ module.exports = client => [
guildData.plugins.welcome.withImage = newData; guildData.plugins.welcome.withImage = newData;
guildData.markModified("plugins");
await guildData.save(); await guildData.save();
return; return;
@ -94,6 +97,7 @@ module.exports = client => [
guildData.plugins.welcome.message = newData !== "" ? newData : null; guildData.plugins.welcome.message = newData !== "" ? newData : null;
guildData.markModified("plugins");
await guildData.save(); await guildData.save();
return; return;
@ -114,6 +118,7 @@ module.exports = client => [
guildData.plugins.welcome.channel = newData !== "" ? newData : null; guildData.plugins.welcome.channel = newData !== "" ? newData : null;
guildData.markModified("plugins");
await guildData.save(); await guildData.save();
return; return;
@ -141,6 +146,7 @@ module.exports = client => [
guildData.plugins.goodbye.enabled = newData; guildData.plugins.goodbye.enabled = newData;
guildData.markModified("plugins");
await guildData.save(); await guildData.save();
return; return;
@ -161,6 +167,7 @@ module.exports = client => [
guildData.plugins.goodbye.withImage = newData; guildData.plugins.goodbye.withImage = newData;
guildData.markModified("plugins");
await guildData.save(); await guildData.save();
return; return;
@ -181,6 +188,7 @@ module.exports = client => [
guildData.plugins.goodbye.message = newData !== "" ? newData : null; guildData.plugins.goodbye.message = newData !== "" ? newData : null;
guildData.markModified("plugins");
await guildData.save(); await guildData.save();
return; return;
@ -201,6 +209,7 @@ module.exports = client => [
guildData.plugins.goodbye.channel = newData !== "" ? newData : null; guildData.plugins.goodbye.channel = newData !== "" ? newData : null;
guildData.markModified("plugins");
await guildData.save(); await guildData.save();
return; return;
@ -228,6 +237,7 @@ module.exports = client => [
guildData.plugins.autorole.enabled = newData; guildData.plugins.autorole.enabled = newData;
guildData.markModified("plugins");
await guildData.save(); await guildData.save();
return; return;
@ -248,6 +258,7 @@ module.exports = client => [
guildData.plugins.autorole.role = newData !== "" ? newData : null; guildData.plugins.autorole.role = newData !== "" ? newData : null;
guildData.markModified("plugins");
await guildData.save(); await guildData.save();
return; return;
@ -275,6 +286,7 @@ module.exports = client => [
guildData.plugins.automod.enabled = newData; guildData.plugins.automod.enabled = newData;
guildData.markModified("plugins");
await guildData.save(); await guildData.save();
return; return;
@ -295,6 +307,7 @@ module.exports = client => [
guildData.plugins.automod.ignored = newData; guildData.plugins.automod.ignored = newData;
guildData.markModified("plugins");
await guildData.save(); await guildData.save();
return; return;
@ -324,6 +337,7 @@ module.exports = client => [
guildData.plugins.monitoring.messageUpdate = newData !== "" ? newData : null; guildData.plugins.monitoring.messageUpdate = newData !== "" ? newData : null;
guildData.markModified("plugins");
await guildData.save(); await guildData.save();
return; return;
@ -346,6 +360,7 @@ module.exports = client => [
guildData.plugins.monitoring.messageDelete = newData !== "" ? newData : null; guildData.plugins.monitoring.messageDelete = newData !== "" ? newData : null;
guildData.markModified("plugins");
await guildData.save(); await guildData.save();
return; return;
@ -373,6 +388,7 @@ module.exports = client => [
guildData.plugins.suggestions = newData !== "" ? newData : null; guildData.plugins.suggestions = newData !== "" ? newData : null;
guildData.markModified("plugins");
await guildData.save(); await guildData.save();
return; return;
@ -393,6 +409,7 @@ module.exports = client => [
guildData.plugins.reports = newData !== "" ? newData : null; guildData.plugins.reports = newData !== "" ? newData : null;
guildData.markModified("plugins");
await guildData.save(); await guildData.save();
return; return;
@ -413,6 +430,7 @@ module.exports = client => [
guildData.plugins.birthdays = newData !== "" ? newData : null; guildData.plugins.birthdays = newData !== "" ? newData : null;
guildData.markModified("plugins");
await guildData.save(); await guildData.save();
return; return;
@ -433,6 +451,7 @@ module.exports = client => [
guildData.plugins.modlogs = newData !== "" ? newData : null; guildData.plugins.modlogs = newData !== "" ? newData : null;
guildData.markModified("plugins");
await guildData.save(); await guildData.save();
return; return;

View file

@ -18,7 +18,7 @@ class CommandHandler extends BaseEvent {
const command = client.commands.get(interaction.commandName); const command = client.commands.get(interaction.commandName);
const data = []; const data = [];
const userData = await client.findOrCreateUser({ id: interaction.user.id }); const userData = await client.findOrCreateUser(interaction.user.id);
data.userData = userData; data.userData = userData;
if (interaction.inGuild()) { if (interaction.inGuild()) {
@ -51,6 +51,7 @@ class CommandHandler extends BaseEvent {
userData.achievements.firstCommand.progress.now = 1; userData.achievements.firstCommand.progress.now = 1;
userData.achievements.firstCommand.achieved = true; userData.achievements.firstCommand.achieved = true;
userData.markModified("achievements");
await userData.save(); await userData.save();
interaction.user.send(args); interaction.user.send(args);

View file

@ -15,12 +15,13 @@ class GuildCreate extends BaseEvent {
* @param {import("discord.js").Guild} guild * @param {import("discord.js").Guild} guild
*/ */
async execute(client, guild) { async execute(client, guild) {
const userData = await client.findOrCreateUser({ id: guild.ownerId }); const userData = await client.findOrCreateUser(guild.ownerId);
if (!userData.achievements.invite.achieved) { if (!userData.achievements.invite.achieved) {
userData.achievements.invite.progress.now = 1; userData.achievements.invite.progress.now = 1;
userData.achievements.invite.achieved = true; userData.achievements.invite.achieved = true;
userData.markModified("achievements");
await userData.save(); await userData.save();
} }

View file

@ -138,7 +138,8 @@ class GuildMemberAdd extends BaseEvent {
content: message, content: message,
files: [attachment], files: [attachment],
}); });
} else channel.send({ content: message }); } else
channel.send({ content: message });
} }
} }
} }

View file

@ -141,7 +141,8 @@ class GuildMemberRemove extends BaseEvent {
content: message, content: message,
files: [attachment], files: [attachment],
}); });
} else channel.send({ content: message }); } else
channel.send({ content: message });
} }
} }
} }

View file

@ -20,11 +20,12 @@ class GuildMemberUpdate extends BaseEvent {
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")) {
const userData = await client.findOrCreateUser({ id: newMember.id }); const userData = await client.findOrCreateUser(newMember.id);
userData.achievements.tip.progress.now = 1; userData.achievements.tip.progress.now = 1;
userData.achievements.tip.achieved = true; userData.achievements.tip.achieved = true;
userData.markModified("achievements");
await userData.save(); await userData.save();
newMember.send({ newMember.send({

View file

@ -24,7 +24,7 @@ class MessageCreate extends BaseEvent {
if (message.author.bot) return; if (message.author.bot) return;
if (message.content.match(new RegExp(`^<@!?${client.user.id}>( |)$`))) return message.replyT("misc:HELLO_SERVER", null, { mention: true }); if (message.content.match(new RegExp(`^<@!?${client.user.id}>( |)$`))) return message.replyT("misc:HELLO_SERVER", null, { mention: true });
const userData = await client.findOrCreateUser({ id: message.author.id }); const userData = await client.findOrCreateUser(message.author.id);
data.userData = userData; data.userData = userData;
if (message.guild && !message.member) await message.guild.members.fetch(message.author.id); if (message.guild && !message.member) await message.guild.members.fetch(message.author.id);
@ -105,10 +105,10 @@ class MessageCreate extends BaseEvent {
message.delete(); message.delete();
} }
const afkReason = data.userData.afk; if (data.userData.afk) {
if (afkReason) {
data.userData.afk = null; data.userData.afk = null;
data.userData.markModified();
await data.userData.save(); await data.userData.save();
message.replyT("general/afk:DELETED", { message.replyT("general/afk:DELETED", {
@ -117,7 +117,7 @@ class MessageCreate extends BaseEvent {
} }
message.mentions.users.forEach(async u => { message.mentions.users.forEach(async u => {
const userData = await client.findOrCreateUser({ id: u.id }); const userData = await client.findOrCreateUser(u.id);
if (userData.afk) message.replyT("general/afk:IS_AFK", { user: u.getUsername(), reason: userData.afk }, { ephemeral: true }); if (userData.afk) message.replyT("general/afk:IS_AFK", { user: u.getUsername(), reason: userData.afk }, { ephemeral: true });
}); });
@ -156,6 +156,7 @@ async function updateXp(client, msg, memberData) {
}, { mention: false }); }, { mention: false });
} else memberData.exp = parseInt(newXp, 10); } else memberData.exp = parseInt(newXp, 10);
memberData.markModified();
await memberData.save(); await memberData.save();
} }

View file

@ -49,6 +49,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");
await user.save(); await 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

@ -30,6 +30,7 @@ module.exports.init = async function (client) {
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();
} }
} }
@ -45,6 +46,7 @@ module.exports.init = async function (client) {
client.usersData.deleteOne({ id: u.id }); client.usersData.deleteOne({ id: u.id });
client.logger.log(`Removed from database deleted user - ID: ${u.id} Username: ${u.username}`); client.logger.log(`Removed from database deleted user - ID: ${u.id} Username: ${u.username}`);
client.usersData.markModified();
client.usersData.save(); client.usersData.save();
} }
}); });
@ -59,6 +61,7 @@ module.exports.init = async function (client) {
client.membersData.deleteOne({ id: u.id }); client.membersData.deleteOne({ id: u.id });
client.logger.log(`Removed from database deleted user - ID: ${u.id} Username: ${u.username}`); client.logger.log(`Removed from database deleted user - ID: ${u.id} Username: ${u.username}`);
client.membersData.markModified();
client.membersData.save(); client.membersData.save();
} }
}); });

View file

@ -14,25 +14,25 @@
"@discordjs/opus": "^0.9.0", "@discordjs/opus": "^0.9.0",
"@discordjs/rest": "^2.0.1", "@discordjs/rest": "^2.0.1",
"@discordjs/voice": "^0.16.0", "@discordjs/voice": "^0.16.0",
"canvas": "^2.10.2", "canvas": "^2.11.2",
"chalk": "^4.1.2", "chalk": "^4.1.2",
"cron": "^2.1.0", "cron": "^2.4.4",
"discord-api-types": "^0.37.62", "discord-api-types": "^0.37.62",
"discord-giveaways": "^6.0.1", "discord-giveaways": "^6.0.1",
"discord-player": "^6.6.6", "discord-player": "^6.6.6",
"discord.js": "^14.13.0", "discord.js": "^14.13.0",
"gamedig": "^4.0.2", "gamedig": "^4.1.0",
"i18next": "^21.9.1", "i18next": "^21.10.0",
"i18next-fs-backend": "^1.1.5", "i18next-fs-backend": "^1.2.0",
"md5": "^2.2.1", "md5": "^2.3.0",
"moment": "^2.26.0", "moment": "^2.29.4",
"mongoose": "^7.6.3", "mongoose": "^7.6.3",
"ms": "^2.1.3", "ms": "^2.1.3",
"node-fetch": "^2.6.7", "node-fetch": "^2.7.0",
"youtube-ext": "^1.1.16" "youtube-ext": "^1.1.16"
}, },
"devDependencies": { "devDependencies": {
"eslint": "^8.23.0" "eslint": "^8.52.0"
}, },
"eslintConfig": { "eslintConfig": {
"env": { "env": {

File diff suppressed because it is too large Load diff