mirror of
https://github.com/JonnyBro/JaBa.git
synced 2024-11-21 20:54:58 +05:00
update depends
This commit is contained in:
parent
3410fb2091
commit
113f4ae3e0
41 changed files with 347 additions and 376 deletions
|
@ -249,6 +249,8 @@ class JaBa extends Client {
|
|||
return userData;
|
||||
} else {
|
||||
userData = new this.usersData({ id: userID });
|
||||
|
||||
userData.markModified();
|
||||
await userData.save();
|
||||
|
||||
this.databaseCache.users.set(userID, userData);
|
||||
|
@ -272,6 +274,8 @@ class JaBa extends Client {
|
|||
return memberData;
|
||||
} else {
|
||||
memberData = new this.membersData({ id: memberID, guildID: guildId });
|
||||
|
||||
memberData.markModified();
|
||||
await memberData.save();
|
||||
|
||||
const guildData = await this.findOrCreateGuild(guildId);
|
||||
|
@ -279,6 +283,7 @@ class JaBa extends Client {
|
|||
if (guildData) {
|
||||
guildData.members.push(memberData._id);
|
||||
|
||||
guildData.markModified("members");
|
||||
await guildData.save();
|
||||
}
|
||||
|
||||
|
@ -302,6 +307,8 @@ class JaBa extends Client {
|
|||
return guildData;
|
||||
} else {
|
||||
guildData = new this.guildsData({ id: guildId });
|
||||
|
||||
guildData.markModified();
|
||||
await guildData.save();
|
||||
|
||||
this.databaseCache.guilds.set(guildId, guildData);
|
||||
|
|
|
@ -39,6 +39,7 @@ class ImportMee6 extends BaseCommand {
|
|||
|
||||
data.memberData.level = level;
|
||||
|
||||
data.memberData.markModified();
|
||||
await data.memberData.save();
|
||||
|
||||
interaction.editReply({
|
||||
|
|
|
@ -85,12 +85,14 @@ class Automod extends BaseCommand {
|
|||
ignored: [],
|
||||
};
|
||||
|
||||
data.guildData.markModified("plugins.automod");
|
||||
await data.guildData.save();
|
||||
|
||||
interaction.success(`administration/automod:${state ? "ENABLED" : "DISABLED"}`);
|
||||
} else if (command === "ignore") {
|
||||
data.guildData.plugins.automod.ignored.push(channel.id);
|
||||
|
||||
data.guildData.markModified("plugins.automod");
|
||||
await data.guildData.save();
|
||||
|
||||
interaction.success("administration/automod:DISABLED_CHANNEL", {
|
||||
|
|
|
@ -66,6 +66,7 @@ class Autorole extends BaseCommand {
|
|||
role: role.id,
|
||||
};
|
||||
|
||||
data.guildData.markModified("plugins.autorole");
|
||||
await data.guildData.save();
|
||||
|
||||
interaction.success("administration/autorole:SUCCESS_ENABLED", {
|
||||
|
@ -77,6 +78,7 @@ class Autorole extends BaseCommand {
|
|||
role: null,
|
||||
};
|
||||
|
||||
data.guildData.markModified("plugins.autorole");
|
||||
await data.guildData.save();
|
||||
|
||||
interaction.success("administration/autorole:SUCCESS_DISABLED");
|
||||
|
|
|
@ -203,6 +203,7 @@ async function changeSetting(interaction, setting, state, channel, guildData) {
|
|||
if (!state) {
|
||||
guildData.plugins[settingSplitted[0]][settingSplitted[1]] = null;
|
||||
|
||||
guildData.markModified(`plugins.${settingSplitted[0]}`);
|
||||
await guildData.save();
|
||||
|
||||
return interaction.reply({
|
||||
|
@ -215,6 +216,7 @@ async function changeSetting(interaction, setting, state, channel, guildData) {
|
|||
if (channel) {
|
||||
guildData.plugins[settingSplitted[0]][settingSplitted[1]] = channel.id;
|
||||
|
||||
guildData.markModified(`plugins.${settingSplitted[0]}`);
|
||||
await guildData.save();
|
||||
|
||||
return interaction.reply({
|
||||
|
|
|
@ -108,6 +108,7 @@ class Goodbye extends BaseCommand {
|
|||
withImage: null,
|
||||
};
|
||||
|
||||
data.guildData.markModified("plugins.goodbye");
|
||||
await data.guildData.save();
|
||||
|
||||
interaction.success("administration/goodbye:DISABLED");
|
||||
|
@ -123,6 +124,7 @@ class Goodbye extends BaseCommand {
|
|||
withImage: image,
|
||||
};
|
||||
|
||||
data.guildData.markModified("plugins.goodbye");
|
||||
await data.guildData.save();
|
||||
|
||||
interaction.success("administration/goodbye:ENABLED", {
|
||||
|
|
|
@ -88,6 +88,7 @@ class Set extends BaseCommand {
|
|||
case "level": {
|
||||
memberData.level = int;
|
||||
|
||||
memberData.markModified();
|
||||
await memberData.save();
|
||||
|
||||
return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, {
|
||||
|
@ -99,6 +100,7 @@ class Set extends BaseCommand {
|
|||
case "xp": {
|
||||
memberData.exp = int;
|
||||
|
||||
memberData.markModified();
|
||||
await memberData.save();
|
||||
|
||||
return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, {
|
||||
|
@ -110,6 +112,7 @@ class Set extends BaseCommand {
|
|||
case "credits": {
|
||||
memberData.money = int;
|
||||
|
||||
memberData.markModified();
|
||||
await memberData.save();
|
||||
|
||||
return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, {
|
||||
|
@ -121,6 +124,7 @@ class Set extends BaseCommand {
|
|||
case "bank": {
|
||||
memberData.bankSold = int;
|
||||
|
||||
memberData.markModified();
|
||||
await memberData.save();
|
||||
|
||||
return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, {
|
||||
|
|
|
@ -52,6 +52,7 @@ class Setlang extends BaseCommand {
|
|||
|
||||
data.guildData.language = language.name;
|
||||
|
||||
data.guildData.markModified("language");
|
||||
await data.guildData.save();
|
||||
|
||||
return interaction.success("administration/setlang:SUCCESS", {
|
||||
|
|
|
@ -108,6 +108,7 @@ class Welcome extends BaseCommand {
|
|||
withImage: null,
|
||||
};
|
||||
|
||||
data.guildData.markModified("plugins.welcome");
|
||||
await data.guildData.save();
|
||||
|
||||
interaction.success("administration/welcome:DISABLED");
|
||||
|
@ -123,6 +124,7 @@ class Welcome extends BaseCommand {
|
|||
withImage: image,
|
||||
};
|
||||
|
||||
data.guildData.markModified("plugins.welcome");
|
||||
await data.guildData.save();
|
||||
|
||||
interaction.success("administration/welcome:ENABLED", {
|
||||
|
|
|
@ -47,7 +47,7 @@ class Achievements extends BaseCommand {
|
|||
const user = interaction.options.getUser("user") || interaction.member;
|
||||
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()
|
||||
.setAuthor({
|
||||
|
|
|
@ -69,6 +69,7 @@ class Bank extends BaseCommand {
|
|||
data.memberData.money -= credits;
|
||||
data.memberData.bankSold += credits;
|
||||
|
||||
data.memberData.markModified();
|
||||
await data.memberData.save();
|
||||
|
||||
const info = {
|
||||
|
@ -102,6 +103,7 @@ class Bank extends BaseCommand {
|
|||
data.memberData.money += credits;
|
||||
data.memberData.bankSold -= credits;
|
||||
|
||||
data.memberData.markModified();
|
||||
await data.memberData.save();
|
||||
|
||||
interaction.success("economy/bank:SUCCESS_WD", {
|
||||
|
|
|
@ -90,6 +90,7 @@ class Birthdate extends BaseCommand {
|
|||
|
||||
data.userData.birthdate = d;
|
||||
|
||||
data.userData.markModified();
|
||||
await data.userData.save();
|
||||
|
||||
interaction.success("economy/birthdate:SUCCESS", {
|
||||
|
|
|
@ -40,13 +40,13 @@ class Divorce extends BaseCommand {
|
|||
|
||||
data.userData.lover = null;
|
||||
|
||||
data.userData.markModified();
|
||||
await data.userData.save();
|
||||
|
||||
const oldLover = await client.findOrCreateUser({
|
||||
id: user.id,
|
||||
});
|
||||
const oldLover = await client.findOrCreateUser(user.id);
|
||||
oldLover.lover = null;
|
||||
|
||||
oldLover.markModified();
|
||||
await oldLover.save();
|
||||
|
||||
interaction.success("economy/divorce:DIVORCED", {
|
||||
|
|
|
@ -52,9 +52,7 @@ class Marry extends BaseCommand {
|
|||
if (member.user.bot) return interaction.error("economy/marry:BOT_USER");
|
||||
if (member.id === interaction.member.id) return interaction.error("economy/marry:YOURSELF");
|
||||
|
||||
const userData = await client.findOrCreateUser({
|
||||
id: member.id,
|
||||
});
|
||||
const userData = await client.findOrCreateUser(member.id);
|
||||
if (userData.lover) return interaction.error("economy/marry:ALREADY_MARRIED_USER", { user: member.toString() });
|
||||
|
||||
for (const requester in pendings) {
|
||||
|
@ -130,6 +128,8 @@ class Marry extends BaseCommand {
|
|||
data.userData.lover = member.id;
|
||||
userData.lover = interaction.member.id;
|
||||
|
||||
data.userData.markModified();
|
||||
userData.markModified();
|
||||
await data.userData.save();
|
||||
await userData.save();
|
||||
|
||||
|
@ -150,6 +150,7 @@ class Marry extends BaseCommand {
|
|||
userData.achievements.married.achieved = true;
|
||||
userData.achievements.married.progress.now = 1;
|
||||
|
||||
userData.markModified();
|
||||
await userData.save();
|
||||
}
|
||||
|
||||
|
@ -158,6 +159,7 @@ class Marry extends BaseCommand {
|
|||
data.userData.achievements.married.achieved = true;
|
||||
data.userData.achievements.married.progress.now = 1;
|
||||
|
||||
data.userData.markModified();
|
||||
await data.userData.save();
|
||||
}
|
||||
|
||||
|
|
|
@ -73,10 +73,12 @@ class Pay extends BaseCommand {
|
|||
|
||||
data.memberData.money -= amount;
|
||||
|
||||
data.memberData.markModified();
|
||||
await data.memberData.save();
|
||||
|
||||
memberData.money += amount;
|
||||
|
||||
memberData.markModified();
|
||||
await memberData.save();
|
||||
|
||||
const info1 = {
|
||||
|
|
|
@ -50,7 +50,7 @@ class Profile extends BaseCommand {
|
|||
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 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);
|
||||
|
||||
const guilds = client.guilds.cache.filter(g => g.members.cache.find(m => m.id === member.id));
|
||||
|
|
|
@ -62,11 +62,10 @@ class Rep extends BaseCommand {
|
|||
|
||||
data.userData.cooldowns.rep = toWait;
|
||||
|
||||
data.userData.markModified();
|
||||
await data.userData.save();
|
||||
|
||||
const userData = await client.findOrCreateUser({
|
||||
id: user.id,
|
||||
});
|
||||
const userData = await client.findOrCreateUser(user.id);
|
||||
|
||||
userData.rep++;
|
||||
|
||||
|
@ -86,6 +85,7 @@ class Rep extends BaseCommand {
|
|||
}
|
||||
}
|
||||
|
||||
userData.markModified();
|
||||
await userData.save();
|
||||
|
||||
interaction.success("economy/rep:SUCCESS", {
|
||||
|
|
|
@ -88,6 +88,7 @@ class Rob extends BaseCommand {
|
|||
|
||||
memberData.cooldowns.rob = toWait;
|
||||
|
||||
memberData.markModified();
|
||||
await memberData.save();
|
||||
|
||||
interaction.replyT("economy/rob:ROB_WON_" + randomNum, {
|
||||
|
@ -98,6 +99,8 @@ class Rob extends BaseCommand {
|
|||
data.memberData.money += amount;
|
||||
memberData.money -= amount;
|
||||
|
||||
data.memberData.markModified();
|
||||
memberData.markModified();
|
||||
await data.memberData.save();
|
||||
await memberData.save();
|
||||
} else {
|
||||
|
@ -113,6 +116,8 @@ class Rob extends BaseCommand {
|
|||
data.memberData.money -= potentiallyLose;
|
||||
memberData.money += won;
|
||||
|
||||
data.memberData.markModified();
|
||||
memberData.markModified();
|
||||
await data.memberData.save();
|
||||
await memberData.save();
|
||||
}
|
||||
|
|
|
@ -50,6 +50,7 @@ class Setbio extends BaseCommand {
|
|||
|
||||
data.userData.bio = newBio;
|
||||
|
||||
data.userData.markModified();
|
||||
await data.userData.save();
|
||||
|
||||
interaction.success("economy/setbio:SUCCESS");
|
||||
|
|
|
@ -143,9 +143,11 @@ class Slots extends BaseCommand {
|
|||
});
|
||||
}
|
||||
|
||||
data.userData.markModified();
|
||||
await data.userData.save();
|
||||
}
|
||||
|
||||
data.memberData.markModified();
|
||||
await data.memberData.save();
|
||||
|
||||
return;
|
||||
|
@ -191,9 +193,11 @@ class Slots extends BaseCommand {
|
|||
});
|
||||
}
|
||||
|
||||
data.userData.markModified();
|
||||
await data.userData.save();
|
||||
}
|
||||
|
||||
data.memberData.markModified();
|
||||
await data.memberData.save();
|
||||
|
||||
return;
|
||||
|
@ -220,9 +224,11 @@ class Slots extends BaseCommand {
|
|||
if (!data.userData.achievements.slots.achieved) {
|
||||
data.userData.achievements.slots.progress.now = 0;
|
||||
|
||||
data.userData.markModified();
|
||||
await data.userData.save();
|
||||
}
|
||||
|
||||
data.memberData.markModified();
|
||||
await data.memberData.save();
|
||||
|
||||
return;
|
||||
|
|
|
@ -47,6 +47,7 @@ class Transactions extends BaseCommand {
|
|||
if (interaction.options.getBoolean("clear")) {
|
||||
data.memberData.transactions = [];
|
||||
|
||||
data.memberData.markModified("transactions");
|
||||
await data.memberData.save();
|
||||
|
||||
return interaction.success("economy/transactions:CLEARED", null, { ephemeral: true });
|
||||
|
|
|
@ -48,6 +48,7 @@ class Work extends BaseCommand {
|
|||
data.memberData.cooldowns.work = toWait;
|
||||
data.memberData.workStreak = (data.memberData.workStreak || 0) + 1;
|
||||
|
||||
data.memberData.markModified();
|
||||
await data.memberData.save();
|
||||
|
||||
const embed = new EmbedBuilder()
|
||||
|
@ -98,6 +99,7 @@ class Work extends BaseCommand {
|
|||
|
||||
data.memberData.money += won;
|
||||
|
||||
data.memberData.markModified();
|
||||
await data.memberData.save();
|
||||
|
||||
const info = {
|
||||
|
@ -124,6 +126,7 @@ class Work extends BaseCommand {
|
|||
data.userData.achievements.work.achieved = true;
|
||||
}
|
||||
|
||||
data.userData.markModified();
|
||||
await data.userData.save();
|
||||
}
|
||||
|
||||
|
|
|
@ -96,6 +96,7 @@ class Number extends BaseCommand {
|
|||
};
|
||||
data.memberData.transactions.push(info);
|
||||
|
||||
memberData.markModified("transactions");
|
||||
await memberData.save();
|
||||
}
|
||||
|
||||
|
|
|
@ -58,15 +58,17 @@ class TicTacToe extends BaseCommand {
|
|||
|
||||
memberData.money += 100;
|
||||
|
||||
await memberData.save();
|
||||
|
||||
const info = {
|
||||
user: interaction.translate("economy/transactions:TTT"),
|
||||
amount: 100,
|
||||
date: Date.now(),
|
||||
type: "got",
|
||||
};
|
||||
|
||||
memberData.transactions.push(info);
|
||||
|
||||
memberData.markModified();
|
||||
await memberData.save();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,6 +51,7 @@ class Afk extends BaseCommand {
|
|||
|
||||
data.userData.afk = reason;
|
||||
|
||||
data.userData.markModified();
|
||||
await data.userData.save();
|
||||
|
||||
interaction.success("general/afk:SUCCESS", {
|
||||
|
|
|
@ -72,6 +72,7 @@ class Remindme extends BaseCommand {
|
|||
|
||||
data.userData.reminds.push(rData);
|
||||
|
||||
data.userData.markModified("reminds");
|
||||
await data.userData.save();
|
||||
|
||||
client.databaseCache.usersReminds.set(interaction.user.id, data.userData);
|
||||
|
|
|
@ -55,6 +55,7 @@ class Clearwarns extends BaseCommand {
|
|||
|
||||
memberData.sanctions = [];
|
||||
|
||||
memberData.markModified("sanctions");
|
||||
await memberData.save();
|
||||
|
||||
interaction.success("moderation/clearwarns:SUCCESS", {
|
||||
|
|
|
@ -178,6 +178,7 @@ class Warn extends BaseCommand {
|
|||
|
||||
memberData.sanctions.push(caseInfo);
|
||||
|
||||
memberData.markModified("sanctions");
|
||||
await memberData.save();
|
||||
|
||||
if (data.guildData.plugins.modlogs) {
|
||||
|
|
|
@ -136,9 +136,7 @@ class Debug extends BaseCommand {
|
|||
const member = interaction.options.getMember("user");
|
||||
if (member.user.bot) return interaction.error("misc:BOT_USER", null, { ephemeral: true });
|
||||
|
||||
const userData = await client.findOrCreateUser({
|
||||
id: member.id,
|
||||
}),
|
||||
const userData = await client.findOrCreateUser(member.id),
|
||||
memberData = await client.findOrCreateMember({
|
||||
id: member.id,
|
||||
guildId: interaction.guildId,
|
||||
|
@ -148,6 +146,7 @@ class Debug extends BaseCommand {
|
|||
case "level": {
|
||||
memberData.level = int;
|
||||
|
||||
memberData.markModified();
|
||||
await memberData.save();
|
||||
|
||||
return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, {
|
||||
|
@ -159,6 +158,7 @@ class Debug extends BaseCommand {
|
|||
case "xp": {
|
||||
memberData.exp = int;
|
||||
|
||||
memberData.markModified();
|
||||
await memberData.save();
|
||||
|
||||
return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, {
|
||||
|
@ -170,6 +170,7 @@ class Debug extends BaseCommand {
|
|||
case "credits": {
|
||||
memberData.money = int;
|
||||
|
||||
memberData.markModified();
|
||||
await memberData.save();
|
||||
|
||||
return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, {
|
||||
|
@ -181,6 +182,7 @@ class Debug extends BaseCommand {
|
|||
case "bank": {
|
||||
memberData.bankSold = int;
|
||||
|
||||
memberData.markModified();
|
||||
await memberData.save();
|
||||
|
||||
return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, {
|
||||
|
@ -192,6 +194,7 @@ class Debug extends BaseCommand {
|
|||
case "rep": {
|
||||
userData.rep = int;
|
||||
|
||||
userData.markModified();
|
||||
await userData.save();
|
||||
|
||||
return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, {
|
||||
|
@ -207,9 +210,7 @@ class Debug extends BaseCommand {
|
|||
const member = interaction.options.getMember("target");
|
||||
if (member.user.bot) return interaction.error("misc:BOT_USER", null, { ephemeral: true });
|
||||
|
||||
const userData = await client.findOrCreateUser({
|
||||
id: member.id,
|
||||
}),
|
||||
const userData = await client.findOrCreateUser(member.id),
|
||||
memberData = await client.findOrCreateMember({
|
||||
id: member.id,
|
||||
guildId: interaction.guildId,
|
||||
|
@ -219,6 +220,7 @@ class Debug extends BaseCommand {
|
|||
case "level": {
|
||||
memberData.level += int;
|
||||
|
||||
memberData.markModified();
|
||||
await memberData.save();
|
||||
|
||||
return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, {
|
||||
|
@ -230,6 +232,7 @@ class Debug extends BaseCommand {
|
|||
case "xp": {
|
||||
memberData.exp += int;
|
||||
|
||||
memberData.markModified();
|
||||
await memberData.save();
|
||||
|
||||
return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, {
|
||||
|
@ -241,6 +244,7 @@ class Debug extends BaseCommand {
|
|||
case "credits": {
|
||||
memberData.money += int;
|
||||
|
||||
memberData.markModified();
|
||||
await memberData.save();
|
||||
|
||||
return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, {
|
||||
|
@ -252,6 +256,7 @@ class Debug extends BaseCommand {
|
|||
case "bank": {
|
||||
memberData.bankSold += int;
|
||||
|
||||
memberData.markModified();
|
||||
await memberData.save();
|
||||
|
||||
return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, {
|
||||
|
@ -263,6 +268,7 @@ class Debug extends BaseCommand {
|
|||
case "rep": {
|
||||
userData.rep += int;
|
||||
|
||||
userData.markModified();
|
||||
await userData.save();
|
||||
|
||||
return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, {
|
||||
|
|
|
@ -45,6 +45,7 @@ class CreateTicketEmbed extends BaseCommand {
|
|||
|
||||
guildData.plugins.tickets.count++;
|
||||
|
||||
guildData.markModified("plugins.tickets");
|
||||
await guildData.save();
|
||||
|
||||
const channel = await interaction.guild.channels.create({
|
||||
|
|
|
@ -29,6 +29,7 @@ module.exports = client => [
|
|||
|
||||
guildData.language = newData;
|
||||
|
||||
guildData.markModified();
|
||||
await guildData.save();
|
||||
|
||||
return;
|
||||
|
@ -54,6 +55,7 @@ module.exports = client => [
|
|||
|
||||
guildData.plugins.welcome.enabled = newData;
|
||||
|
||||
guildData.markModified("plugins");
|
||||
await guildData.save();
|
||||
|
||||
return;
|
||||
|
@ -74,6 +76,7 @@ module.exports = client => [
|
|||
|
||||
guildData.plugins.welcome.withImage = newData;
|
||||
|
||||
guildData.markModified("plugins");
|
||||
await guildData.save();
|
||||
|
||||
return;
|
||||
|
@ -94,6 +97,7 @@ module.exports = client => [
|
|||
|
||||
guildData.plugins.welcome.message = newData !== "" ? newData : null;
|
||||
|
||||
guildData.markModified("plugins");
|
||||
await guildData.save();
|
||||
|
||||
return;
|
||||
|
@ -114,6 +118,7 @@ module.exports = client => [
|
|||
|
||||
guildData.plugins.welcome.channel = newData !== "" ? newData : null;
|
||||
|
||||
guildData.markModified("plugins");
|
||||
await guildData.save();
|
||||
|
||||
return;
|
||||
|
@ -141,6 +146,7 @@ module.exports = client => [
|
|||
|
||||
guildData.plugins.goodbye.enabled = newData;
|
||||
|
||||
guildData.markModified("plugins");
|
||||
await guildData.save();
|
||||
|
||||
return;
|
||||
|
@ -161,6 +167,7 @@ module.exports = client => [
|
|||
|
||||
guildData.plugins.goodbye.withImage = newData;
|
||||
|
||||
guildData.markModified("plugins");
|
||||
await guildData.save();
|
||||
|
||||
return;
|
||||
|
@ -181,6 +188,7 @@ module.exports = client => [
|
|||
|
||||
guildData.plugins.goodbye.message = newData !== "" ? newData : null;
|
||||
|
||||
guildData.markModified("plugins");
|
||||
await guildData.save();
|
||||
|
||||
return;
|
||||
|
@ -201,6 +209,7 @@ module.exports = client => [
|
|||
|
||||
guildData.plugins.goodbye.channel = newData !== "" ? newData : null;
|
||||
|
||||
guildData.markModified("plugins");
|
||||
await guildData.save();
|
||||
|
||||
return;
|
||||
|
@ -228,6 +237,7 @@ module.exports = client => [
|
|||
|
||||
guildData.plugins.autorole.enabled = newData;
|
||||
|
||||
guildData.markModified("plugins");
|
||||
await guildData.save();
|
||||
|
||||
return;
|
||||
|
@ -248,6 +258,7 @@ module.exports = client => [
|
|||
|
||||
guildData.plugins.autorole.role = newData !== "" ? newData : null;
|
||||
|
||||
guildData.markModified("plugins");
|
||||
await guildData.save();
|
||||
|
||||
return;
|
||||
|
@ -275,6 +286,7 @@ module.exports = client => [
|
|||
|
||||
guildData.plugins.automod.enabled = newData;
|
||||
|
||||
guildData.markModified("plugins");
|
||||
await guildData.save();
|
||||
|
||||
return;
|
||||
|
@ -295,6 +307,7 @@ module.exports = client => [
|
|||
|
||||
guildData.plugins.automod.ignored = newData;
|
||||
|
||||
guildData.markModified("plugins");
|
||||
await guildData.save();
|
||||
|
||||
return;
|
||||
|
@ -324,6 +337,7 @@ module.exports = client => [
|
|||
|
||||
guildData.plugins.monitoring.messageUpdate = newData !== "" ? newData : null;
|
||||
|
||||
guildData.markModified("plugins");
|
||||
await guildData.save();
|
||||
|
||||
return;
|
||||
|
@ -346,6 +360,7 @@ module.exports = client => [
|
|||
|
||||
guildData.plugins.monitoring.messageDelete = newData !== "" ? newData : null;
|
||||
|
||||
guildData.markModified("plugins");
|
||||
await guildData.save();
|
||||
|
||||
return;
|
||||
|
@ -373,6 +388,7 @@ module.exports = client => [
|
|||
|
||||
guildData.plugins.suggestions = newData !== "" ? newData : null;
|
||||
|
||||
guildData.markModified("plugins");
|
||||
await guildData.save();
|
||||
|
||||
return;
|
||||
|
@ -393,6 +409,7 @@ module.exports = client => [
|
|||
|
||||
guildData.plugins.reports = newData !== "" ? newData : null;
|
||||
|
||||
guildData.markModified("plugins");
|
||||
await guildData.save();
|
||||
|
||||
return;
|
||||
|
@ -413,6 +430,7 @@ module.exports = client => [
|
|||
|
||||
guildData.plugins.birthdays = newData !== "" ? newData : null;
|
||||
|
||||
guildData.markModified("plugins");
|
||||
await guildData.save();
|
||||
|
||||
return;
|
||||
|
@ -433,6 +451,7 @@ module.exports = client => [
|
|||
|
||||
guildData.plugins.modlogs = newData !== "" ? newData : null;
|
||||
|
||||
guildData.markModified("plugins");
|
||||
await guildData.save();
|
||||
|
||||
return;
|
||||
|
|
|
@ -18,7 +18,7 @@ class CommandHandler extends BaseEvent {
|
|||
const command = client.commands.get(interaction.commandName);
|
||||
const data = [];
|
||||
|
||||
const userData = await client.findOrCreateUser({ id: interaction.user.id });
|
||||
const userData = await client.findOrCreateUser(interaction.user.id);
|
||||
data.userData = userData;
|
||||
|
||||
if (interaction.inGuild()) {
|
||||
|
@ -51,6 +51,7 @@ class CommandHandler extends BaseEvent {
|
|||
userData.achievements.firstCommand.progress.now = 1;
|
||||
userData.achievements.firstCommand.achieved = true;
|
||||
|
||||
userData.markModified("achievements");
|
||||
await userData.save();
|
||||
|
||||
interaction.user.send(args);
|
||||
|
|
|
@ -15,12 +15,13 @@ class GuildCreate extends BaseEvent {
|
|||
* @param {import("discord.js").Guild} 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) {
|
||||
userData.achievements.invite.progress.now = 1;
|
||||
userData.achievements.invite.achieved = true;
|
||||
|
||||
userData.markModified("achievements");
|
||||
await userData.save();
|
||||
}
|
||||
|
||||
|
|
|
@ -138,7 +138,8 @@ class GuildMemberAdd extends BaseEvent {
|
|||
content: message,
|
||||
files: [attachment],
|
||||
});
|
||||
} else channel.send({ content: message });
|
||||
} else
|
||||
channel.send({ content: message });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -141,7 +141,8 @@ class GuildMemberRemove extends BaseEvent {
|
|||
content: message,
|
||||
files: [attachment],
|
||||
});
|
||||
} else channel.send({ content: message });
|
||||
} else
|
||||
channel.send({ content: message });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,11 +20,12 @@ class GuildMemberUpdate extends BaseEvent {
|
|||
if (oldMember.roles.cache.some(r => r.id === "940149470975365191")) return;
|
||||
|
||||
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.achieved = true;
|
||||
|
||||
userData.markModified("achievements");
|
||||
await userData.save();
|
||||
|
||||
newMember.send({
|
||||
|
|
|
@ -24,7 +24,7 @@ class MessageCreate extends BaseEvent {
|
|||
if (message.author.bot) return;
|
||||
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;
|
||||
|
||||
if (message.guild && !message.member) await message.guild.members.fetch(message.author.id);
|
||||
|
@ -105,10 +105,10 @@ class MessageCreate extends BaseEvent {
|
|||
message.delete();
|
||||
}
|
||||
|
||||
const afkReason = data.userData.afk;
|
||||
if (afkReason) {
|
||||
if (data.userData.afk) {
|
||||
data.userData.afk = null;
|
||||
|
||||
data.userData.markModified();
|
||||
await data.userData.save();
|
||||
|
||||
message.replyT("general/afk:DELETED", {
|
||||
|
@ -117,7 +117,7 @@ class MessageCreate extends BaseEvent {
|
|||
}
|
||||
|
||||
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 });
|
||||
});
|
||||
|
@ -156,6 +156,7 @@ async function updateXp(client, msg, memberData) {
|
|||
}, { mention: false });
|
||||
} else memberData.exp = parseInt(newXp, 10);
|
||||
|
||||
memberData.markModified();
|
||||
await memberData.save();
|
||||
}
|
||||
|
||||
|
|
|
@ -49,6 +49,7 @@ module.exports.init = function (client) {
|
|||
});
|
||||
user.reminds = user.reminds.filter(r => r.sendAt >= dateNow);
|
||||
|
||||
user.markModified("reminds");
|
||||
await user.save();
|
||||
|
||||
if (user.reminds.length === 0) client.databaseCache.usersReminds.delete(user.id);
|
||||
|
|
|
@ -30,6 +30,7 @@ module.exports.init = async function (client) {
|
|||
const index = transactions.indexOf(transaction);
|
||||
transactions.splice(index, 1);
|
||||
|
||||
member.markModified("transactions");
|
||||
await member.save();
|
||||
}
|
||||
}
|
||||
|
@ -45,6 +46,7 @@ module.exports.init = async function (client) {
|
|||
client.usersData.deleteOne({ id: u.id });
|
||||
client.logger.log(`Removed from database deleted user - ID: ${u.id} Username: ${u.username}`);
|
||||
|
||||
client.usersData.markModified();
|
||||
client.usersData.save();
|
||||
}
|
||||
});
|
||||
|
@ -59,6 +61,7 @@ module.exports.init = async function (client) {
|
|||
client.membersData.deleteOne({ id: u.id });
|
||||
client.logger.log(`Removed from database deleted user - ID: ${u.id} Username: ${u.username}`);
|
||||
|
||||
client.membersData.markModified();
|
||||
client.membersData.save();
|
||||
}
|
||||
});
|
||||
|
|
18
package.json
18
package.json
|
@ -14,25 +14,25 @@
|
|||
"@discordjs/opus": "^0.9.0",
|
||||
"@discordjs/rest": "^2.0.1",
|
||||
"@discordjs/voice": "^0.16.0",
|
||||
"canvas": "^2.10.2",
|
||||
"canvas": "^2.11.2",
|
||||
"chalk": "^4.1.2",
|
||||
"cron": "^2.1.0",
|
||||
"cron": "^2.4.4",
|
||||
"discord-api-types": "^0.37.62",
|
||||
"discord-giveaways": "^6.0.1",
|
||||
"discord-player": "^6.6.6",
|
||||
"discord.js": "^14.13.0",
|
||||
"gamedig": "^4.0.2",
|
||||
"i18next": "^21.9.1",
|
||||
"i18next-fs-backend": "^1.1.5",
|
||||
"md5": "^2.2.1",
|
||||
"moment": "^2.26.0",
|
||||
"gamedig": "^4.1.0",
|
||||
"i18next": "^21.10.0",
|
||||
"i18next-fs-backend": "^1.2.0",
|
||||
"md5": "^2.3.0",
|
||||
"moment": "^2.29.4",
|
||||
"mongoose": "^7.6.3",
|
||||
"ms": "^2.1.3",
|
||||
"node-fetch": "^2.6.7",
|
||||
"node-fetch": "^2.7.0",
|
||||
"youtube-ext": "^1.1.16"
|
||||
},
|
||||
"devDependencies": {
|
||||
"eslint": "^8.23.0"
|
||||
"eslint": "^8.52.0"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"env": {
|
||||
|
|
560
pnpm-lock.yaml
560
pnpm-lock.yaml
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue