Фиксики

This commit is contained in:
JonnyBro 2022-07-02 01:17:00 +05:00
parent fee1ad9578
commit c0ecde0168
5 changed files with 27 additions and 18 deletions

View file

@ -18,15 +18,6 @@ class Transactions extends Command {
}
async run(message, args, data) {
const timestamp = Date.now() + (30 * 24 * 60 * 60 * 1000); // day hour min sec msec / 1 month
for await (const transaction of data.memberData.transactions) {
if (transaction.date < timestamp) {
const index = data.memberData.transactions.indexOf(transaction);
data.memberData.transactions.splice(index, 1);
await data.memberData.save();
}
}
const embed = new Discord.MessageEmbed()
.setAuthor({
name: message.translate("economy/transactions:EMBED_TRANSACTIONS"),

View file

@ -36,6 +36,10 @@ module.exports = class {
const checkReminds = require("../helpers/checkReminds");
checkReminds.init(client);
// Clear transactions
const clearTransactions = require("../helpers/clearTransactions");
clearTransactions.init(client);
// Start the dashboard
if (client.config.dashboard.enabled) client.dashboard.load(client);

View file

@ -41,13 +41,8 @@ module.exports = {
text += `${table(arrCat)}\n\n`;
});
if (!fs.existsSync("./dashboard/public/docs")) {
fs.mkdirSync("./dashboard/public/docs");
fs.writeFileSync("./dashboard/public/docs/commands.md", text);
client.logger.log("Dashboard docs updated!");
} else {
fs.writeFileSync("./dashboard/public/docs/commands.md", text);
client.logger.log("Dashboard docs updated!");
}
if (!fs.existsSync("./dashboard/public/docs")) fs.mkdirSync("./dashboard/public/docs");
fs.writeFileSync("./dashboard/public/docs/commands.md", text);
client.logger.log("Dashboard docs updated!");
}
};

View file

@ -0,0 +1,19 @@
module.exports = {
async init(client) {
setInterval(async () => {
const timestamp = Date.now() + 30 * 24 * 60 * 60 * 1000; // day hour min sec msec / 1 month
const members = client.membersData.find({ transactions: { $gt: [] } });
for (const member of members) {
const transactions = member.transactions;
for await (const transaction of transactions) {
if (transaction.date < timestamp) {
const index = transactions.indexOf(transaction);
transactions.splice(index, 1);
await member.save();
}
}
}
}, 24 * 60 * 60 * 1000); // every 24 hours
},
};

View file

@ -37,7 +37,7 @@ module.exports = {
}).catch(() => {});
return invite ? invite.url : "No URL";
} return "No Invite";
} return "No channels found for invite";
},
sortByKey(array, key) {