mirror of
https://github.com/JonnyBro/JaBa.git
synced 2024-11-22 05:04:58 +05:00
Фиксики
This commit is contained in:
parent
fee1ad9578
commit
c0ecde0168
5 changed files with 27 additions and 18 deletions
|
@ -18,15 +18,6 @@ class Transactions extends Command {
|
||||||
}
|
}
|
||||||
|
|
||||||
async run(message, args, data) {
|
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()
|
const embed = new Discord.MessageEmbed()
|
||||||
.setAuthor({
|
.setAuthor({
|
||||||
name: message.translate("economy/transactions:EMBED_TRANSACTIONS"),
|
name: message.translate("economy/transactions:EMBED_TRANSACTIONS"),
|
||||||
|
|
|
@ -36,6 +36,10 @@ module.exports = class {
|
||||||
const checkReminds = require("../helpers/checkReminds");
|
const checkReminds = require("../helpers/checkReminds");
|
||||||
checkReminds.init(client);
|
checkReminds.init(client);
|
||||||
|
|
||||||
|
// Clear transactions
|
||||||
|
const clearTransactions = require("../helpers/clearTransactions");
|
||||||
|
clearTransactions.init(client);
|
||||||
|
|
||||||
// Start the dashboard
|
// Start the dashboard
|
||||||
if (client.config.dashboard.enabled) client.dashboard.load(client);
|
if (client.config.dashboard.enabled) client.dashboard.load(client);
|
||||||
|
|
||||||
|
|
|
@ -41,13 +41,8 @@ module.exports = {
|
||||||
text += `${table(arrCat)}\n\n`;
|
text += `${table(arrCat)}\n\n`;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!fs.existsSync("./dashboard/public/docs")) {
|
if (!fs.existsSync("./dashboard/public/docs")) fs.mkdirSync("./dashboard/public/docs");
|
||||||
fs.mkdirSync("./dashboard/public/docs");
|
fs.writeFileSync("./dashboard/public/docs/commands.md", text);
|
||||||
fs.writeFileSync("./dashboard/public/docs/commands.md", text);
|
client.logger.log("Dashboard docs updated!");
|
||||||
client.logger.log("Dashboard docs updated!");
|
|
||||||
} else {
|
|
||||||
fs.writeFileSync("./dashboard/public/docs/commands.md", text);
|
|
||||||
client.logger.log("Dashboard docs updated!");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
19
helpers/clearTransactions.js
Normal file
19
helpers/clearTransactions.js
Normal 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
|
||||||
|
},
|
||||||
|
};
|
|
@ -37,7 +37,7 @@ module.exports = {
|
||||||
}).catch(() => {});
|
}).catch(() => {});
|
||||||
|
|
||||||
return invite ? invite.url : "No URL";
|
return invite ? invite.url : "No URL";
|
||||||
} return "No Invite";
|
} return "No channels found for invite";
|
||||||
},
|
},
|
||||||
|
|
||||||
sortByKey(array, key) {
|
sortByKey(array, key) {
|
||||||
|
|
Loading…
Reference in a new issue