mirror of
https://github.com/JonnyBro/JaBa.git
synced 2024-11-22 05:04:58 +05:00
Мелкие правки
This commit is contained in:
parent
01d036c3d1
commit
75b6004203
10 changed files with 53 additions and 16 deletions
|
@ -41,6 +41,7 @@ class Profile extends BaseCommand {
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction, data) {
|
async execute(client, interaction, data) {
|
||||||
await interaction.deferReply();
|
await interaction.deferReply();
|
||||||
|
|
||||||
const member = interaction.options.getMember("user") || interaction.member;
|
const member = interaction.options.getMember("user") || interaction.member;
|
||||||
if (member.user.bot) return interaction.error("economy/profile:BOT_USER");
|
if (member.user.bot) return interaction.error("economy/profile:BOT_USER");
|
||||||
|
|
||||||
|
@ -66,7 +67,7 @@ class Profile extends BaseCommand {
|
||||||
const profileEmbed = new EmbedBuilder()
|
const profileEmbed = new EmbedBuilder()
|
||||||
.setAuthor({
|
.setAuthor({
|
||||||
name: interaction.translate("economy/profile:TITLE", {
|
name: interaction.translate("economy/profile:TITLE", {
|
||||||
username: member.user.tag
|
user: member.nickname
|
||||||
}),
|
}),
|
||||||
iconURL: member.displayAvatarURL()
|
iconURL: member.displayAvatarURL()
|
||||||
})
|
})
|
||||||
|
|
|
@ -63,7 +63,7 @@ class Queue extends BaseCommand {
|
||||||
);
|
);
|
||||||
|
|
||||||
await interaction.reply({
|
await interaction.reply({
|
||||||
content: `${interaction.translate("common:PAGE")}: **${currentPage + 1}**/${embeds.length}`,
|
content: `${interaction.translate("common:PAGE")}: **${currentPage + 1}**/**${embeds.length}**`,
|
||||||
embeds: [embeds[currentPage]],
|
embeds: [embeds[currentPage]],
|
||||||
components: [row]
|
components: [row]
|
||||||
});
|
});
|
||||||
|
@ -80,7 +80,7 @@ class Queue extends BaseCommand {
|
||||||
if (currentPage !== 0) {
|
if (currentPage !== 0) {
|
||||||
--currentPage;
|
--currentPage;
|
||||||
interaction.editReply({
|
interaction.editReply({
|
||||||
content: `${interaction.translate("common:PAGE")}: **${currentPage + 1}**/${embeds.length}`,
|
content: `${interaction.translate("common:PAGE")}: **${currentPage + 1}**/**${embeds.length}**`,
|
||||||
embeds: [embeds[currentPage]],
|
embeds: [embeds[currentPage]],
|
||||||
components: [row]
|
components: [row]
|
||||||
});
|
});
|
||||||
|
@ -92,7 +92,7 @@ class Queue extends BaseCommand {
|
||||||
if (currentPage < embeds.length - 1) {
|
if (currentPage < embeds.length - 1) {
|
||||||
currentPage++;
|
currentPage++;
|
||||||
interaction.editReply({
|
interaction.editReply({
|
||||||
content: `${interaction.translate("common:PAGE")}: **${currentPage + 1}**/${embeds.length}`,
|
content: `${interaction.translate("common:PAGE")}: **${currentPage + 1}**/**${embeds.length}**`,
|
||||||
embeds: [embeds[currentPage]],
|
embeds: [embeds[currentPage]],
|
||||||
components: [row]
|
components: [row]
|
||||||
});
|
});
|
||||||
|
@ -116,7 +116,7 @@ class Queue extends BaseCommand {
|
||||||
if (embeds[collected.first().content - 1]) {
|
if (embeds[collected.first().content - 1]) {
|
||||||
currentPage = collected.first().content - 1;
|
currentPage = collected.first().content - 1;
|
||||||
interaction.editReply({
|
interaction.editReply({
|
||||||
content: `${interaction.translate("common:PAGE")}: **${currentPage + 1}**/${embeds.length}`,
|
content: `${interaction.translate("common:PAGE")}: **${currentPage + 1}**/**${embeds.length}**`,
|
||||||
embeds: [embeds[currentPage]],
|
embeds: [embeds[currentPage]],
|
||||||
components: [row]
|
components: [row]
|
||||||
});
|
});
|
||||||
|
|
|
@ -35,6 +35,8 @@ class Eval extends BaseCommand {
|
||||||
*/
|
*/
|
||||||
// eslint-disable-next-line no-unused-vars
|
// eslint-disable-next-line no-unused-vars
|
||||||
async execute(client, interaction, data) {
|
async execute(client, interaction, data) {
|
||||||
|
await interaction.deferReply({ ephemeral: true });
|
||||||
|
|
||||||
const code = interaction.options.getString("code");
|
const code = interaction.options.getString("code");
|
||||||
const result = new Promise(resolve => resolve(eval(code)));
|
const result = new Promise(resolve => resolve(eval(code)));
|
||||||
|
|
||||||
|
@ -42,18 +44,16 @@ class Eval extends BaseCommand {
|
||||||
if (typeof output != "string") output = require("util").inspect(output, { depth: 0 });
|
if (typeof output != "string") output = require("util").inspect(output, { depth: 0 });
|
||||||
|
|
||||||
if (output.includes(client.token)) output = output.replace(client.token, "T0K3N");
|
if (output.includes(client.token)) output = output.replace(client.token, "T0K3N");
|
||||||
interaction.reply({
|
interaction.editReply({
|
||||||
content: "```js\n" + output + "```",
|
content: "```js\n" + output + "```"
|
||||||
ephemeral: true
|
|
||||||
});
|
});
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
err = err.toString();
|
err = err.toString();
|
||||||
|
|
||||||
if (err.includes(client.token)) err = err.replace(client.token, "T0K3N");
|
if (err.includes(client.token)) err = err.replace(client.token, "T0K3N");
|
||||||
interaction.reply({
|
interaction.editReply({
|
||||||
content: "```js\n" + err + "```",
|
content: "```js\n" + err + "```"
|
||||||
ephemeral: true
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,7 +73,7 @@ class Servers extends BaseCommand {
|
||||||
if (currentPage !== 0) {
|
if (currentPage !== 0) {
|
||||||
--currentPage;
|
--currentPage;
|
||||||
interaction.editReply({
|
interaction.editReply({
|
||||||
content: `${interaction.translate("common:PAGE")}: **${currentPage + 1}**/${embeds.length}`,
|
content: `${interaction.translate("common:PAGE")}: **${currentPage + 1}**/**${embeds.length}**`,
|
||||||
embeds: [embeds[currentPage]],
|
embeds: [embeds[currentPage]],
|
||||||
components: [row]
|
components: [row]
|
||||||
});
|
});
|
||||||
|
@ -84,7 +84,7 @@ class Servers extends BaseCommand {
|
||||||
if (currentPage < embeds.length - 1) {
|
if (currentPage < embeds.length - 1) {
|
||||||
currentPage++;
|
currentPage++;
|
||||||
interaction.editReply({
|
interaction.editReply({
|
||||||
content: `${interaction.translate("common:PAGE")}: **${currentPage + 1}**/${embeds.length}`,
|
content: `${interaction.translate("common:PAGE")}: **${currentPage + 1}**/**${embeds.length}**`,
|
||||||
embeds: [embeds[currentPage]],
|
embeds: [embeds[currentPage]],
|
||||||
components: [row]
|
components: [row]
|
||||||
});
|
});
|
||||||
|
@ -107,7 +107,7 @@ class Servers extends BaseCommand {
|
||||||
if (embeds[collected.first().content - 1]) {
|
if (embeds[collected.first().content - 1]) {
|
||||||
currentPage = collected.first().content - 1;
|
currentPage = collected.first().content - 1;
|
||||||
interaction.editReply({
|
interaction.editReply({
|
||||||
content: `${interaction.translate("common:PAGE")}: **${currentPage + 1}**/${embeds.length}`,
|
content: `${interaction.translate("common:PAGE")}: **${currentPage + 1}**/**${embeds.length}**`,
|
||||||
embeds: [embeds[currentPage]],
|
embeds: [embeds[currentPage]],
|
||||||
components: [row]
|
components: [row]
|
||||||
});
|
});
|
||||||
|
|
|
@ -36,8 +36,8 @@ class Ready extends BaseEvent {
|
||||||
checkReminds.init(client);
|
checkReminds.init(client);
|
||||||
|
|
||||||
// Clear transactions
|
// Clear transactions
|
||||||
const clearTransactions = require("../helpers/clearTransactions");
|
const cleanup = require("../helpers/cleanup");
|
||||||
clearTransactions.init(client);
|
cleanup.init(client);
|
||||||
|
|
||||||
// Start the dashboard
|
// Start the dashboard
|
||||||
if (client.config.dashboard.enabled) client.dashboard.init(client);
|
if (client.config.dashboard.enabled) client.dashboard.init(client);
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
const table = require("markdown-table"),
|
const table = require("markdown-table"),
|
||||||
fs = require("fs");
|
fs = require("fs");
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {import("../base/JaBa")} client
|
||||||
|
*/
|
||||||
module.exports.update = function (client) {
|
module.exports.update = function (client) {
|
||||||
const commands = [...new Map(client.commands.map(v => [v.constructor.name, v])).values()],
|
const commands = [...new Map(client.commands.map(v => [v.constructor.name, v])).values()],
|
||||||
categories = [];
|
categories = [];
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
const { CronJob } = require("cron"),
|
const { CronJob } = require("cron"),
|
||||||
{ EmbedBuilder } = require("discord.js");
|
{ EmbedBuilder } = require("discord.js");
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {import("../base/JaBa")} client
|
||||||
|
*/
|
||||||
module.exports.init = async function (client) {
|
module.exports.init = async function (client) {
|
||||||
new CronJob("0 5 * * *", async function () {
|
new CronJob("0 5 * * *", async function () {
|
||||||
client.guilds.cache.forEach(async (guild) => {
|
client.guilds.cache.forEach(async (guild) => {
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
const { EmbedBuilder } = require("discord.js");
|
const { EmbedBuilder } = require("discord.js");
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {import("../base/JaBa")} client
|
||||||
|
*/
|
||||||
module.exports.init = function (client) {
|
module.exports.init = function (client) {
|
||||||
client.usersData
|
client.usersData
|
||||||
.find({ reminds: { $gt: [] } })
|
.find({ reminds: { $gt: [] } })
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
const { EmbedBuilder } = require("discord.js");
|
const { EmbedBuilder } = require("discord.js");
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {import("../base/JaBa")} client
|
||||||
|
*/
|
||||||
module.exports.init = async function (client) {
|
module.exports.init = async function (client) {
|
||||||
client.membersData
|
client.membersData
|
||||||
.find({ "mute.muted": true })
|
.find({ "mute.muted": true })
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {import("../base/JaBa")} client
|
||||||
|
*/
|
||||||
module.exports.init = async function (client) {
|
module.exports.init = async function (client) {
|
||||||
setInterval(async () => {
|
setInterval(async () => {
|
||||||
const timestamp = Date.now() + (30 * 24 * 60 * 60 * 1000); // 1 month
|
const timestamp = Date.now() + (30 * 24 * 60 * 60 * 1000); // 1 month
|
||||||
|
@ -14,4 +18,20 @@ module.exports.init = async function (client) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, (7 * 24 * 60 * 60 * 1000)); // every 7 days
|
}, (7 * 24 * 60 * 60 * 1000)); // every 7 days
|
||||||
|
|
||||||
|
/*
|
||||||
|
setInterval(async () => {
|
||||||
|
client.usersData.find({}, function (err, res) {
|
||||||
|
for (const user of res) {
|
||||||
|
client.users.fetch(user.id).then(u => {
|
||||||
|
if (u.username.match(/.*Deleted User.* [A-z0-9]+/g)) {
|
||||||
|
client.databaseCache.users.delete(user.id);
|
||||||
|
client.usersData.deleteOne({ id: user.id });
|
||||||
|
console.log(`Removed from database deleted user - ID: ${u.id} Username: ${u.username}`);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}, (7 * 24 * 60 * 60 * 1000)); // every 7 days
|
||||||
|
*/
|
||||||
};
|
};
|
Loading…
Reference in a new issue