mirror of
https://github.com/JonnyBro/JaBa.git
synced 2024-11-21 20:54:58 +05:00
v4.3.1 - https://jababot.ru
This commit is contained in:
parent
f56975d1a8
commit
776be20851
42 changed files with 318 additions and 219 deletions
|
@ -31,12 +31,18 @@ module.exports = mongoose.model("Guild", new Schema({
|
|||
ignored: [],
|
||||
},
|
||||
warnsSanctions: {
|
||||
kick: false,
|
||||
ban: false,
|
||||
kick: null,
|
||||
ban: null,
|
||||
},
|
||||
suggestions: false,
|
||||
reports: false,
|
||||
birthdays: false,
|
||||
modlogs: false,
|
||||
monitoring: {
|
||||
memberAdd: null,
|
||||
memberLeave: null,
|
||||
memberUpdate: null,
|
||||
messageUpdate: null,
|
||||
},
|
||||
suggestions: null,
|
||||
reports: null,
|
||||
birthdays: null,
|
||||
modlogs: null,
|
||||
} },
|
||||
}));
|
102
base/JaBa.js
102
base/JaBa.js
|
@ -243,29 +243,24 @@ class JaBa extends Client {
|
|||
/**
|
||||
* Find or create user in DB
|
||||
* @param {Array} param0 { id: User ID }
|
||||
* @param {Boolean} isLean Return JSON instead Mongoose model?
|
||||
* @returns {import("./User")} Mongoose model or JSON of this user
|
||||
*/
|
||||
async findOrCreateUser({ id: userID }, isLean) {
|
||||
if (this.databaseCache.users.get(userID)) return isLean ? this.databaseCache.users.get(userID).toJSON() : this.databaseCache.users.get(userID);
|
||||
async findOrCreateUser({ id: userID }) {
|
||||
if (this.databaseCache.users.get(userID)) return this.databaseCache.users.get(userID);
|
||||
else {
|
||||
let userData = (isLean ? await this.usersData.findOne({
|
||||
id: userID,
|
||||
}).lean() : await this.usersData.findOne({
|
||||
id: userID,
|
||||
}));
|
||||
let userData = await this.usersData.findOne({ id: userID });
|
||||
|
||||
if (userData) {
|
||||
if (!isLean) this.databaseCache.users.set(userID, userData);
|
||||
this.databaseCache.users.set(userID, userData);
|
||||
|
||||
return userData;
|
||||
} else {
|
||||
userData = new this.usersData({
|
||||
id: userID,
|
||||
});
|
||||
userData = new this.usersData({ id: userID });
|
||||
await userData.save();
|
||||
|
||||
this.databaseCache.users.set(userID, userData);
|
||||
|
||||
return isLean ? userData.toJSON() : userData;
|
||||
return userData;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -273,70 +268,53 @@ class JaBa extends Client {
|
|||
/**
|
||||
* Find or create member in DB
|
||||
* @param {Array} param0 { id: Member ID }
|
||||
* @param {Boolean} isLean Return JSON instead Mongoose model?
|
||||
* @returns {import("./Member")} Mongoose model or JSON of this member
|
||||
*/
|
||||
async findOrCreateMember({ id: memberID, guildId }, isLean) {
|
||||
if (this.databaseCache.members.get(`${memberID}${guildId}`)) return isLean ? this.databaseCache.members.get(`${memberID}${guildId}`).toJSON() : this.databaseCache.members.get(`${memberID}${guildId}`);
|
||||
else {
|
||||
let memberData = (isLean ? await this.membersData.findOne({
|
||||
guildID: guildId,
|
||||
id: memberID,
|
||||
}).lean() : await this.membersData.findOne({
|
||||
guildID: guildId,
|
||||
id: memberID,
|
||||
}));
|
||||
if (memberData) {
|
||||
if (!isLean) this.databaseCache.members.set(`${memberID}${guildId}`, memberData);
|
||||
async findOrCreateMember({ id: memberID, guildId }) {
|
||||
let memberData = await this.membersData.findOne({ guildID: guildId, id: memberID });
|
||||
|
||||
return memberData;
|
||||
} else {
|
||||
memberData = new this.membersData({
|
||||
id: memberID,
|
||||
guildID: guildId,
|
||||
});
|
||||
await memberData.save();
|
||||
const guild = await this.findOrCreateGuild({
|
||||
id: guildId,
|
||||
});
|
||||
if (guild) {
|
||||
guild.members.push(memberData._id);
|
||||
await guild.save();
|
||||
}
|
||||
this.databaseCache.members.set(`${memberID}${guildId}`, memberData);
|
||||
if (memberData) {
|
||||
this.databaseCache.members.set(`${memberID}${guildId}`, memberData);
|
||||
|
||||
return isLean ? memberData.toJSON() : memberData;
|
||||
return memberData;
|
||||
} else {
|
||||
memberData = new this.membersData({ id: memberID, guildID: guildId });
|
||||
await memberData.save();
|
||||
|
||||
const guildData = await this.findOrCreateGuild({ id: guildId });
|
||||
|
||||
if (guildData) {
|
||||
guildData.members.push(memberData._id);
|
||||
guildData.markModified("members");
|
||||
|
||||
await guildData.save();
|
||||
}
|
||||
|
||||
this.databaseCache.members.set(`${memberID}${guildId}`, memberData);
|
||||
|
||||
return memberData;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Find or create guild in DB
|
||||
* @param {Array} param0 { id: Guild ID }
|
||||
* @param {Boolean} isLean Return JSON instead Mongoose model?
|
||||
* @returns {import("./Guild")} Mongoose model or JSON of this guild
|
||||
*/
|
||||
async findOrCreateGuild({ id: guildId }, isLean) {
|
||||
if (this.databaseCache.guilds.get(guildId)) return isLean ? this.databaseCache.guilds.get(guildId).toJSON() : this.databaseCache.guilds.get(guildId);
|
||||
else {
|
||||
let guildData = (isLean ? await this.guildsData.findOne({
|
||||
id: guildId,
|
||||
}).populate("members").lean() : await this.guildsData.findOne({
|
||||
id: guildId,
|
||||
}).populate("members"));
|
||||
if (guildData) {
|
||||
if (!isLean) this.databaseCache.guilds.set(guildId, guildData);
|
||||
async findOrCreateGuild({ id: guildId }) {
|
||||
let guildData = await this.guildsData.findOne({ id: guildId }).populate("members");
|
||||
|
||||
return guildData;
|
||||
} else {
|
||||
guildData = new this.guildsData({
|
||||
id: guildId,
|
||||
});
|
||||
await guildData.save();
|
||||
this.databaseCache.guilds.set(guildId, guildData);
|
||||
if (guildData) {
|
||||
this.databaseCache.guilds.set(guildId, guildData);
|
||||
|
||||
return isLean ? guildData.toJSON() : guildData;
|
||||
}
|
||||
return guildData;
|
||||
} else {
|
||||
guildData = new this.guildsData({ id: guildId });
|
||||
await guildData.save();
|
||||
|
||||
this.databaseCache.guilds.set(guildId, guildData);
|
||||
|
||||
return guildData;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
||||
interaction.editReply({
|
||||
|
|
|
@ -41,6 +41,7 @@ class Config extends BaseCommand {
|
|||
{ name: client.translate("administration/config:MODLOGS"), value: "modlogs" },
|
||||
{ name: client.translate("administration/config:REPORTS"), value: "reports" },
|
||||
{ name: client.translate("administration/config:SUGGESTIONS"), value: "suggestions" },
|
||||
{ name: client.translate("administration/config:MESSAGEUPDATE"), value: "monitoring.messageUpdate" },
|
||||
)
|
||||
.setRequired(true))
|
||||
.addBooleanOption(option => option.setName("state")
|
||||
|
@ -126,20 +127,18 @@ class Config extends BaseCommand {
|
|||
channels: guildData.plugins.automod.ignored.map(ch => ` ${ch}`),
|
||||
}) : interaction.translate("common:DISABLED"),
|
||||
},
|
||||
{
|
||||
name: interaction.translate("administration/config:MONITORING_CHANNELS"),
|
||||
value:
|
||||
`${interaction.translate("administration/config:MESSAGEUPDATE")}: ${guildData.plugins.monitoring.messageUpdate ? `<#${guildData.plugins.monitoring.messageUpdate}>` : `*${interaction.translate("common:NOT_DEFINED")}*`}\n`,
|
||||
},
|
||||
{
|
||||
name: interaction.translate("administration/config:SPECIAL_CHANNELS"),
|
||||
value: interaction.translate("administration/config:SUGGESTIONS_LIST", {
|
||||
channel: guildData.plugins.suggestions ? `<#${guildData.plugins.suggestions}>` : `*${interaction.translate("common:NOT_DEFINED")}*`,
|
||||
}) + "\n" +
|
||||
interaction.translate("administration/config:REPORTS_LIST", {
|
||||
channel: guildData.plugins.reports ? `<#${guildData.plugins.reports}>` : `*${interaction.translate("common:NOT_DEFINED")}*`,
|
||||
}) + "\n" +
|
||||
interaction.translate("administration/config:MODLOGS_LIST", {
|
||||
channel: guildData.plugins.modlogs ? `<#${guildData.plugins.modlogs}>` : `*${interaction.translate("common:NOT_DEFINED")}*`,
|
||||
}) + "\n" +
|
||||
interaction.translate("administration/config:BIRTHDAYS_LIST", {
|
||||
channel: guildData.plugins.birthdays ? `<#${guildData.plugins.birthdays}>` : `*${interaction.translate("common:NOT_DEFINED")}*`,
|
||||
}),
|
||||
value:
|
||||
`${interaction.translate("administration/config:SUGGESTIONS")}: ${guildData.plugins.suggestions ? `<#${guildData.plugins.suggestions}>` : `*${interaction.translate("common:NOT_DEFINED")}*`}\n` +
|
||||
`${interaction.translate("administration/config:REPORTS")}: ${guildData.plugins.reports ? `<#${guildData.plugins.reports}>` : `*${interaction.translate("common:NOT_DEFINED")}*`}\n` +
|
||||
`${interaction.translate("administration/config:MODLOGS")}: ${guildData.plugins.modlogs ? `<#${guildData.plugins.modlogs}>` : `*${interaction.translate("common:NOT_DEFINED")}*`}\n` +
|
||||
`${interaction.translate("administration/config:BIRTHDAYS")}: ${guildData.plugins.birthdays ? `<#${guildData.plugins.birthdays}>` : `*${interaction.translate("common:NOT_DEFINED")}*`}`,
|
||||
},
|
||||
{
|
||||
name: interaction.translate("administration/config:DASHBOARD_TITLE"),
|
||||
|
|
|
@ -78,7 +78,9 @@ class Set extends BaseCommand {
|
|||
switch (type) {
|
||||
case "level": {
|
||||
memberData.level = int;
|
||||
memberData.markModified("level");
|
||||
await memberData.save();
|
||||
|
||||
return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, {
|
||||
user: member.toString(),
|
||||
amount: int,
|
||||
|
@ -87,7 +89,9 @@ class Set extends BaseCommand {
|
|||
|
||||
case "xp": {
|
||||
memberData.exp = int;
|
||||
memberData.markModified("exp");
|
||||
await memberData.save();
|
||||
|
||||
return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, {
|
||||
user: member.toString(),
|
||||
amount: int,
|
||||
|
@ -96,7 +100,9 @@ class Set extends BaseCommand {
|
|||
|
||||
case "credits": {
|
||||
memberData.money = int;
|
||||
memberData.markModified("money");
|
||||
await memberData.save();
|
||||
|
||||
return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, {
|
||||
user: member.toString(),
|
||||
amount: int,
|
||||
|
@ -105,7 +111,9 @@ class Set extends BaseCommand {
|
|||
|
||||
case "bank": {
|
||||
memberData.bankSold = int;
|
||||
memberData.markModified("bankSold");
|
||||
await memberData.save();
|
||||
|
||||
return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, {
|
||||
user: member.toString(),
|
||||
amount: int,
|
||||
|
|
|
@ -52,6 +52,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();
|
||||
|
||||
return interaction.success("administration/setlang:SUCCESS", {
|
||||
|
|
|
@ -62,6 +62,8 @@ class Bank extends BaseCommand {
|
|||
|
||||
data.memberData.money -= credits;
|
||||
data.memberData.bankSold += credits;
|
||||
data.memberData.markModified("money");
|
||||
data.memberData.markModified("bankSold");
|
||||
await data.memberData.save();
|
||||
|
||||
const info = {
|
||||
|
@ -91,6 +93,8 @@ class Bank extends BaseCommand {
|
|||
|
||||
data.memberData.money += credits;
|
||||
data.memberData.bankSold -= credits;
|
||||
data.memberData.markModified("money");
|
||||
data.memberData.markModified("bankSold");
|
||||
await data.memberData.save();
|
||||
|
||||
interaction.success("economy/bank:SUCCESS_WD", {
|
||||
|
|
|
@ -80,6 +80,7 @@ class Birthdate extends BaseCommand {
|
|||
if (d.getTime() < (Date.now() - 2.523e+12)) return interaction.error("economy/birthdate:DATE_TOO_LOW");
|
||||
|
||||
data.userData.birthdate = d;
|
||||
data.userData.markModified("birthdate");
|
||||
await data.userData.save();
|
||||
|
||||
interaction.success("economy/birthdate:SUCCESS", {
|
||||
|
|
|
@ -39,12 +39,14 @@ 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();
|
||||
|
||||
const oldLover = await client.findOrCreateUser({
|
||||
id: user.id,
|
||||
});
|
||||
oldLover.lover = null;
|
||||
oldLover.markModified("lover");
|
||||
await oldLover.save();
|
||||
|
||||
interaction.success("economy/divorce:DIVORCED", {
|
||||
|
|
|
@ -128,8 +128,11 @@ class Marry extends BaseCommand {
|
|||
|
||||
if (reason) {
|
||||
data.userData.lover = member.id;
|
||||
await data.userData.save();
|
||||
userData.lover = interaction.member.id;
|
||||
|
||||
data.userData.markModified("lover");
|
||||
await data.userData.save();
|
||||
userData.markModified("lover");
|
||||
await userData.save();
|
||||
|
||||
const messageOptions = {
|
||||
|
|
|
@ -65,9 +65,11 @@ 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();
|
||||
|
||||
const info1 = {
|
||||
|
|
|
@ -91,8 +91,11 @@ class Rob extends BaseCommand {
|
|||
data.memberData.money += amount;
|
||||
memberData.money -= amount;
|
||||
|
||||
await memberData.save();
|
||||
data.memberData.markModified("money");
|
||||
memberData.markModified("money");
|
||||
|
||||
await data.memberData.save();
|
||||
await memberData.save();
|
||||
} else {
|
||||
const won = Math.floor(amount * 0.9),
|
||||
randomNum = client.functions.randomNum(1, 2);
|
||||
|
@ -106,8 +109,11 @@ class Rob extends BaseCommand {
|
|||
data.memberData.money -= potentiallyLose;
|
||||
memberData.money += won;
|
||||
|
||||
await memberData.save();
|
||||
data.memberData.markModified("money");
|
||||
memberData.markModified("money");
|
||||
|
||||
await data.memberData.save();
|
||||
await memberData.save();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -46,7 +46,9 @@ 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();
|
||||
|
||||
interaction.success("economy/setbio:SUCCESS");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -109,16 +109,19 @@ class Slots extends BaseCommand {
|
|||
|
||||
const toAdd = credits - amount;
|
||||
|
||||
data.memberData.money += toAdd;
|
||||
|
||||
const info = {
|
||||
user: interaction.translate("economy/slots:DESCRIPTION"),
|
||||
amount: toAdd,
|
||||
date: Date.now(),
|
||||
type: "got",
|
||||
};
|
||||
|
||||
data.memberData.money += toAdd;
|
||||
data.memberData.transactions.push(info);
|
||||
|
||||
data.memberData.markModified("money");
|
||||
data.memberData.markModified("transactions");
|
||||
|
||||
if (!data.userData.achievements.slots.achieved) {
|
||||
data.userData.achievements.slots.progress.now += 1;
|
||||
if (data.userData.achievements.slots.progress.now === data.userData.achievements.slots.progress.total) {
|
||||
|
@ -134,6 +137,7 @@ class Slots extends BaseCommand {
|
|||
await data.userData.save();
|
||||
}
|
||||
await data.memberData.save();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -159,8 +163,12 @@ class Slots extends BaseCommand {
|
|||
date: Date.now(),
|
||||
type: "got",
|
||||
};
|
||||
data.memberData.transactions.push(info);
|
||||
|
||||
data.memberData.money += toAdd;
|
||||
data.memberData.transactions.push(info);
|
||||
|
||||
data.memberData.markModified("money");
|
||||
data.memberData.markModified("transactions");
|
||||
|
||||
if (!data.userData.achievements.slots.achieved) {
|
||||
data.userData.achievements.slots.progress.now += 1;
|
||||
|
@ -194,8 +202,12 @@ class Slots extends BaseCommand {
|
|||
date: Date.now(),
|
||||
type: "send",
|
||||
};
|
||||
data.memberData.transactions.push(info);
|
||||
|
||||
data.memberData.money -= amount;
|
||||
data.memberData.transactions.push(info);
|
||||
|
||||
data.memberData.markModified("money");
|
||||
data.memberData.markModified("transactions");
|
||||
|
||||
if (!data.userData.achievements.slots.achieved) {
|
||||
data.userData.achievements.slots.progress.now = 0;
|
||||
|
|
|
@ -43,6 +43,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();
|
||||
|
||||
return interaction.success("economy/transactions:CLEARED", null, { ephemeral: true });
|
||||
|
|
|
@ -103,6 +103,7 @@ class Work extends BaseCommand {
|
|||
}
|
||||
|
||||
data.memberData.money += won;
|
||||
data.memberData.markModified("money");
|
||||
await data.memberData.save();
|
||||
|
||||
const info = {
|
||||
|
|
|
@ -96,6 +96,7 @@ class Number extends BaseCommand {
|
|||
};
|
||||
data.memberData.transactions.push(info);
|
||||
|
||||
data.memberData.markModified("transactions");
|
||||
await memberData.save();
|
||||
}
|
||||
collector.stop();
|
||||
|
|
|
@ -54,6 +54,7 @@ class TicTacToe extends BaseCommand {
|
|||
});
|
||||
|
||||
memberData.money += 100;
|
||||
memberData.markModified("money");
|
||||
await memberData.save();
|
||||
|
||||
const info = {
|
||||
|
|
|
@ -47,6 +47,7 @@ class Afk extends BaseCommand {
|
|||
const reason = interaction.options.getString("message");
|
||||
|
||||
data.userData.afk = reason;
|
||||
data.userData.markModified("afk");
|
||||
await data.userData.save();
|
||||
|
||||
interaction.success("general/afk:SUCCESS", {
|
||||
|
|
|
@ -51,6 +51,7 @@ class Clearwarns extends BaseCommand {
|
|||
});
|
||||
|
||||
memberData.sanctions = [];
|
||||
memberData.markModified("sanctions");
|
||||
memberData.save();
|
||||
|
||||
interaction.success("moderation/clearwarns:SUCCESS", {
|
||||
|
|
|
@ -178,6 +178,7 @@ class Warn extends BaseCommand {
|
|||
.setColor(client.config.embed.color);
|
||||
|
||||
memberData.sanctions.push(caseInfo);
|
||||
memberData.markModified("sanctions");
|
||||
memberData.save();
|
||||
|
||||
if (data.guildData.plugins.modlogs) {
|
||||
|
|
|
@ -126,7 +126,9 @@ class Debug extends BaseCommand {
|
|||
switch (type) {
|
||||
case "level": {
|
||||
memberData.level = int;
|
||||
memberData.markModified("level");
|
||||
await memberData.save();
|
||||
|
||||
return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, {
|
||||
user: member.toString(),
|
||||
amount: int,
|
||||
|
@ -135,7 +137,9 @@ class Debug extends BaseCommand {
|
|||
|
||||
case "xp": {
|
||||
memberData.exp = int;
|
||||
memberData.markModified("exp");
|
||||
await memberData.save();
|
||||
|
||||
return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, {
|
||||
user: member.toString(),
|
||||
amount: int,
|
||||
|
@ -144,7 +148,9 @@ class Debug extends BaseCommand {
|
|||
|
||||
case "credits": {
|
||||
memberData.money = int;
|
||||
memberData.markModified("money");
|
||||
await memberData.save();
|
||||
|
||||
return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, {
|
||||
user: member.toString(),
|
||||
amount: int,
|
||||
|
@ -153,7 +159,9 @@ class Debug extends BaseCommand {
|
|||
|
||||
case "bank": {
|
||||
memberData.bankSold = int;
|
||||
memberData.markModified("bankSold");
|
||||
await memberData.save();
|
||||
|
||||
return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, {
|
||||
user: member.toString(),
|
||||
amount: int,
|
||||
|
@ -162,7 +170,9 @@ class Debug extends BaseCommand {
|
|||
|
||||
case "rep": {
|
||||
userData.rep = int;
|
||||
userData.markModified("rep");
|
||||
await userData.save();
|
||||
|
||||
return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, {
|
||||
user: member.toString(),
|
||||
amount: int,
|
||||
|
@ -187,7 +197,9 @@ class Debug extends BaseCommand {
|
|||
switch (type) {
|
||||
case "level": {
|
||||
memberData.level += int;
|
||||
memberData.markModified("level");
|
||||
await memberData.save();
|
||||
|
||||
return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, {
|
||||
user: member.toString(),
|
||||
amount: int,
|
||||
|
@ -196,7 +208,9 @@ class Debug extends BaseCommand {
|
|||
|
||||
case "xp": {
|
||||
memberData.exp += int;
|
||||
memberData.markModified("exp");
|
||||
await memberData.save();
|
||||
|
||||
return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, {
|
||||
user: member.toString(),
|
||||
amount: int,
|
||||
|
@ -205,7 +219,9 @@ class Debug extends BaseCommand {
|
|||
|
||||
case "credits": {
|
||||
memberData.money += int;
|
||||
memberData.markModified("money");
|
||||
await memberData.save();
|
||||
|
||||
return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, {
|
||||
user: member.toString(),
|
||||
amount: int,
|
||||
|
@ -214,7 +230,9 @@ class Debug extends BaseCommand {
|
|||
|
||||
case "bank": {
|
||||
memberData.bankSold += int;
|
||||
memberData.markModified("bankSold");
|
||||
await memberData.save();
|
||||
|
||||
return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, {
|
||||
user: member.toString(),
|
||||
amount: int,
|
||||
|
@ -223,7 +241,9 @@ class Debug extends BaseCommand {
|
|||
|
||||
case "rep": {
|
||||
userData.rep += int;
|
||||
userData.markModified("rep");
|
||||
await userData.save();
|
||||
|
||||
return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, {
|
||||
user: member.toString(),
|
||||
amount: int,
|
||||
|
|
|
@ -49,7 +49,7 @@ class Eval extends BaseCommand {
|
|||
const result = new Promise(resolve => resolve(eval(code)));
|
||||
|
||||
return result.then(output => {
|
||||
if (typeof output != "string") output = require("util").inspect(output, { depth: 0 });
|
||||
if (typeof output !== "string") output = require("util").inspect(output);
|
||||
if (output.includes(client.token)) output = output.replace(client.token, "T0K3N");
|
||||
|
||||
interaction.editReply({
|
||||
|
|
|
@ -240,6 +240,7 @@ module.exports.load = async client => {
|
|||
});
|
||||
|
||||
guildData.language = newData;
|
||||
guildData.markModified("language");
|
||||
await guildData.save();
|
||||
|
||||
return;
|
||||
|
@ -268,6 +269,7 @@ module.exports.load = async client => {
|
|||
});
|
||||
|
||||
guildData.plugins.welcome.enabled = newData;
|
||||
guildData.markModified("plugins.welcome");
|
||||
await guildData.save();
|
||||
|
||||
return;
|
||||
|
@ -291,6 +293,7 @@ module.exports.load = async client => {
|
|||
});
|
||||
|
||||
guildData.plugins.welcome.withImage = newData;
|
||||
guildData.markModified("plugins.welcome");
|
||||
await guildData.save();
|
||||
|
||||
return;
|
||||
|
@ -314,6 +317,7 @@ module.exports.load = async client => {
|
|||
});
|
||||
|
||||
guildData.plugins.welcome.message = newData !== "" ? newData : null;
|
||||
guildData.markModified("plugins.welcome");
|
||||
await guildData.save();
|
||||
|
||||
return;
|
||||
|
@ -337,6 +341,7 @@ module.exports.load = async client => {
|
|||
});
|
||||
|
||||
guildData.plugins.welcome.channel = newData !== "" ? newData : null;
|
||||
guildData.markModified("plugins.welcome");
|
||||
await guildData.save();
|
||||
|
||||
return;
|
||||
|
@ -367,6 +372,7 @@ module.exports.load = async client => {
|
|||
});
|
||||
|
||||
guildData.plugins.goodbye.enabled = newData;
|
||||
guildData.markModified("plugins.goodbye");
|
||||
await guildData.save();
|
||||
|
||||
return;
|
||||
|
@ -390,6 +396,7 @@ module.exports.load = async client => {
|
|||
});
|
||||
|
||||
guildData.plugins.goodbye.withImage = newData;
|
||||
guildData.markModified("plugins.goodbye");
|
||||
await guildData.save();
|
||||
|
||||
return;
|
||||
|
@ -413,6 +420,7 @@ module.exports.load = async client => {
|
|||
});
|
||||
|
||||
guildData.plugins.goodbye.message = newData !== "" ? newData : null;
|
||||
guildData.markModified("plugins.goodbye");
|
||||
await guildData.save();
|
||||
|
||||
return;
|
||||
|
@ -436,6 +444,7 @@ module.exports.load = async client => {
|
|||
});
|
||||
|
||||
guildData.plugins.goodbye.channel = newData !== "" ? newData : null;
|
||||
guildData.markModified("plugins.goodbye");
|
||||
await guildData.save();
|
||||
|
||||
return;
|
||||
|
@ -466,6 +475,7 @@ module.exports.load = async client => {
|
|||
});
|
||||
|
||||
guildData.plugins.autorole.enabled = newData;
|
||||
guildData.markModified("plugins.autorole");
|
||||
await guildData.save();
|
||||
|
||||
return;
|
||||
|
@ -489,6 +499,7 @@ module.exports.load = async client => {
|
|||
});
|
||||
|
||||
guildData.plugins.autorole.role = newData !== "" ? newData : null;
|
||||
guildData.markModified("plugins.autorole");
|
||||
await guildData.save();
|
||||
|
||||
return;
|
||||
|
@ -519,6 +530,7 @@ module.exports.load = async client => {
|
|||
});
|
||||
|
||||
guildData.plugins.automod.enabled = newData;
|
||||
guildData.markModified("plugins.automod");
|
||||
await guildData.save();
|
||||
|
||||
return;
|
||||
|
@ -526,8 +538,8 @@ module.exports.load = async client => {
|
|||
},
|
||||
{
|
||||
optionId: "automod_ignore",
|
||||
optionName: "Ignore channels",
|
||||
optionDescription: "Select channels for auto mod to ignore",
|
||||
optionName: "Ignore Channels",
|
||||
optionDescription: "Select a channels for auto mod to ignore",
|
||||
optionType: DBD.formTypes.channelsMultiSelect(false, false, [ ChannelType.GuildText ]),
|
||||
getActualSet: async ({ guild }) => {
|
||||
const guildData = await client.findOrCreateGuild({
|
||||
|
@ -542,6 +554,38 @@ module.exports.load = async client => {
|
|||
});
|
||||
|
||||
guildData.plugins.automod.ignored = newData;
|
||||
guildData.markModified("plugins.automod");
|
||||
await guildData.save();
|
||||
|
||||
return;
|
||||
},
|
||||
},
|
||||
]),
|
||||
},
|
||||
{
|
||||
optionId: "monitoring",
|
||||
optionName: "Monitoring Channels",
|
||||
optionDescription: "Setup monitoring channels on the server",
|
||||
optionType: SoftUI.formTypes.multiRow([
|
||||
{
|
||||
optionId: "monitoring_messageupdate",
|
||||
optionName: "Message Update Channel",
|
||||
optionDescription: "Select a channel for messages updates logs to go to",
|
||||
optionType: DBD.formTypes.channelsSelect(false, [ ChannelType.GuildText ]),
|
||||
getActualSet: async ({ guild }) => {
|
||||
const guildData = await client.findOrCreateGuild({
|
||||
id: guild.id,
|
||||
});
|
||||
|
||||
return guildData.plugins.monitoring.messageUpdate;
|
||||
},
|
||||
setNew: async ({ guild, newData }) => {
|
||||
const guildData = await client.findOrCreateGuild({
|
||||
id: guild.id,
|
||||
});
|
||||
|
||||
guildData.plugins.monitoring.messageUpdate = newData !== "" ? newData : null;
|
||||
guildData.markModified("plugins.monitoring");
|
||||
await guildData.save();
|
||||
|
||||
return;
|
||||
|
@ -556,8 +600,8 @@ module.exports.load = async client => {
|
|||
optionType: SoftUI.formTypes.multiRow([
|
||||
{
|
||||
optionId: "channels_suggestions",
|
||||
optionName: "Suggestions channel",
|
||||
optionDescription: "Select channel for suggestions to go to",
|
||||
optionName: "Suggestions Channel",
|
||||
optionDescription: "Select a channel for suggestions to go to",
|
||||
optionType: DBD.formTypes.channelsSelect(false, [ ChannelType.GuildText ]),
|
||||
getActualSet: async ({ guild }) => {
|
||||
const guildData = await client.findOrCreateGuild({
|
||||
|
@ -571,7 +615,8 @@ module.exports.load = async client => {
|
|||
id: guild.id,
|
||||
});
|
||||
|
||||
guildData.plugins.suggestions = newData;
|
||||
guildData.plugins.suggestions = newData !== "" ? newData : null;
|
||||
guildData.markModified("plugins.suggestions");
|
||||
await guildData.save();
|
||||
|
||||
return;
|
||||
|
@ -579,8 +624,8 @@ module.exports.load = async client => {
|
|||
},
|
||||
{
|
||||
optionId: "channels_reports",
|
||||
optionName: "Reports channel",
|
||||
optionDescription: "Select channel for reports to go to",
|
||||
optionName: "Reports Channel",
|
||||
optionDescription: "Select a channel for reports to go to",
|
||||
optionType: DBD.formTypes.channelsSelect(false, [ ChannelType.GuildText ]),
|
||||
getActualSet: async ({ guild }) => {
|
||||
const guildData = await client.findOrCreateGuild({
|
||||
|
@ -594,7 +639,8 @@ module.exports.load = async client => {
|
|||
id: guild.id,
|
||||
});
|
||||
|
||||
guildData.plugins.reports = newData;
|
||||
guildData.plugins.reports = newData !== "" ? newData : null;
|
||||
guildData.markModified("plugins.reports");
|
||||
await guildData.save();
|
||||
|
||||
return;
|
||||
|
@ -602,8 +648,8 @@ module.exports.load = async client => {
|
|||
},
|
||||
{
|
||||
optionId: "channels_birthdays",
|
||||
optionName: "Birthdays channel",
|
||||
optionDescription: "Select channel for birthdays message to go to",
|
||||
optionName: "Birthdays Channel",
|
||||
optionDescription: "Select a channel for birthdays message to go to",
|
||||
optionType: DBD.formTypes.channelsSelect(false, [ ChannelType.GuildText ]),
|
||||
getActualSet: async ({ guild }) => {
|
||||
const guildData = await client.findOrCreateGuild({
|
||||
|
@ -617,7 +663,8 @@ module.exports.load = async client => {
|
|||
id: guild.id,
|
||||
});
|
||||
|
||||
guildData.plugins.birthdays = newData;
|
||||
guildData.plugins.birthdays = newData !== "" ? newData : null;
|
||||
guildData.markModified("plugins.birthdays");
|
||||
await guildData.save();
|
||||
|
||||
return;
|
||||
|
@ -625,8 +672,8 @@ module.exports.load = async client => {
|
|||
},
|
||||
{
|
||||
optionId: "channels_modlogs",
|
||||
optionName: "Moderation logs channel",
|
||||
optionDescription: "Select channel for moderation logs to go to (warns)",
|
||||
optionName: "Moderation Logs Channel",
|
||||
optionDescription: "Select a channel for moderation logs to go to (warns)",
|
||||
optionType: DBD.formTypes.channelsSelect(false, [ ChannelType.GuildText ]),
|
||||
getActualSet: async ({ guild }) => {
|
||||
const guildData = await client.findOrCreateGuild({
|
||||
|
@ -640,7 +687,8 @@ module.exports.load = async client => {
|
|||
id: guild.id,
|
||||
});
|
||||
|
||||
guildData.plugins.modlogs = newData;
|
||||
guildData.plugins.modlogs = newData !== "" ? newData : null;
|
||||
guildData.markModified("plugins.modlogs");
|
||||
await guildData.save();
|
||||
|
||||
return;
|
||||
|
@ -661,11 +709,6 @@ module.exports.load = async client => {
|
|||
username: "JaBa",
|
||||
avatarURL: "https://cdn.discordapp.com/avatars/708637495054565426/af98d49ebc9bf28b40b45ed5a0a623b4.png?size=4096",
|
||||
}),
|
||||
setNew: async ({ guild, user, newData }) => {
|
||||
console.log(guild);
|
||||
console.log(user);
|
||||
console.log(newData);
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
|
|
|
@ -1,3 +1,11 @@
|
|||
### JaBa v4.3.1
|
||||
* Добавлено
|
||||
* Мониторинг изменения сообщений!\
|
||||
Скоро добавлю другие эвенты, по типу входа, выхода, обновление участника.
|
||||
|
||||
* Исправления
|
||||
* Серьёзная ошибка, из-за которой данные не сохранялись в базу данных 🤯.
|
||||
|
||||
### JaBa v4.3.0
|
||||
* Добавлено
|
||||
* Полностью переделанная панель управления!\
|
||||
|
@ -53,7 +61,7 @@
|
|||
* *seek* теперь работает нормально.
|
||||
* Переписана команда *clips*.
|
||||
|
||||
* Исправление
|
||||
* Исправления
|
||||
* Старые баги.
|
||||
|
||||
* Добавлено
|
||||
|
|
|
@ -29,8 +29,7 @@ class CommandHandler extends BaseEvent {
|
|||
data.memberData = memberData;
|
||||
}
|
||||
|
||||
if (interaction.isAutocomplete())
|
||||
return await command.autocompleteRun(client, interaction);
|
||||
if (interaction.isAutocomplete()) return await command.autocompleteRun(client, interaction);
|
||||
if (interaction.type !== InteractionType.ApplicationCommand && !interaction.isCommand()) return;
|
||||
|
||||
if (command.ownerOnly && interaction.user.id !== client.config.owner.id) return interaction.error("misc:OWNER_ONLY", null, { ephemeral: true });
|
||||
|
|
|
@ -17,11 +17,12 @@ class guildBanAdd extends BaseEvent {
|
|||
async execute(client, ban) {
|
||||
const embed = new EmbedBuilder()
|
||||
.setAuthor({
|
||||
name: client.user.username,
|
||||
name: client.user.getUsername(),
|
||||
iconURL: ban.guild.iconURL(),
|
||||
})
|
||||
.setColor("#FF0000")
|
||||
.setDescription(`Вы были забанены на **${ban.guild.name}** по причине **${ban.reason || "Не указана"}**`);
|
||||
.setColor(client.config.embed.color)
|
||||
.setFooter({ text: client.config.embed.footer })
|
||||
.setDescription(`You were banned from **${ban.guild.name}**!\nReason: **${ban.reason || "Not specified"}**`);
|
||||
|
||||
ban.user.send({
|
||||
embeds: [embed],
|
||||
|
|
|
@ -54,7 +54,8 @@ class GuildCreate extends BaseEvent {
|
|||
name: guild.name,
|
||||
iconURL: guild.iconURL(),
|
||||
})
|
||||
.setColor("#32CD32")
|
||||
.setColor(client.config.embed.color)
|
||||
.setFooter({ text: client.config.embed.footer })
|
||||
.setDescription(`Зашёл на сервер **${guild.name}**. На нём **${users}** ${client.functions.getNoun(users, client.translate("misc:NOUNS:USERS:1"), client.translate("misc:NOUNS:USERS:2"), client.translate("misc:NOUNS:USERS:5"))} и **${bots}** ${client.functions.getNoun(bots, client.translate("misc:NOUNS:BOTS:1"), client.translate("misc:NOUNS:BOTS:2"), client.translate("misc:NOUNS:BOTS:5"))}`);
|
||||
client.channels.cache.get(client.config.support.logs).send({
|
||||
embeds: [embed],
|
||||
|
|
|
@ -20,7 +20,8 @@ class GuildDelete extends BaseEvent {
|
|||
name: guild.name,
|
||||
iconURL: guild.iconURL(),
|
||||
})
|
||||
.setColor("#FF0000")
|
||||
.setColor(client.config.embed.color)
|
||||
.setFooter({ text: client.config.embed.footer })
|
||||
.setDescription(`Вышел с сервера **${guild.name}**.`);
|
||||
client.channels.cache.get(client.config.support.logs).send({
|
||||
embeds: [embed],
|
||||
|
|
|
@ -28,12 +28,12 @@ class GuildMemberAdd extends BaseEvent {
|
|||
* @param {import("discord.js").GuildMember} member
|
||||
*/
|
||||
async execute(client, member) {
|
||||
if (member.guild && member.guild.id === "568120814776614924") return;
|
||||
if (member.guild && member.guildId === "568120814776614924") return;
|
||||
|
||||
await member.guild.members.fetch();
|
||||
|
||||
const guildData = await client.findOrCreateGuild({
|
||||
id: member.guild.id,
|
||||
id: member.guildId,
|
||||
});
|
||||
|
||||
if (guildData.plugins.autorole.enabled) member.roles.add(guildData.plugins.autorole.role);
|
||||
|
|
|
@ -28,12 +28,12 @@ class GuildMemberRemove extends BaseEvent {
|
|||
* @param {import("discord.js").GuildMember} member
|
||||
*/
|
||||
async execute(client, member) {
|
||||
if (member.guild && member.guild.id === "568120814776614924") return;
|
||||
if (member.guild && member.guildId === "568120814776614924") return;
|
||||
|
||||
await member.guild.members.fetch();
|
||||
|
||||
const guildData = await client.findOrCreateGuild({
|
||||
id: member.guild.id,
|
||||
id: member.guildId,
|
||||
});
|
||||
|
||||
if (guildData.plugins.goodbye.enabled) {
|
||||
|
|
|
@ -15,8 +15,8 @@ class GuildMemberUpdate extends BaseEvent {
|
|||
* @param {import("discord.js").GuildMember} newMember
|
||||
*/
|
||||
async execute(client, oldMember, newMember) {
|
||||
if (oldMember.guild && oldMember.guild.id === "568120814776614924") return;
|
||||
if (oldMember.guild.id !== client.config.support.id) return;
|
||||
if (oldMember.guild && oldMember.guildId === "568120814776614924") return;
|
||||
if (oldMember.guildId !== client.config.support.id) return;
|
||||
if (oldMember.roles.cache.some(r => r.id === "940149470975365191")) return;
|
||||
|
||||
if (newMember?.roles.cache.some(r => r.id === "940149470975365191")) {
|
||||
|
|
|
@ -105,7 +105,9 @@ class MessageCreate extends BaseEvent {
|
|||
const afkReason = data.userData.afk;
|
||||
if (afkReason) {
|
||||
data.userData.afk = null;
|
||||
data.userData.markModified("afk");
|
||||
await data.userData.save();
|
||||
|
||||
message.replyT("general/afk:DELETED", {
|
||||
user: message.author.username,
|
||||
}, { mention: true });
|
||||
|
@ -154,6 +156,9 @@ async function updateXp(client, msg, memberData) {
|
|||
}, { mention: false });
|
||||
} else memberData.exp = parseInt(newXp, 10);
|
||||
|
||||
memberData.markModified("exp");
|
||||
memberData.markModified("level");
|
||||
|
||||
await memberData.save();
|
||||
}
|
||||
|
||||
|
|
45
events/Monitoring/messageUpdate.js
Normal file
45
events/Monitoring/messageUpdate.js
Normal file
|
@ -0,0 +1,45 @@
|
|||
const { EmbedBuilder } = require("discord.js"),
|
||||
BaseEvent = require("../../base/BaseEvent");
|
||||
|
||||
class messageUpdate extends BaseEvent {
|
||||
constructor() {
|
||||
super({
|
||||
name: "messageUpdate",
|
||||
once: false,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {import("../../base/JaBa")} client
|
||||
* @param {import("discord.js").Message} oldMessage
|
||||
* @param {import("discord.js").Message} newMessage
|
||||
*/
|
||||
async execute(client, oldMessage, newMessage) {
|
||||
if (oldMessage.guild && oldMessage.guildId === "568120814776614924") return;
|
||||
if (oldMessage.author.bot) return;
|
||||
|
||||
if (oldMessage.content === newMessage.content) return;
|
||||
|
||||
const guildData = await client.findOrCreateGuild({ id: oldMessage.guildId });
|
||||
|
||||
if (guildData.plugins.monitoring.messageUpdate) {
|
||||
const embed = new EmbedBuilder()
|
||||
.setAuthor({
|
||||
name: newMessage.author.getUsername(),
|
||||
iconURL: newMessage.author.displayAvatarURL(),
|
||||
})
|
||||
.setColor(client.config.embed.color)
|
||||
.setFooter({ text: client.config.embed.footer })
|
||||
.setTitle(`${newMessage.author.getUsername()} edited a message!`)
|
||||
.setDescription(`Old Message: \`\`\`${oldMessage.content}\`\`\`\nNew Message: \`\`\`${newMessage.content}\`\`\`\nJump to message: ${newMessage.url}`);
|
||||
|
||||
newMessage.guild.channels.cache.get(guildData.plugins.monitoring.messageUpdate).send({
|
||||
embeds: [embed],
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = messageUpdate;
|
|
@ -48,6 +48,7 @@ module.exports.init = function (client) {
|
|||
});
|
||||
});
|
||||
user.reminds = user.reminds.filter(r => r.sendAt >= dateNow);
|
||||
user.markModified("reminds");
|
||||
user.save();
|
||||
|
||||
if (user.reminds.length === 0) client.databaseCache.usersReminds.delete(user.id);
|
||||
|
|
|
@ -29,6 +29,8 @@ module.exports.init = async function (client) {
|
|||
if (transaction.date < timestamp) {
|
||||
const index = transactions.indexOf(transaction);
|
||||
transactions.splice(index, 1);
|
||||
|
||||
member.markModified("transactions");
|
||||
await member.save();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,33 +3,30 @@
|
|||
"USAGE": "list\nset [setting] (state) (#channel)",
|
||||
"EXAMPLES": "config list\nconfig set setting:reports state:True channel:#reports",
|
||||
|
||||
"SPECIAL_CHANNELS": "Special Channels",
|
||||
"BIRTHDAYS": "Birthday Greetings",
|
||||
"MODLOGS": "Moderation Logs",
|
||||
"REPORTS": "Reports",
|
||||
"SUGGESTIONS": "Suggestions",
|
||||
|
||||
"BIRTHDAYS_LIST": "Birthday Greetings: {{channel}}",
|
||||
"MODLOGS_LIST": "Moderation Logs: {{channel}}",
|
||||
"NEWS_LIST": "Bot News: {{channel}}",
|
||||
"REPORTS_LIST": "Reports: {{channel}}",
|
||||
"SUGGESTIONS_LIST": "Suggestions: {{channel}}",
|
||||
"MONITORING_CHANNELS": "Monitoring Channels",
|
||||
"MESSAGEUPDATE": "Message Update Logs",
|
||||
|
||||
"AUTOMOD_CONTENT": "Automoderation is enabled.\nIgnored channels: {{channels}}",
|
||||
"AUTOMOD_TITLE": "Automoderation",
|
||||
"AUTOMOD_CONTENT": "Automoderation is enabled.\nIgnored channels: {{channels}}",
|
||||
"AUTOROLE_TITLE": "Automatic Role Assignment",
|
||||
"AUTO_SANCTIONS": "Automatic Sanctions",
|
||||
"BAN_CONTENT": "Ban: After **{{count}}** warnings",
|
||||
"BAN_NOT_DEFINED": "Ban: Not set",
|
||||
"DASHBOARD_CONTENT": "Click here to go to the dashboard",
|
||||
"DASHBOARD_TITLE": "Modify Settings",
|
||||
"GOODBYE_CONTENT": "Channel: {{channel}}\nCard: {{withImage}}",
|
||||
"DASHBOARD_CONTENT": "Click here to go to the dashboard",
|
||||
"GOODBYE_TITLE": "Farewell",
|
||||
"GOODBYE_CONTENT": "Channel: {{channel}}\nCard: {{withImage}}",
|
||||
"KICK_CONTENT": "Kick: After **{{count}}** warnings",
|
||||
"KICK_NOT_DEFINED": "Kick: Not set",
|
||||
"LIST": "Display server settings",
|
||||
"SET": "Modify server settings",
|
||||
"SETTING": "Settings",
|
||||
"SPECIAL_CHANNELS": "Special Channels",
|
||||
"WELCOME_CONTENT": "Channel: {{channel}}\nCard: {{withImage}}",
|
||||
"WELCOME_TITLE": "Welcome"
|
||||
"WELCOME_TITLE": "Welcome",
|
||||
"WELCOME_CONTENT": "Channel: {{channel}}\nCard: {{withImage}}"
|
||||
}
|
|
@ -3,33 +3,30 @@
|
|||
"USAGE": "list\nset [setting] (state) (#channel)",
|
||||
"EXAMPLES": "config list\nconfig set setting:reports state:True channel:#reports",
|
||||
|
||||
"SPECIAL_CHANNELS": "Специальные каналы",
|
||||
"BIRTHDAYS": "Поздравления с днём рождения",
|
||||
"MODLOGS": "Логи модерации",
|
||||
"REPORTS": "Жалобы",
|
||||
"SUGGESTIONS": "Предложения",
|
||||
|
||||
"BIRTHDAYS_LIST": "Поздравления с днём рождения: {{channel}}",
|
||||
"MODLOGS_LIST": "Логи модерации: {{channel}}",
|
||||
"NEWS_LIST": "Новости бота: {{channel}}",
|
||||
"REPORTS_LIST": "Жалобы: {{channel}}",
|
||||
"SUGGESTIONS_LIST": "Предложения: {{channel}}",
|
||||
"MONITORING_CHANNELS": "Каналы мониторинга",
|
||||
"MESSAGEUPDATE": "Логи изменения сообщений",
|
||||
|
||||
"AUTOMOD_CONTENT": "Автомодерация включена.\nИгнорируемые каналы: {{channels}}",
|
||||
"AUTOMOD_TITLE": "Автомодерация",
|
||||
"AUTOMOD_CONTENT": "Автомодерация включена.\nИгнорируемые каналы: {{channels}}",
|
||||
"AUTOROLE_TITLE": "Автоназначение роли при входе",
|
||||
"AUTO_SANCTIONS": "Автоматические наказания",
|
||||
"BAN_CONTENT": "Бан: После **{{count}}** предупреждений",
|
||||
"BAN_NOT_DEFINED": "Бан: Не назначено",
|
||||
"DASHBOARD_CONTENT": "Нажмите сюда, чтобы перейти в панель управления",
|
||||
"DASHBOARD_TITLE": "Изменить настройки",
|
||||
"GOODBYE_CONTENT": "Канал: {{channel}}\nКарточка: {{withImage}}",
|
||||
"DASHBOARD_CONTENT": "Нажмите сюда, чтобы перейти в панель управления",
|
||||
"GOODBYE_TITLE": "Прощание",
|
||||
"GOODBYE_CONTENT": "Канал: {{channel}}\nКарточка: {{withImage}}",
|
||||
"KICK_CONTENT": "Кик: После **{{count}}** предупреждений",
|
||||
"KICK_NOT_DEFINED": "Кик: Не назначено",
|
||||
"LIST": "Показать настройки сервера",
|
||||
"SET": "Изменить настройки сервера",
|
||||
"SETTING": "Параметр",
|
||||
"SPECIAL_CHANNELS": "Специальные каналы",
|
||||
"WELCOME_CONTENT": "Канал: {{channel}}\nКарточка: {{withImage}}",
|
||||
"WELCOME_TITLE": "Приветствие"
|
||||
"WELCOME_TITLE": "Приветствие",
|
||||
"WELCOME_CONTENT": "Канал: {{channel}}\nКарточка: {{withImage}}"
|
||||
}
|
|
@ -2,23 +2,31 @@
|
|||
"DESCRIPTION": "Показати налаштування сервера",
|
||||
"USAGE": "",
|
||||
"EXAMPLES": "config",
|
||||
"AUTOROLE_TITLE": "Автопризначення ролі при вході",
|
||||
"WELCOME_TITLE": "Привітання",
|
||||
"WELCOME_CONTENT": "Канал: {{channel}}\nКартка: {{withImage}}",
|
||||
"GOODBYE_TITLE": "Прощання",
|
||||
"GOODBYE_CONTENT": "Канал: {{channel}}\nКартка: {{withImage}}",
|
||||
|
||||
"SPECIAL_CHANNELS": "Спеціальні канали",
|
||||
"MODLOGS": "Логи модерації: {{channel}}",
|
||||
"BIRTHDAYS": "Привітання з днем народження: {{channel}}",
|
||||
"SUGGESTIONS": "Пропозиції: {{channel}}",
|
||||
"REPORTS": "Скарги: {{channel}}",
|
||||
"BIRTHDAYS": "Привітання з днем народження",
|
||||
"MODLOGS": "Логи модерації",
|
||||
"REPORTS": "Скарги",
|
||||
"SUGGESTIONS": "Пропозиції",
|
||||
|
||||
"MONITORING_CHANNELS": "Каналы мониторинга",
|
||||
"MESSAGEUPDATE": "Логи изменения сообщений",
|
||||
|
||||
"AUTOMOD_TITLE": "Автомодерація",
|
||||
"AUTOMOD_CONTENT": "Автомодерація включена.\nІгноровані канали: {{channels}}",
|
||||
"AUTOROLE_TITLE": "Автопризначення ролі при вході",
|
||||
"AUTO_SANCTIONS": "Автоматичні покарання",
|
||||
"KICK_CONTENT": "Кік: Після **{{count}}** попереджень",
|
||||
"KICK_NOT_DEFINED": "Кік: Не призначено",
|
||||
"BAN_CONTENT": "Бан: Після **{{count}}** попереджень",
|
||||
"BAN_NOT_DEFINED": "Бан: Не призначено",
|
||||
"DASHBOARD_TITLE": "Змінити налаштування",
|
||||
"DASHBOARD_CONTENT": "Натисніть сюди, щоб перейти до панелі керування"
|
||||
"DASHBOARD_CONTENT": "Натисніть сюди, щоб перейти до панелі керування",
|
||||
"GOODBYE_TITLE": "Прощання",
|
||||
"GOODBYE_CONTENT": "Канал: {{channel}}\nКартка: {{withImage}}",
|
||||
"KICK_CONTENT": "Кік: Після **{{count}}** попереджень",
|
||||
"KICK_NOT_DEFINED": "Кік: Не призначено",
|
||||
"LIST": "Показати налаштування серверу",
|
||||
"SET": "Змінити налаштування серверу ",
|
||||
"SETTING": "Параметр",
|
||||
"WELCOME_TITLE": "Привітання",
|
||||
"WELCOME_CONTENT": "Канал: {{channel}}\nКартка: {{withImage}}"
|
||||
}
|
4
package-lock.json
generated
4
package-lock.json
generated
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "jaba",
|
||||
"version": "4.3.0",
|
||||
"version": "4.3.1",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "jaba",
|
||||
"version": "4.3.0",
|
||||
"version": "4.3.1",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@discord-player/extractor": "^4.3.1",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "jaba",
|
||||
"version": "4.3.0",
|
||||
"version": "4.3.1",
|
||||
"description": "My Discord Bot",
|
||||
"main": "index.js",
|
||||
"private": true,
|
||||
|
|
|
@ -1,61 +0,0 @@
|
|||
const chalk = require("chalk");
|
||||
console.log(chalk.blue("Creating database indexes...\n\n"));
|
||||
|
||||
let MongoClient;
|
||||
|
||||
try {
|
||||
MongoClient = require("mongodb").MongoClient;
|
||||
} catch (e) {
|
||||
console.log(chalk.red("Cannot find module mongodb. Please install it using \"npm install mongodb\" before executing script."));
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const config = require("../config");
|
||||
const dbName = config.mongoDB.split("/").pop();
|
||||
const baseURL = config.mongoDB.substr(0, config.mongoDB.length - dbName.length);
|
||||
const client = new MongoClient(baseURL, {
|
||||
useNewUrlParser: true,
|
||||
useUnifiedTopology: true,
|
||||
});
|
||||
|
||||
client.connect().then(async () => {
|
||||
console.log(chalk.green("Connected successfully to mongoDB database."));
|
||||
|
||||
const db = client.db(dbName);
|
||||
const guilds = db.collection("guilds");
|
||||
const members = db.collection("members");
|
||||
const users = db.collection("users");
|
||||
|
||||
console.log(chalk.yellow("Creating guilds index..."));
|
||||
|
||||
await guilds.createIndex({
|
||||
id: 1,
|
||||
});
|
||||
|
||||
console.log(chalk.green("Guilds index created."));
|
||||
|
||||
console.log(chalk.yellow("Creating members index..."));
|
||||
|
||||
await members.createIndex({
|
||||
guildID: 1,
|
||||
id: -1,
|
||||
});
|
||||
|
||||
console.log(chalk.green("Members index created."));
|
||||
|
||||
console.log(chalk.yellow("Creating users index..."));
|
||||
|
||||
await users.createIndex({
|
||||
id: 1,
|
||||
});
|
||||
|
||||
console.log(chalk.green("Users index created."));
|
||||
|
||||
console.log(chalk.blue("\n\nIndexes created."));
|
||||
|
||||
process.exit(0);
|
||||
}).catch(() => {
|
||||
console.log(chalk.red("Couldn't connect to mongoDB database..."));
|
||||
|
||||
process.exit(1);
|
||||
});
|
Loading…
Reference in a new issue