Мелкие правки

This commit is contained in:
JonnyBro 2022-08-30 14:26:56 +05:00
parent 01d036c3d1
commit 75b6004203
10 changed files with 53 additions and 16 deletions

View file

@ -41,6 +41,7 @@ class Profile extends BaseCommand {
*/
async execute(client, interaction, data) {
await interaction.deferReply();
const member = interaction.options.getMember("user") || interaction.member;
if (member.user.bot) return interaction.error("economy/profile:BOT_USER");
@ -66,7 +67,7 @@ class Profile extends BaseCommand {
const profileEmbed = new EmbedBuilder()
.setAuthor({
name: interaction.translate("economy/profile:TITLE", {
username: member.user.tag
user: member.nickname
}),
iconURL: member.displayAvatarURL()
})

View file

@ -63,7 +63,7 @@ class Queue extends BaseCommand {
);
await interaction.reply({
content: `${interaction.translate("common:PAGE")}: **${currentPage + 1}**/${embeds.length}`,
content: `${interaction.translate("common:PAGE")}: **${currentPage + 1}**/**${embeds.length}**`,
embeds: [embeds[currentPage]],
components: [row]
});
@ -80,7 +80,7 @@ class Queue extends BaseCommand {
if (currentPage !== 0) {
--currentPage;
interaction.editReply({
content: `${interaction.translate("common:PAGE")}: **${currentPage + 1}**/${embeds.length}`,
content: `${interaction.translate("common:PAGE")}: **${currentPage + 1}**/**${embeds.length}**`,
embeds: [embeds[currentPage]],
components: [row]
});
@ -92,7 +92,7 @@ class Queue extends BaseCommand {
if (currentPage < embeds.length - 1) {
currentPage++;
interaction.editReply({
content: `${interaction.translate("common:PAGE")}: **${currentPage + 1}**/${embeds.length}`,
content: `${interaction.translate("common:PAGE")}: **${currentPage + 1}**/**${embeds.length}**`,
embeds: [embeds[currentPage]],
components: [row]
});
@ -116,7 +116,7 @@ class Queue extends BaseCommand {
if (embeds[collected.first().content - 1]) {
currentPage = collected.first().content - 1;
interaction.editReply({
content: `${interaction.translate("common:PAGE")}: **${currentPage + 1}**/${embeds.length}`,
content: `${interaction.translate("common:PAGE")}: **${currentPage + 1}**/**${embeds.length}**`,
embeds: [embeds[currentPage]],
components: [row]
});

View file

@ -35,6 +35,8 @@ class Eval extends BaseCommand {
*/
// eslint-disable-next-line no-unused-vars
async execute(client, interaction, data) {
await interaction.deferReply({ ephemeral: true });
const code = interaction.options.getString("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 (output.includes(client.token)) output = output.replace(client.token, "T0K3N");
interaction.reply({
content: "```js\n" + output + "```",
ephemeral: true
interaction.editReply({
content: "```js\n" + output + "```"
});
}).catch(err => {
console.error(err);
err = err.toString();
if (err.includes(client.token)) err = err.replace(client.token, "T0K3N");
interaction.reply({
content: "```js\n" + err + "```",
ephemeral: true
interaction.editReply({
content: "```js\n" + err + "```"
});
});
}

View file

@ -73,7 +73,7 @@ class Servers extends BaseCommand {
if (currentPage !== 0) {
--currentPage;
interaction.editReply({
content: `${interaction.translate("common:PAGE")}: **${currentPage + 1}**/${embeds.length}`,
content: `${interaction.translate("common:PAGE")}: **${currentPage + 1}**/**${embeds.length}**`,
embeds: [embeds[currentPage]],
components: [row]
});
@ -84,7 +84,7 @@ class Servers extends BaseCommand {
if (currentPage < embeds.length - 1) {
currentPage++;
interaction.editReply({
content: `${interaction.translate("common:PAGE")}: **${currentPage + 1}**/${embeds.length}`,
content: `${interaction.translate("common:PAGE")}: **${currentPage + 1}**/**${embeds.length}**`,
embeds: [embeds[currentPage]],
components: [row]
});
@ -107,7 +107,7 @@ class Servers extends BaseCommand {
if (embeds[collected.first().content - 1]) {
currentPage = collected.first().content - 1;
interaction.editReply({
content: `${interaction.translate("common:PAGE")}: **${currentPage + 1}**/${embeds.length}`,
content: `${interaction.translate("common:PAGE")}: **${currentPage + 1}**/**${embeds.length}**`,
embeds: [embeds[currentPage]],
components: [row]
});

View file

@ -36,8 +36,8 @@ class Ready extends BaseEvent {
checkReminds.init(client);
// Clear transactions
const clearTransactions = require("../helpers/clearTransactions");
clearTransactions.init(client);
const cleanup = require("../helpers/cleanup");
cleanup.init(client);
// Start the dashboard
if (client.config.dashboard.enabled) client.dashboard.init(client);

View file

@ -1,6 +1,10 @@
const table = require("markdown-table"),
fs = require("fs");
/**
*
* @param {import("../base/JaBa")} client
*/
module.exports.update = function (client) {
const commands = [...new Map(client.commands.map(v => [v.constructor.name, v])).values()],
categories = [];

View file

@ -1,6 +1,10 @@
const { CronJob } = require("cron"),
{ EmbedBuilder } = require("discord.js");
/**
*
* @param {import("../base/JaBa")} client
*/
module.exports.init = async function (client) {
new CronJob("0 5 * * *", async function () {
client.guilds.cache.forEach(async (guild) => {

View file

@ -1,5 +1,9 @@
const { EmbedBuilder } = require("discord.js");
/**
*
* @param {import("../base/JaBa")} client
*/
module.exports.init = function (client) {
client.usersData
.find({ reminds: { $gt: [] } })

View file

@ -1,5 +1,9 @@
const { EmbedBuilder } = require("discord.js");
/**
*
* @param {import("../base/JaBa")} client
*/
module.exports.init = async function (client) {
client.membersData
.find({ "mute.muted": true })

View file

@ -1,3 +1,7 @@
/**
*
* @param {import("../base/JaBa")} client
*/
module.exports.init = async function (client) {
setInterval(async () => {
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
/*
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
*/
};