mirror of
https://github.com/JonnyBro/JaBa.git
synced 2024-11-22 13:14:58 +05:00
v4.0
This commit is contained in:
parent
b258fbf6e6
commit
bcd9a04559
174 changed files with 2373 additions and 2153 deletions
|
@ -1,103 +0,0 @@
|
||||||
const Command = require("../../base/Command"),
|
|
||||||
Discord = require("discord.js");
|
|
||||||
|
|
||||||
class Achievements extends Command {
|
|
||||||
constructor(client) {
|
|
||||||
super(client, {
|
|
||||||
name: "achievements",
|
|
||||||
dirname: __dirname,
|
|
||||||
enabled: true,
|
|
||||||
guildOnly: false,
|
|
||||||
aliases: ["ac"],
|
|
||||||
memberPermissions: [],
|
|
||||||
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
|
|
||||||
nsfw: false,
|
|
||||||
ownerOnly: false,
|
|
||||||
cooldown: 1000
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
async run(message, args, data) {
|
|
||||||
let member = message.guild ? message.member : message.author;
|
|
||||||
if (args[0]) member = await this.client.resolveMember(args[0], message.guild);
|
|
||||||
if (message.guild && member.user.bot) return message.error("economy/profile:BOT_USER");
|
|
||||||
|
|
||||||
const userData = (member.id === message.author.id ? data.userData : await this.client.findOrCreateUser({
|
|
||||||
id: member.id
|
|
||||||
}));
|
|
||||||
|
|
||||||
const embed = new Discord.EmbedBuilder()
|
|
||||||
.setAuthor({
|
|
||||||
name: message.translate("economy/achievements:TITLE")
|
|
||||||
})
|
|
||||||
.setColor(data.config.embed.color)
|
|
||||||
.setFooter({
|
|
||||||
text: data.config.embed.footer
|
|
||||||
});
|
|
||||||
|
|
||||||
embed.addFields([
|
|
||||||
{
|
|
||||||
name: message.translate("economy/achievements:SEND_CMD"),
|
|
||||||
value: message.translate("economy/achievements:PROGRESS", {
|
|
||||||
now: userData.achievements.firstCommand.progress.now,
|
|
||||||
total: userData.achievements.firstCommand.progress.total,
|
|
||||||
percent: Math.round(100 * (userData.achievements.firstCommand.progress.now / userData.achievements.firstCommand.progress.total))
|
|
||||||
})
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: message.translate("economy/achievements:CLAIM_SALARY"),
|
|
||||||
value: message.translate("economy/achievements:PROGRESS", {
|
|
||||||
now: userData.achievements.work.progress.now,
|
|
||||||
total: userData.achievements.work.progress.total,
|
|
||||||
percent: Math.round(100 * (userData.achievements.work.progress.now / userData.achievements.work.progress.total))
|
|
||||||
})
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: message.translate("economy/achievements:MARRY"),
|
|
||||||
value: message.translate("economy/achievements:PROGRESS", {
|
|
||||||
now: userData.achievements.married.progress.now,
|
|
||||||
total: userData.achievements.married.progress.total,
|
|
||||||
percent: Math.round(100 * (userData.achievements.married.progress.now / userData.achievements.married.progress.total))
|
|
||||||
})
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: message.translate("economy/achievements:SLOTS"),
|
|
||||||
value: message.translate("economy/achievements:PROGRESS", {
|
|
||||||
now: userData.achievements.slots.progress.now,
|
|
||||||
total: userData.achievements.slots.progress.total,
|
|
||||||
percent: Math.round(100 * (userData.achievements.slots.progress.now / userData.achievements.slots.progress.total))
|
|
||||||
})
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: message.translate("economy/achievements:TIP"),
|
|
||||||
value: message.translate("economy/achievements:PROGRESS", {
|
|
||||||
now: userData.achievements.tip.progress.now,
|
|
||||||
total: userData.achievements.tip.progress.total,
|
|
||||||
percent: Math.round(100 * (userData.achievements.tip.progress.now / userData.achievements.tip.progress.total))
|
|
||||||
})
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: message.translate("economy/achievements:REP"),
|
|
||||||
value: message.translate("economy/achievements:PROGRESS", {
|
|
||||||
now: userData.achievements.rep.progress.now,
|
|
||||||
total: userData.achievements.rep.progress.total,
|
|
||||||
percent: Math.round(100 * (userData.achievements.rep.progress.now / userData.achievements.rep.progress.total))
|
|
||||||
})
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: message.translate("economy/achievements:INVITE"),
|
|
||||||
value: message.translate("economy/achievements:PROGRESS", {
|
|
||||||
now: userData.achievements.invite.progress.now,
|
|
||||||
total: userData.achievements.invite.progress.total,
|
|
||||||
percent: Math.round(100 * (userData.achievements.invite.progress.now / userData.achievements.invite.progress.total))
|
|
||||||
})
|
|
||||||
}
|
|
||||||
]);
|
|
||||||
|
|
||||||
message.reply({
|
|
||||||
embeds: [embed]
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = Achievements;
|
|
|
@ -1,50 +0,0 @@
|
||||||
const Command = require("../../base/Command");
|
|
||||||
|
|
||||||
class Birthdate extends Command {
|
|
||||||
constructor(client) {
|
|
||||||
super(client, {
|
|
||||||
name: "birthdate",
|
|
||||||
dirname: __dirname,
|
|
||||||
enabled: true,
|
|
||||||
guildOnly: false,
|
|
||||||
aliases: ["bd"],
|
|
||||||
memberPermissions: [],
|
|
||||||
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
|
|
||||||
nsfw: false,
|
|
||||||
ownerOnly: false,
|
|
||||||
cooldown: 1000
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
async run(message, args, data) {
|
|
||||||
const date = args[0];
|
|
||||||
if (!date) return message.error("economy/birthdate:MISSING_DATE");
|
|
||||||
|
|
||||||
const tArgs = date.split("/");
|
|
||||||
const [day, month, year] = tArgs;
|
|
||||||
if (!day || !month || !year) return message.error("economy/birthdate:INVALID_DATE");
|
|
||||||
|
|
||||||
const match = date.match(/\d+/g);
|
|
||||||
if (!match) return message.error("economy/birthdate:INVALID_DATE");
|
|
||||||
|
|
||||||
const tday = +match[0],
|
|
||||||
tmonth = +match[1] - 1;
|
|
||||||
let tyear = +match[2];
|
|
||||||
|
|
||||||
if (tyear < 100) tyear += tyear < 50 ? 2000 : 1900;
|
|
||||||
|
|
||||||
const d = new Date(tyear, tmonth, tday);
|
|
||||||
if (!(tday == d.getDate() && tmonth == d.getMonth() && tyear == d.getFullYear())) return message.error("economy/birthdate:INVALID_DATE");
|
|
||||||
if (d.getTime() > Date.now()) return message.error("economy/birthdate:DATE_TOO_HIGH");
|
|
||||||
if (d.getTime() < (Date.now() - 2.523e+12)) return message.error("economy/birthdate:DATE_TOO_LOW");
|
|
||||||
|
|
||||||
data.userData.birthdate = d;
|
|
||||||
data.userData.save();
|
|
||||||
|
|
||||||
message.success("economy/birthdate:SUCCESS", {
|
|
||||||
date: this.client.printDate(d)
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = Birthdate;
|
|
|
@ -1,52 +0,0 @@
|
||||||
const Command = require("../../base/Command");
|
|
||||||
|
|
||||||
class Deposit extends Command {
|
|
||||||
constructor(client) {
|
|
||||||
super(client, {
|
|
||||||
name: "deposit",
|
|
||||||
dirname: __dirname,
|
|
||||||
enabled: true,
|
|
||||||
guildOnly: true,
|
|
||||||
aliases: ["bank", "dep"],
|
|
||||||
memberPermissions: [],
|
|
||||||
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
|
|
||||||
nsfw: false,
|
|
||||||
ownerOnly: false,
|
|
||||||
cooldown: 1000
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
async run(message, args, data) {
|
|
||||||
let amount = args[0];
|
|
||||||
|
|
||||||
if (!(parseInt(data.memberData.money, 10) > 0)) return message.error("economy/deposit:NO_CREDIT");
|
|
||||||
|
|
||||||
if (args[0] === "all") {
|
|
||||||
amount = parseInt(data.memberData.money, 10);
|
|
||||||
} else {
|
|
||||||
if (isNaN(amount) || parseInt(amount, 10) < 1) return message.error("economy/deposit:MISSING_AMOUNT");
|
|
||||||
amount = parseInt(amount, 10);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (data.memberData.money < amount) return message.error("economy/deposit:NOT_ENOUGH_CREDIT", { money: `**${amount}** ${message.getNoun(amount, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}` });
|
|
||||||
|
|
||||||
const info = {
|
|
||||||
user: message.translate("economy/transactions:BANK"),
|
|
||||||
amount: amount,
|
|
||||||
date: Date.now(),
|
|
||||||
type: "send"
|
|
||||||
};
|
|
||||||
|
|
||||||
data.memberData.transactions.push(info);
|
|
||||||
|
|
||||||
data.memberData.money = data.memberData.money - amount;
|
|
||||||
data.memberData.bankSold = data.memberData.bankSold + amount;
|
|
||||||
data.memberData.save();
|
|
||||||
|
|
||||||
message.success("economy/deposit:SUCCESS", {
|
|
||||||
money: `**${amount}** ${message.getNoun(amount, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}`
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = Deposit;
|
|
|
@ -1,45 +0,0 @@
|
||||||
const Command = require("../../base/Command");
|
|
||||||
|
|
||||||
class Divorce extends Command {
|
|
||||||
constructor(client) {
|
|
||||||
super(client, {
|
|
||||||
name: "divorce",
|
|
||||||
dirname: __dirname,
|
|
||||||
enabled: true,
|
|
||||||
guildOnly: false,
|
|
||||||
aliases: ["di"],
|
|
||||||
memberPermissions: [],
|
|
||||||
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
|
|
||||||
nsfw: false,
|
|
||||||
ownerOnly: false,
|
|
||||||
cooldown: 2000
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
async run(message, args, data) {
|
|
||||||
if (!data.userData.lover) return message.error("economy/divorce:NOT_MARRIED");
|
|
||||||
|
|
||||||
const user = this.client.users.cache.get(data.userData.lover) || await this.client.users.fetch(data.userData.lover);
|
|
||||||
|
|
||||||
data.userData.lover = null;
|
|
||||||
data.userData.save();
|
|
||||||
|
|
||||||
const oldLover = await this.client.findOrCreateUser({
|
|
||||||
id: user.id
|
|
||||||
});
|
|
||||||
oldLover.lover = null;
|
|
||||||
oldLover.save();
|
|
||||||
|
|
||||||
message.success("economy/divorce:DIVORCED", {
|
|
||||||
username: user.username
|
|
||||||
});
|
|
||||||
|
|
||||||
user.send({
|
|
||||||
content: message.translate("economy/divorce:DIVORCED_U", {
|
|
||||||
username: message.author.username
|
|
||||||
})
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = Divorce;
|
|
|
@ -1,184 +0,0 @@
|
||||||
const Command = require("../../base/Command");
|
|
||||||
|
|
||||||
const games = {};
|
|
||||||
|
|
||||||
class Horserace extends Command {
|
|
||||||
constructor(client) {
|
|
||||||
super(client, {
|
|
||||||
name: "horserace",
|
|
||||||
dirname: __dirname,
|
|
||||||
enabled: true,
|
|
||||||
guildOnly: true,
|
|
||||||
aliases: ["hr"],
|
|
||||||
memberPermissions: [],
|
|
||||||
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
|
|
||||||
nsfw: false,
|
|
||||||
ownerOnly: false,
|
|
||||||
cooldown: 2000
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
async run(message, args, data) {
|
|
||||||
if (!args[0]) return message.error("economy/horserace:MISSING_STATUS");
|
|
||||||
const author = message.author;
|
|
||||||
|
|
||||||
if (args[0] === "create") {
|
|
||||||
let thisGame = games[message.channel.id];
|
|
||||||
|
|
||||||
if (thisGame) return message.error("economy/horserace:GAME_RUNNING");
|
|
||||||
else {
|
|
||||||
games[message.channel.id] = {
|
|
||||||
horseSpeeds: [],
|
|
||||||
bets: []
|
|
||||||
};
|
|
||||||
|
|
||||||
thisGame = games[message.channel.id];
|
|
||||||
|
|
||||||
const f = [];
|
|
||||||
for (let i = 0; i < 5; i++) {
|
|
||||||
const speed = this.client.functions.randomNum(1, 5);
|
|
||||||
const profit = {
|
|
||||||
1: 3.5,
|
|
||||||
2: 3,
|
|
||||||
3: 2.5,
|
|
||||||
4: 2,
|
|
||||||
5: 1.5,
|
|
||||||
};
|
|
||||||
// const profit = Math.floor((((8.9 / 9) * (6 - speed)) + 1.1) * 10) / 10;
|
|
||||||
thisGame.horseSpeeds.push(speed);
|
|
||||||
f.push({
|
|
||||||
name: message.translate("economy/horserace:HORSE_NAME", {
|
|
||||||
number: i + 1
|
|
||||||
}),
|
|
||||||
value: message.translate("economy/horserace:HORSE_VALUE", {
|
|
||||||
speed,
|
|
||||||
profit: profit[speed]
|
|
||||||
})
|
|
||||||
});
|
|
||||||
}
|
|
||||||
message.reply({
|
|
||||||
embeds: [{
|
|
||||||
color: data.config.embed.color,
|
|
||||||
title: message.translate("economy/horserace:EMBED_T"),
|
|
||||||
fields: f
|
|
||||||
}]
|
|
||||||
});
|
|
||||||
}
|
|
||||||
} else if (args[0] === "bet") {
|
|
||||||
const thisGame = games[message.channel.id];
|
|
||||||
const horse = parseInt(args[1]);
|
|
||||||
const amount = parseInt(args[2]);
|
|
||||||
|
|
||||||
if (horse > 5) return message.error("economy/horserace:HORSE_NUM");
|
|
||||||
if (!thisGame) return message.error("economy/horserace:NO_GAME_RUNNING");
|
|
||||||
|
|
||||||
if (!amount || isNaN(amount) || parseInt(amount, 10) <= 0) return message.error("economy/pay:INVALID_AMOUNT");
|
|
||||||
if (amount > data.memberData.money) return message.error("economy/pay:ENOUGH_MONEY", {
|
|
||||||
amount: `**${amount}** ${message.getNoun(amount, message.translate("misc:NOUNS:CREDITS:1"), message.translate("misc:NOUNS:CREDITS:2"), message.translate("misc:NOUNS:CREDITS:5"))}`
|
|
||||||
});
|
|
||||||
|
|
||||||
thisGame.bets[author.id] = {
|
|
||||||
amount,
|
|
||||||
horse
|
|
||||||
};
|
|
||||||
|
|
||||||
message.sendT("economy/horserace:BET", {
|
|
||||||
user: author,
|
|
||||||
amount: `**${Math.floor(amount)}** ${message.getNoun(Math.floor(amount), message.translate("misc:NOUNS:CREDITS:1"), message.translate("misc:NOUNS:CREDITS:2"), message.translate("misc:NOUNS:CREDITS:5"))}`,
|
|
||||||
horse
|
|
||||||
});
|
|
||||||
|
|
||||||
} else if (args[0] === "go") {
|
|
||||||
const thisGame = games[message.channel.id];
|
|
||||||
const horsePositions = [0, 0, 0, 0, 0];
|
|
||||||
|
|
||||||
if (!thisGame) return message.error("economy/horserace:NO_GAME_RUNNING");
|
|
||||||
|
|
||||||
// eslint-disable-next-line no-constant-condition
|
|
||||||
while (true) {
|
|
||||||
for (let i = 0; i < 5; i++) {
|
|
||||||
if (thisGame.horseSpeeds[i] >= Math.floor(Math.random() * 15)) {
|
|
||||||
horsePositions[i] += 1;
|
|
||||||
if (horsePositions[i] === 3) {
|
|
||||||
const winnings = [];
|
|
||||||
|
|
||||||
const profit = {
|
|
||||||
1: 3.5,
|
|
||||||
2: 3,
|
|
||||||
3: 2.5,
|
|
||||||
4: 2,
|
|
||||||
5: 1.5,
|
|
||||||
};
|
|
||||||
|
|
||||||
// const profit = Math.floor((((8.9 / 9) * (6 - thisGame.horseSpeeds[i])) + 1.1) * 10) / 10;
|
|
||||||
|
|
||||||
for (let j = 0; j < Object.keys(thisGame.bets).length; j++) {
|
|
||||||
if (Object.values(thisGame.bets)[j].horse === i + 1) {
|
|
||||||
winnings.push([Object.keys(thisGame.bets)[j], Object.values(thisGame.bets)[j].amount * profit[thisGame.horseSpeeds[i]]]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (winnings.length === 0) {
|
|
||||||
for (let j = 0; j < Object.keys(thisGame.bets).length; j++) {
|
|
||||||
if (Object.values(thisGame.bets)[j].horse !== i + 1) {
|
|
||||||
const memberData = await this.client.findOrCreateMember({
|
|
||||||
id: Object.keys(thisGame.bets)[j],
|
|
||||||
guildID: message.guild.id
|
|
||||||
});
|
|
||||||
|
|
||||||
const info = {
|
|
||||||
user: message.translate("economy/transactions:HORSERACE"),
|
|
||||||
amount: Object.values(thisGame.bets)[j].amount,
|
|
||||||
date: Date.now(),
|
|
||||||
type: "send"
|
|
||||||
};
|
|
||||||
|
|
||||||
memberData.transactions.push(info);
|
|
||||||
memberData.money -= Object.values(thisGame.bets)[j].amount;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
message.sendT("economy/horserace:NO_WINNERS", {
|
|
||||||
horse: i + 1
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
let winners = "";
|
|
||||||
for (let j = 0; j < winnings.length; j++) {
|
|
||||||
winners += `\n<@${winnings[j][0]}> выиграл **${Math.floor(winnings[j][1])}** ${message.getNoun(Math.floor(winnings[j][1]), message.translate("misc:NOUNS:CREDITS:1"), message.translate("misc:NOUNS:CREDITS:2"), message.translate("misc:NOUNS:CREDITS:5"))}!`;
|
|
||||||
|
|
||||||
const memberData = await this.client.findOrCreateMember({
|
|
||||||
id: winnings[j][0],
|
|
||||||
guildID: message.guild.id
|
|
||||||
});
|
|
||||||
|
|
||||||
const toAdd = Math.floor(winnings[j][1]) - Object.values(thisGame.bets)[j].amount;
|
|
||||||
|
|
||||||
const info = {
|
|
||||||
user: message.translate("economy/transactions:HORSERACE"),
|
|
||||||
amount: toAdd,
|
|
||||||
date: Date.now(),
|
|
||||||
type: "got"
|
|
||||||
};
|
|
||||||
|
|
||||||
memberData.transactions.push(info);
|
|
||||||
memberData.money += toAdd;
|
|
||||||
memberData.save();
|
|
||||||
}
|
|
||||||
|
|
||||||
message.sendT("economy/horserace:WINNERS", {
|
|
||||||
horse: i + 1,
|
|
||||||
winners
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
delete games[message.channel.id];
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = Horserace;
|
|
|
@ -1,29 +0,0 @@
|
||||||
const { getUserXp } = require("mee6-levels-api");
|
|
||||||
const Command = require("../../base/Command"),
|
|
||||||
Discord = require("discord.js");
|
|
||||||
|
|
||||||
class ImportMee6 extends Command {
|
|
||||||
constructor(client) {
|
|
||||||
super(client, {
|
|
||||||
name: "money",
|
|
||||||
dirname: __dirname,
|
|
||||||
enabled: true,
|
|
||||||
guildOnly: true,
|
|
||||||
aliases: [],
|
|
||||||
memberPermissions: [],
|
|
||||||
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
|
|
||||||
nsfw: false,
|
|
||||||
ownerOnly: false,
|
|
||||||
cooldown: 1000
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
async run(message, args, data) {
|
|
||||||
await getUserXp(message.guild.id, message.author.id).then(user => {
|
|
||||||
Levels.setLevel(message.author.id, message.guild.id, user.level);
|
|
||||||
message.lineReply(`Ваш уровень Mee6 синхронизирован! Новый уровень - ${user.level}`);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
module.exports = ImportMee6;
|
|
|
@ -1,168 +0,0 @@
|
||||||
const Command = require("../../base/Command"),
|
|
||||||
Discord = require("discord.js");
|
|
||||||
|
|
||||||
class Leaderboard extends Command {
|
|
||||||
constructor(client) {
|
|
||||||
super(client, {
|
|
||||||
name: "leaderboard",
|
|
||||||
dirname: __dirname,
|
|
||||||
enabled: true,
|
|
||||||
guildOnly: true,
|
|
||||||
aliases: ["lb"],
|
|
||||||
memberPermissions: [],
|
|
||||||
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
|
|
||||||
nsfw: false,
|
|
||||||
ownerOnly: false,
|
|
||||||
cooldown: 2000
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
async run(message, args, data) {
|
|
||||||
const isOnMobile = (message.member.presence.clientStatus ? JSON.stringify(Object.keys(message.member.presence.clientStatus)) === JSON.stringify(["mobile"]) : false);
|
|
||||||
|
|
||||||
const type = args[0];
|
|
||||||
if (!type || !["credits", "level", "rep"].includes(type)) return message.error("economy/leaderboard:MISSING_TYPE");
|
|
||||||
|
|
||||||
if (type === "credits") {
|
|
||||||
const members = await this.client.membersData.find({
|
|
||||||
guildID: message.guild.id
|
|
||||||
}).lean(),
|
|
||||||
membersLeaderboard = members.map((m) => {
|
|
||||||
return {
|
|
||||||
id: m.id,
|
|
||||||
money: m.money + m.bankSold
|
|
||||||
};
|
|
||||||
}).sort((a, b) => b.money - a.money);
|
|
||||||
if (membersLeaderboard.length > 20) membersLeaderboard.length = 20;
|
|
||||||
|
|
||||||
let userNames = "";
|
|
||||||
let money = "";
|
|
||||||
for (let i = 0; i < membersLeaderboard.length; i++) {
|
|
||||||
const data = membersLeaderboard[i];
|
|
||||||
const user = (await this.client.users.fetch(data.id)).tag;
|
|
||||||
|
|
||||||
userNames += `**${i + 1}**. ${user}\n`;
|
|
||||||
money += `${data.money}\n`;
|
|
||||||
}
|
|
||||||
|
|
||||||
const embed = new Discord.EmbedBuilder()
|
|
||||||
.setAuthor({
|
|
||||||
name: message.translate("economy/leaderboard:TABLE", {
|
|
||||||
name: message.guild.name
|
|
||||||
}),
|
|
||||||
iconURL: message.guild.iconURL()
|
|
||||||
})
|
|
||||||
.setColor(data.config.embed.color)
|
|
||||||
.addFields({
|
|
||||||
name: message.translate("economy/leaderboard:TOP"),
|
|
||||||
value: userNames,
|
|
||||||
inline: true
|
|
||||||
}, {
|
|
||||||
name: message.translate("common:CREDITS"),
|
|
||||||
value: money,
|
|
||||||
inline: true
|
|
||||||
});
|
|
||||||
|
|
||||||
message.reply({
|
|
||||||
embeds: [embed]
|
|
||||||
});
|
|
||||||
} else if (type === "level") {
|
|
||||||
const members = await this.client.membersData.find({
|
|
||||||
guildID: message.guild.id
|
|
||||||
}).lean(),
|
|
||||||
membersLeaderboard = members.map((m) => {
|
|
||||||
return {
|
|
||||||
id: m.id,
|
|
||||||
level: m.level,
|
|
||||||
xp: m.exp
|
|
||||||
};
|
|
||||||
}).sort((a, b) => b.level - a.level);
|
|
||||||
if (membersLeaderboard.length > 20) membersLeaderboard.length = 20;
|
|
||||||
|
|
||||||
let userNames = "";
|
|
||||||
let level = "";
|
|
||||||
let xp = "";
|
|
||||||
for (let i = 0; i < membersLeaderboard.length; i++) {
|
|
||||||
const data = membersLeaderboard[i];
|
|
||||||
const user = (await this.client.users.fetch(data.id)).tag;
|
|
||||||
|
|
||||||
userNames += `**${i + 1}**. ${user}\n`;
|
|
||||||
level += `${data.level}\n`;
|
|
||||||
xp += `${data.xp} / ${5 * (data.level * data.level) + 80 * data.level + 100}\n`;
|
|
||||||
}
|
|
||||||
|
|
||||||
const embed = new Discord.EmbedBuilder()
|
|
||||||
.setAuthor({
|
|
||||||
name: message.translate("economy/leaderboard:TABLE", {
|
|
||||||
name: message.guild.name
|
|
||||||
}),
|
|
||||||
iconURL: message.guild.iconURL()
|
|
||||||
})
|
|
||||||
.setColor(data.config.embed.color)
|
|
||||||
.addFields({
|
|
||||||
name: message.translate("economy/leaderboard:TOP"),
|
|
||||||
value: userNames,
|
|
||||||
inline: true
|
|
||||||
}, {
|
|
||||||
name: message.translate("common:LEVEL"),
|
|
||||||
value: level,
|
|
||||||
inline: true
|
|
||||||
}, {
|
|
||||||
name: message.translate("common:XP"),
|
|
||||||
value: xp,
|
|
||||||
inline: true
|
|
||||||
});
|
|
||||||
|
|
||||||
message.reply({
|
|
||||||
embeds: [embed]
|
|
||||||
});
|
|
||||||
} else if (type === "rep") {
|
|
||||||
const users = await this.client.usersData.find({
|
|
||||||
rep: { $gt: 0 }
|
|
||||||
}).lean(),
|
|
||||||
usersLeaderboard = users.map((u) => {
|
|
||||||
return {
|
|
||||||
id: u.id,
|
|
||||||
rep: u.rep
|
|
||||||
};
|
|
||||||
}).sort((a, b) => b.rep - a.rep);
|
|
||||||
if (usersLeaderboard.length > 20) usersLeaderboard.length = 20;
|
|
||||||
|
|
||||||
let userNames = "";
|
|
||||||
let rep = "";
|
|
||||||
for (let i = 0; i < usersLeaderboard.length; i++) {
|
|
||||||
const data = usersLeaderboard[i];
|
|
||||||
const user = (await this.client.users.fetch(data.id)).tag;
|
|
||||||
|
|
||||||
userNames += `**${i + 1}**. ${user}\n`;
|
|
||||||
rep += `${data.rep}\n`;
|
|
||||||
}
|
|
||||||
|
|
||||||
const embed = new Discord.EmbedBuilder()
|
|
||||||
.setAuthor({
|
|
||||||
name: message.translate("economy/leaderboard:TABLE", {
|
|
||||||
name: message.guild.name
|
|
||||||
}),
|
|
||||||
iconURL: message.guild.iconURL()
|
|
||||||
})
|
|
||||||
.setColor(data.config.embed.color)
|
|
||||||
.addFields({
|
|
||||||
name: message.translate("economy/leaderboard:TOP"),
|
|
||||||
value: userNames,
|
|
||||||
inline: true
|
|
||||||
}, {
|
|
||||||
name: message.translate("common:REP"),
|
|
||||||
value: rep,
|
|
||||||
inline: true
|
|
||||||
});
|
|
||||||
|
|
||||||
message.reply({
|
|
||||||
embeds: [embed]
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isOnMobile) message.sendT("economy/leaderboard:MOBILE");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = Leaderboard;
|
|
|
@ -1,134 +0,0 @@
|
||||||
const Command = require("../../base/Command"),
|
|
||||||
Discord = require("discord.js");
|
|
||||||
|
|
||||||
const pendings = {};
|
|
||||||
|
|
||||||
class Marry extends Command {
|
|
||||||
constructor(client) {
|
|
||||||
super(client, {
|
|
||||||
name: "marry",
|
|
||||||
dirname: __dirname,
|
|
||||||
enabled: true,
|
|
||||||
guildOnly: true,
|
|
||||||
aliases: [],
|
|
||||||
memberPermissions: [],
|
|
||||||
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
|
|
||||||
nsfw: false,
|
|
||||||
ownerOnly: false,
|
|
||||||
cooldown: 2000
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
async run(message, args, data) {
|
|
||||||
if (data.userData.lover) return message.error("economy/marry:ALREADY_MARRIED", { prefix: data.guildData.prefix });
|
|
||||||
|
|
||||||
const member = await this.client.resolveMember(args[0], message.guild);
|
|
||||||
if (!member) return message.error("economy/marry:INVALID_MEMBER");
|
|
||||||
|
|
||||||
const userData = await this.client.findOrCreateUser({
|
|
||||||
id: member.id
|
|
||||||
});
|
|
||||||
|
|
||||||
if (userData.lover) return message.error("economy/marry:ALREADY_MARRIED_USER", { username: member.user.tag });
|
|
||||||
if (member.user.bot) return message.error("economy/marry:BOT_USER");
|
|
||||||
if (member.id === message.author.id) return message.error("economy/marry:YOURSELF");
|
|
||||||
|
|
||||||
for (const requester in pendings) {
|
|
||||||
const receiver = pendings[requester];
|
|
||||||
// If the member already sent a request to someone
|
|
||||||
if (requester === message.author.id) {
|
|
||||||
const user = this.client.users.cache.get(receiver) || await this.client.users.fetch(receiver);
|
|
||||||
return message.error("economy/marry:REQUEST_AUTHOR_TO_AMEMBER", {
|
|
||||||
username: user.tag
|
|
||||||
});
|
|
||||||
} else if (receiver === message.author.id) { // If there is a pending request for this member
|
|
||||||
const user = this.client.users.cache.get(requester) || await this.client.users.fetch(requester);
|
|
||||||
return message.error("economy/marry:REQUEST_AMEMBER_TO_AUTHOR", {
|
|
||||||
username: user.tag
|
|
||||||
});
|
|
||||||
} else if (requester === member.id) { // If the asked member has sent pending request
|
|
||||||
const user = this.client.users.cache.get(receiver) || await this.client.users.fetch(receiver);
|
|
||||||
return message.error("economy/marry:REQUEST_AMEMBER_TO_MEMBER", {
|
|
||||||
firstUsername: member.user.tag,
|
|
||||||
secondUsername: user.tag
|
|
||||||
});
|
|
||||||
} else if (receiver === member.id) { // If there is a pending request for the asked member
|
|
||||||
const user = this.client.users.cache.get(requester) || await this.client.users.fetch(requester);
|
|
||||||
return message.error("economy/marry:REQUEST_MEMBER_TO_AMEMBER", {
|
|
||||||
firstUsername: member.user.tag,
|
|
||||||
secondUsername: user.tag
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update pending requests
|
|
||||||
pendings[message.author.id] = member.id;
|
|
||||||
|
|
||||||
message.sendT("economy/marry:REQUEST", {
|
|
||||||
from: message.author.toString(),
|
|
||||||
to: member.user.toString()
|
|
||||||
});
|
|
||||||
|
|
||||||
const filter = m => m.author.id === member.id;
|
|
||||||
const collector = new Discord.MessageCollector(message.channel, {
|
|
||||||
filter,
|
|
||||||
time: 120000
|
|
||||||
});
|
|
||||||
|
|
||||||
collector.on("collect", (msg) => {
|
|
||||||
if (msg.content.toLowerCase() === message.translate("common:YES").toLowerCase()) {
|
|
||||||
return collector.stop(true);
|
|
||||||
} else if (msg.content.toLowerCase() === message.translate("common:NO").toLowerCase()) {
|
|
||||||
return collector.stop(false);
|
|
||||||
} else {
|
|
||||||
return message.error("misc:INVALID_YES_NO");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
collector.on("end", async (_collected, reason) => {
|
|
||||||
// Delete pending request
|
|
||||||
delete pendings[message.author.id];
|
|
||||||
if (reason === "time") return message.error("economy/marry:TIMEOUT", { username: member.user.toString() });
|
|
||||||
if (reason) {
|
|
||||||
data.userData.lover = member.id;
|
|
||||||
await data.userData.save();
|
|
||||||
userData.lover = message.author.id;
|
|
||||||
await userData.save();
|
|
||||||
const messageOptions = {
|
|
||||||
content: `${member.toString()} :heart: ${message.author.toString()}`,
|
|
||||||
files: [{
|
|
||||||
name: "achievement_unlocked3.png",
|
|
||||||
attachment: "./assets/img/achievements/achievement_unlocked3.png"
|
|
||||||
}]
|
|
||||||
};
|
|
||||||
let sent = false;
|
|
||||||
if (!userData.achievements.married.achieved) {
|
|
||||||
message.channel.send(messageOptions);
|
|
||||||
sent = true;
|
|
||||||
userData.achievements.married.achieved = true;
|
|
||||||
userData.achievements.married.progress.now = 1;
|
|
||||||
userData.markModified("achievements.married");
|
|
||||||
userData.save();
|
|
||||||
}
|
|
||||||
if (!data.userData.achievements.married.achieved) {
|
|
||||||
if (!sent) message.channel.send(messageOptions);
|
|
||||||
data.userData.achievements.married.achieved = true;
|
|
||||||
data.userData.achievements.married.progress.now = 1;
|
|
||||||
data.userData.markModified("achievements.married");
|
|
||||||
data.userData.save();
|
|
||||||
}
|
|
||||||
return message.success("economy/marry:SUCCESS", {
|
|
||||||
creator: message.author.toString(),
|
|
||||||
partner: member.user.toString()
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
return message.success("economy/marry:DENIED", {
|
|
||||||
creator: message.author.toString(),
|
|
||||||
partner: member.user.toString()
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = Marry;
|
|
|
@ -1,88 +0,0 @@
|
||||||
const Command = require("../../base/Command"),
|
|
||||||
Discord = require("discord.js");
|
|
||||||
|
|
||||||
const asyncForEach = async (collection, callback) => {
|
|
||||||
const allPromises = collection.map(async key => {
|
|
||||||
await callback(key);
|
|
||||||
});
|
|
||||||
|
|
||||||
return await Promise.all(allPromises);
|
|
||||||
};
|
|
||||||
|
|
||||||
class Money extends Command {
|
|
||||||
constructor(client) {
|
|
||||||
super(client, {
|
|
||||||
name: "money",
|
|
||||||
dirname: __dirname,
|
|
||||||
enabled: true,
|
|
||||||
guildOnly: true,
|
|
||||||
aliases: ["balance", "mon"],
|
|
||||||
memberPermissions: [],
|
|
||||||
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
|
|
||||||
nsfw: false,
|
|
||||||
ownerOnly: false,
|
|
||||||
cooldown: 1000
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
async run(message, args, data) {
|
|
||||||
let member = await this.client.resolveMember(args[0], message.guild);
|
|
||||||
if (!member) member = message.member;
|
|
||||||
const user = member.user;
|
|
||||||
|
|
||||||
if (user.bot) return message.error("misc:BOT_USER");
|
|
||||||
|
|
||||||
const memberData = (message.author === user) ? data.memberData : await this.client.findOrCreateMember({
|
|
||||||
id: user.id,
|
|
||||||
guildID: message.guild.id
|
|
||||||
});
|
|
||||||
|
|
||||||
const commonsGuilds = this.client.guilds.cache.filter((g) => g.members.cache.get(user.id));
|
|
||||||
let globalMoney = 0;
|
|
||||||
await asyncForEach(commonsGuilds, async (guild) => {
|
|
||||||
const data = await this.client.findOrCreateMember({
|
|
||||||
id: user.id,
|
|
||||||
guildID: guild.id
|
|
||||||
});
|
|
||||||
globalMoney += data.money;
|
|
||||||
globalMoney += data.bankSold;
|
|
||||||
});
|
|
||||||
|
|
||||||
const embed = new Discord.EmbedBuilder()
|
|
||||||
.setAuthor({
|
|
||||||
name: message.translate("economy/money:TITLE", {
|
|
||||||
username: member.user.username
|
|
||||||
}),
|
|
||||||
iconURL: member.user.displayAvatarURL({
|
|
||||||
extension: "png",
|
|
||||||
size: 512
|
|
||||||
})
|
|
||||||
})
|
|
||||||
.addFields([
|
|
||||||
{
|
|
||||||
name: message.translate("economy/profile:CASH"),
|
|
||||||
value: `**${memberData.money}** ${message.getNoun(memberData.money, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}`,
|
|
||||||
inline: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: message.translate("economy/profile:BANK"),
|
|
||||||
value: `**${memberData.bankSold}** ${message.getNoun(memberData.bankSold, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}`,
|
|
||||||
inline: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: message.translate("economy/profile:GLOBAL"),
|
|
||||||
value: `**${globalMoney}** ${message.getNoun(globalMoney, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}`,
|
|
||||||
inline: true
|
|
||||||
}
|
|
||||||
])
|
|
||||||
.setColor(data.config.embed.color)
|
|
||||||
.setFooter({
|
|
||||||
text: data.config.embed.footer
|
|
||||||
});
|
|
||||||
message.reply({
|
|
||||||
embeds: [embed]
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = Money;
|
|
|
@ -1,97 +0,0 @@
|
||||||
const Command = require("../../base/Command"),
|
|
||||||
Discord = require("discord.js");
|
|
||||||
|
|
||||||
const currentGames = {};
|
|
||||||
|
|
||||||
class Number extends Command {
|
|
||||||
constructor(client) {
|
|
||||||
super(client, {
|
|
||||||
name: "number",
|
|
||||||
dirname: __dirname,
|
|
||||||
enabled: true,
|
|
||||||
guildOnly: true,
|
|
||||||
aliases: ["num"],
|
|
||||||
memberPermissions: [],
|
|
||||||
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
|
|
||||||
nsfw: false,
|
|
||||||
ownerOnly: false,
|
|
||||||
cooldown: 2000
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
async run(message, args, data) {
|
|
||||||
if (currentGames[message.guild.id]) return message.error("economy/number:GAME_RUNNING");
|
|
||||||
|
|
||||||
const participants = [],
|
|
||||||
number = this.client.functions.randomNum(1000, 6000);
|
|
||||||
|
|
||||||
await message.sendT("economy/number:GAME_START");
|
|
||||||
|
|
||||||
// Store the date wich the game has started
|
|
||||||
const gameCreatedAt = Date.now();
|
|
||||||
|
|
||||||
const filter = m => !m.author.bot;
|
|
||||||
const collector = new Discord.MessageCollector(message.channel, {
|
|
||||||
filter,
|
|
||||||
time: 480000 // 8 minutes
|
|
||||||
});
|
|
||||||
currentGames[message.guild.id] = true;
|
|
||||||
|
|
||||||
collector.on("collect", async msg => {
|
|
||||||
if (!participants.includes(msg.author.id)) participants.push(msg.author.id);
|
|
||||||
if (msg.content === "STOP") return collector.stop("force");
|
|
||||||
if (isNaN(msg.content)) return;
|
|
||||||
|
|
||||||
const parsedNumber = parseInt(msg.content, 10);
|
|
||||||
|
|
||||||
if (parsedNumber === number) {
|
|
||||||
const time = this.client.convertTime(message.guild, Date.now() - gameCreatedAt);
|
|
||||||
message.sendT("economy/number:GAME_STATS", {
|
|
||||||
winner: msg.author.toString(),
|
|
||||||
number,
|
|
||||||
time,
|
|
||||||
participantCount: participants.length,
|
|
||||||
participants: participants.map(p => `<@${p}>`).join(", ")
|
|
||||||
});
|
|
||||||
|
|
||||||
if (participants.length > 1 && data.guildData.disabledCategories && !data.guildData.disabledCategories.includes("Economy")) {
|
|
||||||
const won = 100 * (participants.length * 0.5);
|
|
||||||
|
|
||||||
message.sendT("economy/number:WON", {
|
|
||||||
winner: msg.author.username,
|
|
||||||
credits: `**${won}** ${message.getNoun(won, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}`
|
|
||||||
});
|
|
||||||
|
|
||||||
const memberData = await this.client.findOrCreateMember({
|
|
||||||
id: msg.author.id,
|
|
||||||
guildID: message.guild.id
|
|
||||||
});
|
|
||||||
|
|
||||||
const info = {
|
|
||||||
user: message.translate("economy/transactions:NUMBERS"),
|
|
||||||
amount: won,
|
|
||||||
date: Date.now(),
|
|
||||||
type: "got"
|
|
||||||
};
|
|
||||||
|
|
||||||
data.memberData.transactions.push(info);
|
|
||||||
|
|
||||||
memberData.money += won;
|
|
||||||
memberData.save();
|
|
||||||
}
|
|
||||||
|
|
||||||
collector.stop();
|
|
||||||
}
|
|
||||||
if (parseInt(msg.content) < number) message.error("economy/number:BIG", { user: msg.author.toString(), number: parsedNumber });
|
|
||||||
if (parseInt(msg.content) > number) message.error("economy/number:SMALL", { user: msg.author.toString(), number: parsedNumber });
|
|
||||||
});
|
|
||||||
|
|
||||||
collector.on("end", (_collected, reason) => {
|
|
||||||
delete currentGames[message.guild.id];
|
|
||||||
if (reason === "time") return message.error("economy/number:DEFEAT", { number });
|
|
||||||
else if (reason === "force") return message.error("misc:FORCE_STOP", { user: message.author.toString() });
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = Number;
|
|
|
@ -1,59 +0,0 @@
|
||||||
const Command = require("../../base/Command");
|
|
||||||
|
|
||||||
class Pay extends Command {
|
|
||||||
constructor(client) {
|
|
||||||
super(client, {
|
|
||||||
name: "pay",
|
|
||||||
dirname: __dirname,
|
|
||||||
enabled: true,
|
|
||||||
guildOnly: true,
|
|
||||||
aliases: [],
|
|
||||||
memberPermissions: [],
|
|
||||||
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
|
|
||||||
nsfw: false,
|
|
||||||
ownerOnly: false,
|
|
||||||
cooldown: 2000
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
async run(message, args, data) {
|
|
||||||
const member = await this.client.resolveMember(args[0], message.guild);
|
|
||||||
if (!member) return message.error("economy/pay:INVALID_MEMBER");
|
|
||||||
if (member.user.bot) return message.error("economy/pay:BOT_USER");
|
|
||||||
if (member.id === message.author.id) return message.error("economy/pay:YOURSELF");
|
|
||||||
|
|
||||||
const sentAmount = args[1];
|
|
||||||
if (!sentAmount || isNaN(sentAmount) || parseInt(sentAmount, 10) <= 0) return message.error("economy/pay:INVALID_AMOUNT");
|
|
||||||
|
|
||||||
const amount = Math.ceil(parseInt(sentAmount, 10));
|
|
||||||
if (amount > data.memberData.money) return message.error("economy/pay:ENOUGH_MONEY", {
|
|
||||||
amount: `**${amount}** ${message.getNoun(amount, message.translate("misc:NOUNS:CREDITS:1"), message.translate("misc:NOUNS:CREDITS:2"), message.translate("misc:NOUNS:CREDITS:5"))}`
|
|
||||||
});
|
|
||||||
|
|
||||||
const memberData = await this.client.findOrCreateMember({
|
|
||||||
id: member.id,
|
|
||||||
guildID: message.guild.id
|
|
||||||
});
|
|
||||||
|
|
||||||
const info = {
|
|
||||||
user: member.user.tag,
|
|
||||||
amount: parseInt(amount, 10),
|
|
||||||
date: Date.now(),
|
|
||||||
type: "send"
|
|
||||||
};
|
|
||||||
|
|
||||||
data.memberData.transactions.push(info);
|
|
||||||
data.memberData.money = data.memberData.money - parseInt(amount, 10);
|
|
||||||
data.memberData.save();
|
|
||||||
|
|
||||||
memberData.money = memberData.money + parseInt(amount, 10);
|
|
||||||
memberData.save();
|
|
||||||
|
|
||||||
message.success("economy/pay:SUCCESS", {
|
|
||||||
amount: `**${amount}** ${message.getNoun(amount, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}`,
|
|
||||||
username: member.user.tag
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = Pay;
|
|
|
@ -1,144 +0,0 @@
|
||||||
const Command = require("../../base/Command"),
|
|
||||||
Discord = require("discord.js");
|
|
||||||
|
|
||||||
const asyncForEach = async (collection, callback) => {
|
|
||||||
const allPromises = collection.map(async key => {
|
|
||||||
await callback(key);
|
|
||||||
});
|
|
||||||
|
|
||||||
return await Promise.all(allPromises);
|
|
||||||
};
|
|
||||||
|
|
||||||
class Profile extends Command {
|
|
||||||
constructor(client) {
|
|
||||||
super(client, {
|
|
||||||
name: "profile",
|
|
||||||
dirname: __dirname,
|
|
||||||
enabled: true,
|
|
||||||
guildOnly: true,
|
|
||||||
aliases: ["prof"],
|
|
||||||
memberPermissions: [],
|
|
||||||
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
|
|
||||||
nsfw: false,
|
|
||||||
ownerOnly: false,
|
|
||||||
cooldown: 1000
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
async run(message, args, data) {
|
|
||||||
const arg = args[0] || message.author;
|
|
||||||
let member = await this.client.resolveMember(arg, message.guild);
|
|
||||||
if (!member) member = message.member;
|
|
||||||
if (member.user.bot) return message.error("economy/profile:BOT_USER");
|
|
||||||
|
|
||||||
const memberData = (member.id === message.author.id ? data.memberData : await this.client.findOrCreateMember({
|
|
||||||
id: member.id,
|
|
||||||
guildID: message.guild.id
|
|
||||||
}));
|
|
||||||
const userData = (member.id === message.author.id ? data.userData : await this.client.findOrCreateUser({
|
|
||||||
id: member.id
|
|
||||||
}));
|
|
||||||
if (userData.lover && !this.client.users.cache.get(userData.lover)) await this.client.users.fetch(userData.lover, true);
|
|
||||||
|
|
||||||
const commonsGuilds = this.client.guilds.cache.filter((g) => g.members.cache.get(member.id));
|
|
||||||
let globalMoney = 0;
|
|
||||||
await asyncForEach(commonsGuilds, async (guild) => {
|
|
||||||
const data = await this.client.findOrCreateMember({
|
|
||||||
id: member.id,
|
|
||||||
guildID: guild.id
|
|
||||||
});
|
|
||||||
globalMoney += data.money;
|
|
||||||
globalMoney += data.bankSold;
|
|
||||||
});
|
|
||||||
|
|
||||||
const profileEmbed = new Discord.EmbedBuilder()
|
|
||||||
.setAuthor({
|
|
||||||
name: message.translate("economy/profile:TITLE", {
|
|
||||||
username: member.user.tag
|
|
||||||
}),
|
|
||||||
iconURL: member.user.displayAvatarURL({
|
|
||||||
extension: "png",
|
|
||||||
size: 512
|
|
||||||
})
|
|
||||||
})
|
|
||||||
.setImage("attachment://achievements.png")
|
|
||||||
.addFields([
|
|
||||||
{
|
|
||||||
name: this.client.customEmojis.link + " " + message.translate("economy/profile:LINK"),
|
|
||||||
value: `[${message.translate("economy/profile:LINK_TEXT")}](${this.client.config.dashboard.baseURL}/user/${member.user.id}/${message.guild.id})`
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: message.translate("economy/profile:BIO"),
|
|
||||||
value: userData.bio ? userData.bio : message.translate("economy/profile:NO_BIO")
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: message.translate("economy/profile:CASH"),
|
|
||||||
value: `**${memberData.money}** ${message.getNoun(memberData.money, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}`,
|
|
||||||
inline: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: message.translate("economy/profile:BANK"),
|
|
||||||
value: `**${memberData.bankSold}** ${message.getNoun(memberData.bankSold, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}`,
|
|
||||||
inline: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: message.translate("economy/profile:GLOBAL"),
|
|
||||||
value: `**${globalMoney}** ${message.getNoun(globalMoney, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}`,
|
|
||||||
inline: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: message.translate("economy/profile:REPUTATION"),
|
|
||||||
value: `**${userData.rep}** ${message.getNoun(userData.rep, message.translate("misc:NOUNS:POINTS:1"), message.translate("misc:NOUNS:POINTS:2"), message.translate("misc:NOUNS:POINTS:5"))}`,
|
|
||||||
inline: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: message.translate("economy/profile:LEVEL"),
|
|
||||||
value:`**${memberData.level}**`,
|
|
||||||
inline: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: message.translate("economy/profile:EXP"),
|
|
||||||
value: `**${memberData.exp}/${5 * (memberData.level * memberData.level) + 80 * memberData.level + 100}** xp`,
|
|
||||||
inline: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: message.translate("economy/profile:REGISTERED"),
|
|
||||||
value: this.client.printDate(new Date(memberData.registeredAt)),
|
|
||||||
inline: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: message.translate("economy/profile:BIRTHDATE"),
|
|
||||||
value: (!userData.birthdate ? message.translate("economy/profile:NO_BIRTHDATE") : this.client.printDate(new Date(userData.birthdate))),
|
|
||||||
inline: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: message.translate("economy/profile:LOVER"),
|
|
||||||
value: (!userData.lover ? message.translate("economy/profile:NO_LOVER") : this.client.users.cache.get(userData.lover).tag),
|
|
||||||
inline: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: message.translate("economy/profile:ACHIEVEMENTS"),
|
|
||||||
value: message.translate("economy/profile:ACHIEVEMENTS_CONTENT", {
|
|
||||||
prefix: data.guildData.prefix
|
|
||||||
})
|
|
||||||
}
|
|
||||||
])
|
|
||||||
.setColor(data.config.embed.color) // Sets the color of the embed
|
|
||||||
.setFooter({
|
|
||||||
text: data.config.embed.footer
|
|
||||||
}) // Sets the footer of the embed
|
|
||||||
.setTimestamp();
|
|
||||||
|
|
||||||
const buffer = await userData.getAchievements();
|
|
||||||
|
|
||||||
message.reply({
|
|
||||||
embeds: [profileEmbed],
|
|
||||||
files: [{
|
|
||||||
name: "achievements.png",
|
|
||||||
attachment: buffer
|
|
||||||
}]
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = Profile;
|
|
|
@ -1,71 +0,0 @@
|
||||||
const Command = require("../../base/Command");
|
|
||||||
|
|
||||||
class Rep extends Command {
|
|
||||||
constructor(client) {
|
|
||||||
super(client, {
|
|
||||||
name: "rep",
|
|
||||||
dirname: __dirname,
|
|
||||||
enabled: true,
|
|
||||||
guildOnly: true,
|
|
||||||
aliases: ["reputation"],
|
|
||||||
memberPermissions: [],
|
|
||||||
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
|
|
||||||
nsfw: false,
|
|
||||||
ownerOnly: false,
|
|
||||||
cooldown: 1000
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
async run(message, args, data) {
|
|
||||||
// if the member is already in the cooldown db
|
|
||||||
const isInCooldown = (data.userData.cooldowns || {
|
|
||||||
rep: 0
|
|
||||||
}).rep;
|
|
||||||
if (isInCooldown) {
|
|
||||||
/*if the timestamp recorded in the database indicating
|
|
||||||
when the member will be able to execute the order again
|
|
||||||
is greater than the current date, display an error message */
|
|
||||||
if (isInCooldown > Date.now()) return message.error("economy/rep:COOLDOWN", {
|
|
||||||
time: this.client.convertTime(isInCooldown, "to", true)
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
const user = await this.client.resolveUser(args[0]);
|
|
||||||
if (!user) return message.error("economy/rep:INVALID_USER");
|
|
||||||
if (user.bot) return message.error("economy/rep:BOT_USER");
|
|
||||||
if (user.id === message.author.id) return message.error("economy/rep:YOURSELF");
|
|
||||||
|
|
||||||
// Records in the database the time when the member will be able to execute the command again (in 12 hours)
|
|
||||||
const toWait = Date.now() + 21600000;
|
|
||||||
data.userData.cooldowns = {};
|
|
||||||
data.userData.cooldowns.rep = toWait;
|
|
||||||
data.userData.markModified("cooldowns");
|
|
||||||
data.userData.save();
|
|
||||||
|
|
||||||
const userData = await this.client.findOrCreateUser({
|
|
||||||
id: user.id
|
|
||||||
});
|
|
||||||
userData.rep++;
|
|
||||||
if (!userData.achievements.rep.achieved) {
|
|
||||||
userData.achievements.rep.progress.now = (userData.rep > userData.achievements.rep.progress.total ? userData.achievements.rep.progress.total : userData.rep);
|
|
||||||
if (userData.achievements.rep.progress.now >= userData.achievements.rep.progress.total) {
|
|
||||||
userData.achievements.rep.achieved = true;
|
|
||||||
message.channel.send({
|
|
||||||
content: `${user}`,
|
|
||||||
files: [{
|
|
||||||
name: "achievement_unlocked6.png",
|
|
||||||
attachment: "./assets/img/achievements/achievement_unlocked6.png"
|
|
||||||
}]
|
|
||||||
});
|
|
||||||
}
|
|
||||||
userData.markModified("achievements.rep");
|
|
||||||
}
|
|
||||||
await userData.save();
|
|
||||||
|
|
||||||
message.success("economy/rep:SUCCESS", {
|
|
||||||
username: user.username
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = Rep;
|
|
|
@ -1,78 +0,0 @@
|
||||||
const Command = require("../../base/Command");
|
|
||||||
|
|
||||||
class Rob extends Command {
|
|
||||||
constructor(client) {
|
|
||||||
super(client, {
|
|
||||||
name: "rob",
|
|
||||||
dirname: __dirname,
|
|
||||||
enabled: true,
|
|
||||||
guildOnly: true,
|
|
||||||
aliases: ["steal"],
|
|
||||||
memberPermissions: [],
|
|
||||||
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
|
|
||||||
nsfw: false,
|
|
||||||
ownerOnly: false,
|
|
||||||
cooldown: 2000
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
async run(message, args, data) {
|
|
||||||
const member = await this.client.resolveMember(args[0], message.guild);
|
|
||||||
if (!member) return message.error("economy/rob:MISSING_MEMBER");
|
|
||||||
if (member.id === message.author.id) return message.error("economy/rob:YOURSELF");
|
|
||||||
|
|
||||||
const memberData = await this.client.findOrCreateMember({
|
|
||||||
id: member.id,
|
|
||||||
guildID: message.guild.id
|
|
||||||
});
|
|
||||||
const isInCooldown = memberData.cooldowns.rob || 0;
|
|
||||||
if (isInCooldown) {
|
|
||||||
if (isInCooldown > Date.now()) return message.error("economy/rob:COOLDOWN", { user: member.user });
|
|
||||||
}
|
|
||||||
|
|
||||||
let amountToRob = args[1];
|
|
||||||
if (!amountToRob || isNaN(amountToRob) || parseInt(amountToRob, 10) <= 0) return message.error("economy/rob:MISSING_AMOUNT", { user: member.user });
|
|
||||||
|
|
||||||
amountToRob = Math.floor(parseInt(amountToRob, 10));
|
|
||||||
|
|
||||||
if (amountToRob > memberData.money) return message.error("economy/rob:NOT_ENOUGH_MEMBER", { user: member.user });
|
|
||||||
|
|
||||||
const potentiallyLose = Math.floor(amountToRob * 1.5);
|
|
||||||
if (potentiallyLose > data.memberData.money) return message.error("economy/rob:NOT_ENOUGH_AUTHOR", {
|
|
||||||
moneyMin: `${potentiallyLose} ${message.getNoun(potentiallyLose, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}`,
|
|
||||||
moneyCurrent: `${data.memberData.money} ${message.getNoun(data.memberData.money, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}`
|
|
||||||
});
|
|
||||||
|
|
||||||
const itsAWon = Math.floor(this.client.functions.randomNum(0, 100) < 25);
|
|
||||||
|
|
||||||
if (itsAWon) {
|
|
||||||
const toWait = Date.now() + 6 * (60 * 60000); // 6 hours
|
|
||||||
memberData.cooldowns.rob = toWait;
|
|
||||||
memberData.markModified("cooldowns");
|
|
||||||
await memberData.save();
|
|
||||||
const randomNum = this.client.functions.randomNum(1, 2);
|
|
||||||
message.sendT("economy/rob:ROB_WON_" + randomNum, {
|
|
||||||
money: `${amountToRob} ${message.getNoun(amountToRob, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}`,
|
|
||||||
user: member.user
|
|
||||||
});
|
|
||||||
data.memberData.money += amountToRob;
|
|
||||||
memberData.money -= amountToRob, 10;
|
|
||||||
memberData.save();
|
|
||||||
data.memberData.save();
|
|
||||||
} else {
|
|
||||||
const won = Math.floor(0.9 * amountToRob);
|
|
||||||
const randomNum = this.client.functions.randomNum(1, 2);
|
|
||||||
message.sendT("economy/rob:ROB_LOSE_" + randomNum, {
|
|
||||||
fine: `${potentiallyLose} ${message.getNoun(potentiallyLose, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}`,
|
|
||||||
offset: `${won} ${message.getNoun(won, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}`,
|
|
||||||
user: member.user
|
|
||||||
});
|
|
||||||
data.memberData.money -= potentiallyLose;
|
|
||||||
memberData.money += won;
|
|
||||||
memberData.save();
|
|
||||||
data.memberData.save();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = Rob;
|
|
|
@ -1,30 +0,0 @@
|
||||||
const Command = require("../../base/Command");
|
|
||||||
|
|
||||||
class Setbio extends Command {
|
|
||||||
constructor(client) {
|
|
||||||
super(client, {
|
|
||||||
name: "setbio",
|
|
||||||
dirname: __dirname,
|
|
||||||
enabled: true,
|
|
||||||
guildOnly: false,
|
|
||||||
aliases: ["biography", "setdesc", "sb"],
|
|
||||||
memberPermissions: [],
|
|
||||||
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
|
|
||||||
nsfw: false,
|
|
||||||
ownerOnly: false,
|
|
||||||
cooldown: 1000
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
async run(message, args, data) {
|
|
||||||
const newBio = args.join(" ");
|
|
||||||
if (!newBio) return message.error("economy/setbio:MISSING");
|
|
||||||
if (newBio.length > 100) return message.error("economy/setbio:MAX_CHARACT");
|
|
||||||
|
|
||||||
data.userData.bio = newBio;
|
|
||||||
message.success("economy/setbio:SUCCESS");
|
|
||||||
await data.userData.save();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = Setbio;
|
|
|
@ -1,46 +0,0 @@
|
||||||
const Command = require("../../base/Command"),
|
|
||||||
tictactoe = require("../../helpers/tictactoe");
|
|
||||||
|
|
||||||
class TicTacToe extends Command {
|
|
||||||
constructor(client) {
|
|
||||||
super(client, {
|
|
||||||
name: "tictactoe",
|
|
||||||
dirname: __dirname,
|
|
||||||
enabled: true,
|
|
||||||
guildOnly: false,
|
|
||||||
aliases: ["ttt"],
|
|
||||||
memberPermissions: [],
|
|
||||||
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
|
|
||||||
nsfw: false,
|
|
||||||
ownerOnly: false,
|
|
||||||
cooldown: 2000
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
async run(message, args, data) {
|
|
||||||
tictactoe(message, {
|
|
||||||
resultBtn: true,
|
|
||||||
embedColor: data.config.embed.color,
|
|
||||||
embedFoot: data.config.embed.footer
|
|
||||||
}).then(async winner => {
|
|
||||||
const memberData = await this.client.findOrCreateMember({
|
|
||||||
id: winner.id,
|
|
||||||
guildID: message.guild.id
|
|
||||||
});
|
|
||||||
|
|
||||||
const info = {
|
|
||||||
user: message.translate("economy/transactions:TTT"),
|
|
||||||
amount: 100,
|
|
||||||
date: Date.now(),
|
|
||||||
type: "got"
|
|
||||||
};
|
|
||||||
|
|
||||||
memberData.transactions.push(info);
|
|
||||||
|
|
||||||
memberData.money += 100;
|
|
||||||
memberData.save();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = TicTacToe;
|
|
|
@ -1,67 +0,0 @@
|
||||||
const Command = require("../../base/Command"),
|
|
||||||
Discord = require("discord.js");
|
|
||||||
|
|
||||||
class Transactions extends Command {
|
|
||||||
constructor(client) {
|
|
||||||
super(client, {
|
|
||||||
name: "transactions",
|
|
||||||
dirname: __dirname,
|
|
||||||
enabled: true,
|
|
||||||
guildOnly: true,
|
|
||||||
aliases: ["tr"],
|
|
||||||
memberPermissions: [],
|
|
||||||
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
|
|
||||||
nsfw: false,
|
|
||||||
ownerOnly: false,
|
|
||||||
cooldown: 2000
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
async run(message, args, data) {
|
|
||||||
const embed = new Discord.EmbedBuilder()
|
|
||||||
.setAuthor({
|
|
||||||
name: message.translate("economy/transactions:EMBED_TRANSACTIONS"),
|
|
||||||
iconURL: message.author.displayAvatarURL({
|
|
||||||
extension: "png",
|
|
||||||
size: 512
|
|
||||||
})
|
|
||||||
})
|
|
||||||
.setColor(data.config.embed.color)
|
|
||||||
.setFooter({
|
|
||||||
text: data.config.embed.footer
|
|
||||||
});
|
|
||||||
|
|
||||||
const transactions = data.memberData.transactions,
|
|
||||||
sortedTransactions = [ [], [] ];
|
|
||||||
|
|
||||||
transactions.slice(-20).forEach((t) => {
|
|
||||||
const array = t.type === "got" ? sortedTransactions[0] : sortedTransactions[1];
|
|
||||||
array.push(`${message.translate("economy/transactions:T_USER_" + t.type.toUpperCase())}: ${t.user}\n${message.translate("economy/transactions:T_AMOUNT")}: ${t.amount}\n${message.translate("economy/transactions:T_DATE")}: ${this.client.printDate(t.date, "Do MMMM YYYY, HH:mm")}\n`);
|
|
||||||
});
|
|
||||||
|
|
||||||
if (transactions.length < 1) {
|
|
||||||
embed.setDescription(message.translate("economy/transactions:NO_TRANSACTIONS"));
|
|
||||||
} else {
|
|
||||||
if (sortedTransactions[0].length > 0) embed.addFields([
|
|
||||||
{
|
|
||||||
name: message.translate("economy/transactions:T_GOT"),
|
|
||||||
value: sortedTransactions[0].join("\n"),
|
|
||||||
inline: true
|
|
||||||
}
|
|
||||||
]);
|
|
||||||
if (sortedTransactions[1].length > 0) embed.addFields([
|
|
||||||
{
|
|
||||||
name: message.translate("economy/transactions:T_SEND"),
|
|
||||||
value: sortedTransactions[1].join("\n"),
|
|
||||||
inline: true
|
|
||||||
}
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
message.reply({
|
|
||||||
embeds: [embed]
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = Transactions;
|
|
|
@ -1,52 +0,0 @@
|
||||||
const Command = require("../../base/Command");
|
|
||||||
|
|
||||||
class Withdraw extends Command {
|
|
||||||
constructor(client) {
|
|
||||||
super(client, {
|
|
||||||
name: "withdraw",
|
|
||||||
dirname: __dirname,
|
|
||||||
enabled: true,
|
|
||||||
guildOnly: true,
|
|
||||||
aliases: ["wd"],
|
|
||||||
memberPermissions: [],
|
|
||||||
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
|
|
||||||
nsfw: false,
|
|
||||||
ownerOnly: false,
|
|
||||||
cooldown: 1000
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
async run(message, args, data) {
|
|
||||||
let amount = args[0];
|
|
||||||
|
|
||||||
if (!(parseInt(data.memberData.bankSold, 10) > 0)) return message.error("economy/withdraw:NO_CREDIT");
|
|
||||||
|
|
||||||
if (args[0] === "all") {
|
|
||||||
amount = parseInt(data.memberData.bankSold, 10);
|
|
||||||
} else {
|
|
||||||
if (isNaN(amount) || parseInt(amount, 10) < 1) return message.error("economy/withdraw:MISSING_AMOUNT");
|
|
||||||
amount = parseInt(amount, 10);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (data.memberData.bankSold < amount) return message.error("economy/withdraw:NOT_ENOUGH", { money: `**${amount}** ${message.getNoun(amount, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}` });
|
|
||||||
|
|
||||||
const info = {
|
|
||||||
user: message.translate("economy/transactions:BANK"),
|
|
||||||
amount: amount,
|
|
||||||
date: Date.now(),
|
|
||||||
type: "got"
|
|
||||||
};
|
|
||||||
|
|
||||||
data.memberData.transactions.push(info);
|
|
||||||
|
|
||||||
data.memberData.money = data.memberData.money + amount;
|
|
||||||
data.memberData.bankSold = data.memberData.bankSold - amount;
|
|
||||||
data.memberData.save();
|
|
||||||
|
|
||||||
message.success("economy/withdraw:SUCCESS", {
|
|
||||||
money: `**${amount}** ${message.getNoun(amount, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}`
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = Withdraw;
|
|
|
@ -1,129 +0,0 @@
|
||||||
const Command = require("../../base/Command"),
|
|
||||||
{ parseEmoji, EmbedBuilder } = require("discord.js");
|
|
||||||
|
|
||||||
class Work extends Command {
|
|
||||||
constructor(client) {
|
|
||||||
super(client, {
|
|
||||||
name: "work",
|
|
||||||
dirname: __dirname,
|
|
||||||
enabled: true,
|
|
||||||
guildOnly: true,
|
|
||||||
aliases: ["salary", "daily"],
|
|
||||||
memberPermissions: [],
|
|
||||||
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
|
|
||||||
nsfw: false,
|
|
||||||
ownerOnly: false,
|
|
||||||
cooldown: 1000
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
async run(message, args, data) {
|
|
||||||
// if the member is already in the cooldown db
|
|
||||||
const isInCooldown = data.memberData.cooldowns.work;
|
|
||||||
if (isInCooldown) {
|
|
||||||
/*if the timestamp recorded in the database indicating
|
|
||||||
when the member will be able to execute the order again
|
|
||||||
is greater than the current date, display an error message */
|
|
||||||
if (isInCooldown > Date.now()) return message.error("economy/work:COOLDOWN", {
|
|
||||||
time: this.client.convertTime(isInCooldown, "to", true)
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Date.now() > data.memberData.cooldowns.work + (24 * 3600000)) data.memberData.workStreak = 0;
|
|
||||||
|
|
||||||
// Records in the database the time when the member will be able to execute the command again (in 12 hours)
|
|
||||||
const toWait = Date.now() + 43200000;
|
|
||||||
data.memberData.cooldowns.work = toWait;
|
|
||||||
data.memberData.markModified("cooldowns");
|
|
||||||
|
|
||||||
data.memberData.workStreak = (data.memberData.workStreak || 0) + 1;
|
|
||||||
await data.memberData.save();
|
|
||||||
|
|
||||||
const embed = new EmbedBuilder()
|
|
||||||
.setFooter({
|
|
||||||
text: message.translate("economy/work:AWARD"),
|
|
||||||
iconURL: message.author.displayAvatarURL({
|
|
||||||
extension: "png",
|
|
||||||
size: 512
|
|
||||||
})
|
|
||||||
})
|
|
||||||
.setColor(data.config.embed.color);
|
|
||||||
|
|
||||||
const award = [
|
|
||||||
this.client.customEmojis.letters.a,
|
|
||||||
this.client.customEmojis.letters.w,
|
|
||||||
this.client.customEmojis.letters.a,
|
|
||||||
this.client.customEmojis.letters.r,
|
|
||||||
this.client.customEmojis.letters.d
|
|
||||||
];
|
|
||||||
let won = 200;
|
|
||||||
|
|
||||||
if (data.memberData.workStreak >= 5) {
|
|
||||||
won += 200;
|
|
||||||
embed.addFields([
|
|
||||||
{
|
|
||||||
name: message.translate("economy/work:SALARY"),
|
|
||||||
value: message.translate("economy/work:SALARY_CONTENT", {
|
|
||||||
won: `${won} ${message.getNoun(won, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}`
|
|
||||||
})
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: message.translate("economy/work:STREAK"),
|
|
||||||
value: message.translate("economy/work:STREAK_CONTENT")
|
|
||||||
}
|
|
||||||
]);
|
|
||||||
data.memberData.workStreak = 0;
|
|
||||||
} else {
|
|
||||||
for (let i = 0; i < award.length; i++) {
|
|
||||||
if (data.memberData.workStreak > i) {
|
|
||||||
const letter = parseEmoji(award[i]).name.split("_")[1];
|
|
||||||
award[i] = `:regional_indicator_${letter.toLowerCase()}:`;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
embed.addFields([
|
|
||||||
{
|
|
||||||
name: message.translate("economy/work:SALARY"),
|
|
||||||
value: message.translate("economy/work:SALARY_CONTENT", {
|
|
||||||
won: `**${won}** ${message.getNoun(won, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}`
|
|
||||||
})
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: message.translate("economy/work:STREAK"),
|
|
||||||
value: award.join("")
|
|
||||||
}
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
const info = {
|
|
||||||
user: message.translate("economy/work:SALARY"),
|
|
||||||
amount: won,
|
|
||||||
date: Date.now(),
|
|
||||||
type: "got"
|
|
||||||
};
|
|
||||||
|
|
||||||
data.memberData.transactions.push(info);
|
|
||||||
data.memberData.money = data.memberData.money + won;
|
|
||||||
data.memberData.save();
|
|
||||||
|
|
||||||
const messageOptions = {
|
|
||||||
embeds: [embed]
|
|
||||||
};
|
|
||||||
if (!data.userData.achievements.work.achieved) {
|
|
||||||
data.userData.achievements.work.progress.now += 1;
|
|
||||||
if (data.userData.achievements.work.progress.now === data.userData.achievements.work.progress.total) {
|
|
||||||
messageOptions.files = [{
|
|
||||||
name: "unlocked.png",
|
|
||||||
attachment: "./assets/img/achievements/achievement_unlocked1.png"
|
|
||||||
}];
|
|
||||||
data.userData.achievements.work.achieved = true;
|
|
||||||
}
|
|
||||||
data.userData.markModified("achievements.work");
|
|
||||||
data.userData.save();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Send the embed in the current channel
|
|
||||||
message.reply(messageOptions);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = Work;
|
|
195
TO REWRITE/leaderboard.js
Normal file
195
TO REWRITE/leaderboard.js
Normal file
|
@ -0,0 +1,195 @@
|
||||||
|
const { SlashCommandBuilder, EmbedBuilder } = require("discord.js");
|
||||||
|
const BaseCommand = require("../../base/BaseCommand");
|
||||||
|
|
||||||
|
class Leaderboard extends BaseCommand {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {import("../base/JaBa")} client
|
||||||
|
*/
|
||||||
|
constructor(client) {
|
||||||
|
super({
|
||||||
|
command: new SlashCommandBuilder()
|
||||||
|
.setName("leaderboard")
|
||||||
|
.setDescription(client.translate("economy/leaderboard:DESCRIPTION"))
|
||||||
|
.addStringOption(option => option.setName("type")
|
||||||
|
.setDescription(client.translate("owner/debug:TYPE"))
|
||||||
|
.setRequired(true)
|
||||||
|
.addChoices(
|
||||||
|
{ name: client.translate("economy/leaderboard:LEVEL"), value: "level" },
|
||||||
|
{ name: client.translate("economy/leaderboard:MONEY"), value: "money" },
|
||||||
|
{ name: client.translate("economy/leaderboard:REP"), value: "rep" }
|
||||||
|
)),
|
||||||
|
aliases: [],
|
||||||
|
dirname: __dirname,
|
||||||
|
guildOnly: true,
|
||||||
|
ownerOnly: false
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {import("../../base/JaBa")} client
|
||||||
|
*/
|
||||||
|
async onLoad() {
|
||||||
|
//...
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {import("../../base/JaBa")} client
|
||||||
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
|
* @param {Object} data
|
||||||
|
*/
|
||||||
|
async execute(client, interaction) {
|
||||||
|
await interaction.deferReply();
|
||||||
|
const type = interaction.options.getString("type");
|
||||||
|
const isOnMobile = JSON.stringify(Object.keys(interaction.member.presence.clientStatus)) === JSON.stringify(["mobile"]);
|
||||||
|
if (isOnMobile) interaction.followUp({
|
||||||
|
content: interaction.translate("economy/leaderboard:MOBILE"),
|
||||||
|
ephemeral: true
|
||||||
|
});
|
||||||
|
|
||||||
|
if (type === "money") {
|
||||||
|
const members = await client.membersData.find({
|
||||||
|
guildID: interaction.guildId
|
||||||
|
}).lean(),
|
||||||
|
membersLeaderboard = members.map(m => {
|
||||||
|
return {
|
||||||
|
id: m.id,
|
||||||
|
money: m.money + m.bankSold
|
||||||
|
};
|
||||||
|
}).sort((a, b) => b.money - a.money);
|
||||||
|
if (membersLeaderboard.length > 20) membersLeaderboard.length = 20;
|
||||||
|
|
||||||
|
let userNames = "";
|
||||||
|
let money = "";
|
||||||
|
for (let i = 0; i < membersLeaderboard.length; i++) {
|
||||||
|
const data = membersLeaderboard[i];
|
||||||
|
const user = await client.users.fetch(data.id);
|
||||||
|
|
||||||
|
userNames += `**${i + 1}**. ${user}\n`;
|
||||||
|
money += `${data.money}\n`;
|
||||||
|
}
|
||||||
|
|
||||||
|
const embed = new EmbedBuilder()
|
||||||
|
.setAuthor({
|
||||||
|
name: interaction.translate("economy/leaderboard:TABLE", {
|
||||||
|
name: interaction.guild.name
|
||||||
|
}),
|
||||||
|
iconURL: interaction.guild.iconURL()
|
||||||
|
})
|
||||||
|
.setColor(client.config.embed.color)
|
||||||
|
.addFields({
|
||||||
|
name: interaction.translate("economy/leaderboard:TOP"),
|
||||||
|
value: userNames,
|
||||||
|
inline: true
|
||||||
|
}, {
|
||||||
|
name: interaction.translate("common:CREDITS"),
|
||||||
|
value: money,
|
||||||
|
inline: true
|
||||||
|
});
|
||||||
|
|
||||||
|
interaction.editReply({
|
||||||
|
embeds: [embed]
|
||||||
|
});
|
||||||
|
} else if (type === "level") {
|
||||||
|
const membersLeaderboard = [];
|
||||||
|
client.membersData.find({
|
||||||
|
guildID: interaction.guildId
|
||||||
|
}).lean().then(async m => {
|
||||||
|
await membersLeaderboard.push({
|
||||||
|
id: m.id,
|
||||||
|
level: m.level,
|
||||||
|
xp: m.exp
|
||||||
|
});
|
||||||
|
});
|
||||||
|
membersLeaderboard.sort((a, b) => b.level - a.level);
|
||||||
|
if (membersLeaderboard.length > 20) membersLeaderboard.length = 20;
|
||||||
|
|
||||||
|
const userNames = [];
|
||||||
|
const level = [];
|
||||||
|
const xp = [];
|
||||||
|
for (let i = 0; i < membersLeaderboard.length; i++) {
|
||||||
|
const data = membersLeaderboard[i];
|
||||||
|
const user = await client.users.fetch(data.id);
|
||||||
|
|
||||||
|
userNames.push(`**${i + 1}**. ${user.tag}`);
|
||||||
|
level.push(`${data.level}`);
|
||||||
|
xp.push(`${data.xp} / ${5 * (data.level * data.level) + 80 * data.level + 100}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
const embed = new EmbedBuilder()
|
||||||
|
.setAuthor({
|
||||||
|
name: interaction.translate("economy/leaderboard:TABLE", {
|
||||||
|
name: interaction.guild.name
|
||||||
|
}),
|
||||||
|
iconURL: interaction.guild.iconURL()
|
||||||
|
})
|
||||||
|
.setColor(client.config.embed.color)
|
||||||
|
.addFields([
|
||||||
|
{
|
||||||
|
name: interaction.translate("economy/leaderboard:TOP"),
|
||||||
|
value: userNames.join("\n"),
|
||||||
|
inline: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: interaction.translate("common:LEVEL"),
|
||||||
|
value: level.join("\n"),
|
||||||
|
inline: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: interaction.translate("common:XP"),
|
||||||
|
value: xp.join("\n"),
|
||||||
|
inline: true
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
|
||||||
|
interaction.editReply({
|
||||||
|
embeds: [embed]
|
||||||
|
});
|
||||||
|
} else if (type === "rep") {
|
||||||
|
const users = await client.usersData.find({
|
||||||
|
rep: { $gt: 0 }
|
||||||
|
}).lean(),
|
||||||
|
usersLeaderboard = users.map(u => {
|
||||||
|
return {
|
||||||
|
id: u.id,
|
||||||
|
rep: u.rep
|
||||||
|
};
|
||||||
|
}).sort((a, b) => b.rep - a.rep);
|
||||||
|
if (usersLeaderboard.length > 20) usersLeaderboard.length = 20;
|
||||||
|
|
||||||
|
let userNames = "";
|
||||||
|
let rep = "";
|
||||||
|
for (let i = 0; i < usersLeaderboard.length; i++) {
|
||||||
|
const data = usersLeaderboard[i];
|
||||||
|
const user = await client.users.fetch(data.id);
|
||||||
|
|
||||||
|
userNames += `**${i + 1}**. ${user}\n`;
|
||||||
|
rep += `${data.rep}\n`;
|
||||||
|
}
|
||||||
|
|
||||||
|
const embed = new EmbedBuilder()
|
||||||
|
.setAuthor({
|
||||||
|
name: interaction.translate("economy/leaderboard:TABLE", {
|
||||||
|
name: interaction.guild.name
|
||||||
|
}),
|
||||||
|
iconURL: interaction.guild.iconURL()
|
||||||
|
})
|
||||||
|
.setColor(client.config.embed.color)
|
||||||
|
.addFields({
|
||||||
|
name: interaction.translate("economy/leaderboard:TOP"),
|
||||||
|
value: userNames,
|
||||||
|
inline: true
|
||||||
|
}, {
|
||||||
|
name: interaction.translate("common:REP"),
|
||||||
|
value: rep,
|
||||||
|
inline: true
|
||||||
|
});
|
||||||
|
|
||||||
|
interaction.editReply({
|
||||||
|
embeds: [embed]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = Leaderboard;
|
|
@ -31,7 +31,7 @@ class Seek extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/JaBa")} client
|
* @param {import("../../base/JaBa")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Array} data
|
* @param {Object} data
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
const voice = interaction.member.voice.channel;
|
const voice = interaction.member.voice.channel;
|
|
@ -34,7 +34,7 @@ class Automod extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/JaBa")} client
|
* @param {import("../../base/JaBa")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Array} data
|
* @param {Object} data
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction, data) {
|
async execute(client, interaction, data) {
|
||||||
const state = interaction.options.getBoolean("state");
|
const state = interaction.options.getBoolean("state");
|
||||||
|
|
|
@ -33,13 +33,13 @@ class Autorole extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/JaBa")} client
|
* @param {import("../../base/JaBa")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Array} data
|
* @param {Object} data
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction, data) {
|
async execute(client, interaction, data) {
|
||||||
const state = interaction.options.getBoolean("state");
|
const state = interaction.options.getBoolean("state");
|
||||||
|
|
||||||
if (state) {
|
if (state) {
|
||||||
const role = interaction.options.getRole("role", true);
|
const role = interaction.options.getRole("role");
|
||||||
if (!role) return interaction.error("administration/autorole:MISSING_ROLE");
|
if (!role) return interaction.error("administration/autorole:MISSING_ROLE");
|
||||||
|
|
||||||
data.guildData.plugins.autorole = {
|
data.guildData.plugins.autorole = {
|
||||||
|
@ -50,13 +50,9 @@ class Autorole extends BaseCommand {
|
||||||
await data.guildData.save();
|
await data.guildData.save();
|
||||||
|
|
||||||
interaction.success("administration/autorole:SUCCESS_ENABLED", {
|
interaction.success("administration/autorole:SUCCESS_ENABLED", {
|
||||||
roleName: role.name
|
roleName: role.toString()
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
if (!data.guildData.plugins.autorole.enabled) return interaction.success("administration/autorole:ALREADY_DISABLED", {
|
|
||||||
prefix: data.guildData.prefix
|
|
||||||
});
|
|
||||||
|
|
||||||
data.guildData.plugins.autorole = {
|
data.guildData.plugins.autorole = {
|
||||||
enabled: false,
|
enabled: false,
|
||||||
role: null
|
role: null
|
||||||
|
@ -64,9 +60,7 @@ class Autorole extends BaseCommand {
|
||||||
data.guildData.markModified("plugins.autorole");
|
data.guildData.markModified("plugins.autorole");
|
||||||
await data.guildData.save();
|
await data.guildData.save();
|
||||||
|
|
||||||
interaction.success("administration/autorole:SUCCESS_DISABLED", {
|
interaction.success("administration/autorole:SUCCESS_DISABLED");
|
||||||
prefix: data.guildData.prefix
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ class Config extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/JaBa")} client
|
* @param {import("../../base/JaBa")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Array} data
|
* @param {Object} data
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction, data) {
|
async execute(client, interaction, data) {
|
||||||
const guildData = data.guildData;
|
const guildData = data.guildData;
|
||||||
|
@ -75,7 +75,7 @@ class Config extends BaseCommand {
|
||||||
{
|
{
|
||||||
name: interaction.translate("administration/config:AUTOMOD_TITLE"),
|
name: interaction.translate("administration/config:AUTOMOD_TITLE"),
|
||||||
value: guildData.plugins.automod.enabled ? interaction.translate("administration/config:AUTOMOD_CONTENT", {
|
value: guildData.plugins.automod.enabled ? interaction.translate("administration/config:AUTOMOD_CONTENT", {
|
||||||
channels: guildData.plugins.automod.ignored.map(ch => `<#${ch}>`)
|
channels: guildData.plugins.automod.ignored.map(ch => ` ${ch}`)
|
||||||
}) : interaction.translate("common:DISABLED")
|
}) : interaction.translate("common:DISABLED")
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -31,7 +31,7 @@ class Deletemod extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/JaBa")} client
|
* @param {import("../../base/JaBa")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Array} data
|
* @param {Object} data
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction, data) {
|
async execute(client, interaction, data) {
|
||||||
const state = interaction.options.getBoolean("state");
|
const state = interaction.options.getBoolean("state");
|
||||||
|
|
|
@ -43,7 +43,7 @@ class Goodbye extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/JaBa")} client
|
* @param {import("../../base/JaBa")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Array} data
|
* @param {Object} data
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction, data) {
|
async execute(client, interaction, data) {
|
||||||
const command = interaction.options.getSubcommand();
|
const command = interaction.options.getSubcommand();
|
||||||
|
|
|
@ -19,8 +19,7 @@ class Set extends BaseCommand {
|
||||||
{ name: client.translate("common:LEVEL"), value: "level" },
|
{ name: client.translate("common:LEVEL"), value: "level" },
|
||||||
{ name: client.translate("common:XP"), value: "xp" },
|
{ name: client.translate("common:XP"), value: "xp" },
|
||||||
{ name: client.translate("common:CREDITS"), value: "credits" },
|
{ name: client.translate("common:CREDITS"), value: "credits" },
|
||||||
{ name: client.translate("economy/transactions:BANK"), value: "bank" },
|
{ name: client.translate("economy/transactions:BANK"), value: "bank" }
|
||||||
{ name: client.translate("common:REP"), value: "rep" },
|
|
||||||
))
|
))
|
||||||
.addUserOption(option => option.setName("user")
|
.addUserOption(option => option.setName("user")
|
||||||
.setDescription(client.translate("common:USER"))
|
.setDescription(client.translate("common:USER"))
|
||||||
|
@ -45,56 +44,50 @@ class Set extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/JaBa")} client
|
* @param {import("../../base/JaBa")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Array} data
|
* @param {Object} data
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction, data) {
|
async execute(client, interaction) {
|
||||||
const type = interaction.options.getString("type");
|
const type = interaction.options.getString("type");
|
||||||
const member = interaction.options.getMember("user");
|
const member = interaction.options.getMember("user");
|
||||||
if (member.user.bot) return interaction.error("misc:BOT_USER", null, { ephemeral: true });
|
if (member.user.bot) return interaction.error("misc:BOT_USER", null, { ephemeral: true });
|
||||||
|
const memberData = await client.findOrCreateMember({
|
||||||
|
id: member.id
|
||||||
|
});
|
||||||
const int = interaction.options.getInteger("int");
|
const int = interaction.options.getInteger("int");
|
||||||
if (int < 0) return interaction.error("administration/set:INVALID_NUMBER", null, { ephemeral: true });
|
if (int < 0) return interaction.error("administration/set:INVALID_NUMBER", null, { ephemeral: true });
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case "level": {
|
case "level": {
|
||||||
data.memberData.level = int;
|
memberData.level = int;
|
||||||
await data.memberData.save();
|
await memberData.save();
|
||||||
return interaction.success("owner/debug:SUCCESS_" + type.toUpperCase(), {
|
return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, {
|
||||||
username: member.toString(),
|
username: member.toString(),
|
||||||
amount: int
|
amount: int
|
||||||
}, { ephemeral: true });
|
}, { ephemeral: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
case "xp": {
|
case "xp": {
|
||||||
data.memberData.exp = int;
|
memberData.exp = int;
|
||||||
await data.memberData.save();
|
await memberData.save();
|
||||||
return interaction.success("owner/debug:SUCCESS_" + type.toUpperCase(), {
|
return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, {
|
||||||
username: member.toString(),
|
username: member.toString(),
|
||||||
amount: int
|
amount: int
|
||||||
}, { ephemeral: true });
|
}, { ephemeral: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
case "credits": {
|
case "credits": {
|
||||||
data.memberData.money = int;
|
memberData.money = int;
|
||||||
await data.memberData.save();
|
await memberData.save();
|
||||||
return interaction.success("owner/debug:SUCCESS_" + type.toUpperCase(), {
|
return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, {
|
||||||
username: member.toString(),
|
username: member.toString(),
|
||||||
amount: int
|
amount: int
|
||||||
}, { ephemeral: true });
|
}, { ephemeral: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
case "bank": {
|
case "bank": {
|
||||||
data.memberData.bankSold = int;
|
memberData.bankSold = int;
|
||||||
await data.memberData.save();
|
await memberData.save();
|
||||||
return interaction.success("owner/debug:SUCCESS_" + type.toUpperCase(), {
|
return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, {
|
||||||
username: member.toString(),
|
|
||||||
amount: int
|
|
||||||
}, { ephemeral: true });
|
|
||||||
}
|
|
||||||
|
|
||||||
case "rep": {
|
|
||||||
data.memberData.rep = int;
|
|
||||||
await data.memberData.save();
|
|
||||||
return interaction.success("owner/debug:SUCCESS_" + type.toUpperCase(), {
|
|
||||||
username: member.toString(),
|
username: member.toString(),
|
||||||
amount: int
|
amount: int
|
||||||
}, { ephemeral: true });
|
}, { ephemeral: true });
|
||||||
|
|
|
@ -34,7 +34,7 @@ class Setbirthdays extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/JaBa")} client
|
* @param {import("../../base/JaBa")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Array} data
|
* @param {Object} data
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction, data) {
|
async execute(client, interaction, data) {
|
||||||
const state = interaction.options.getBoolean("state");
|
const state = interaction.options.getBoolean("state");
|
||||||
|
|
|
@ -35,7 +35,7 @@ class Setlang extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/JaBa")} client
|
* @param {import("../../base/JaBa")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Array} data
|
* @param {Object} data
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction, data) {
|
async execute(client, interaction, data) {
|
||||||
const lang = interaction.options.getString("language");
|
const lang = interaction.options.getString("language");
|
||||||
|
|
|
@ -34,7 +34,7 @@ class Setmodlogs extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/JaBa")} client
|
* @param {import("../../base/JaBa")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Array} data
|
* @param {Object} data
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction, data) {
|
async execute(client, interaction, data) {
|
||||||
const state = interaction.options.getBoolean("state");
|
const state = interaction.options.getBoolean("state");
|
||||||
|
|
|
@ -34,7 +34,7 @@ class Setnews extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/JaBa")} client
|
* @param {import("../../base/JaBa")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Array} data
|
* @param {Object} data
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction, data) {
|
async execute(client, interaction, data) {
|
||||||
const state = interaction.options.getBoolean("state");
|
const state = interaction.options.getBoolean("state");
|
||||||
|
|
|
@ -34,7 +34,7 @@ class Setreports extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/JaBa")} client
|
* @param {import("../../base/JaBa")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Array} data
|
* @param {Object} data
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction, data) {
|
async execute(client, interaction, data) {
|
||||||
const state = interaction.options.getBoolean("state");
|
const state = interaction.options.getBoolean("state");
|
||||||
|
|
|
@ -34,7 +34,7 @@ class Setsuggests extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/JaBa")} client
|
* @param {import("../../base/JaBa")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Array} data
|
* @param {Object} data
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction, data) {
|
async execute(client, interaction, data) {
|
||||||
const state = interaction.options.getBoolean("state");
|
const state = interaction.options.getBoolean("state");
|
||||||
|
|
|
@ -31,7 +31,7 @@ class Stealemoji extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/JaBa")} client
|
* @param {import("../../base/JaBa")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Array} data
|
* @param {Object} data
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
const parsedEmoji = parseEmoji(interaction.options.getString("emoji"));
|
const parsedEmoji = parseEmoji(interaction.options.getString("emoji"));
|
||||||
|
@ -46,9 +46,9 @@ class Stealemoji extends BaseCommand {
|
||||||
emoji: emoji.name
|
emoji: emoji.name
|
||||||
}, { ephemeral: true }))
|
}, { ephemeral: true }))
|
||||||
.catch(e => {
|
.catch(e => {
|
||||||
console.log(e);
|
|
||||||
interaction.error("administration/stealemoji:ERROR", {
|
interaction.error("administration/stealemoji:ERROR", {
|
||||||
emoji: parsedEmoji.name
|
emoji: parsedEmoji.name,
|
||||||
|
e
|
||||||
}, { ephemeral: true });
|
}, { ephemeral: true });
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,7 @@ class Welcome extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/JaBa")} client
|
* @param {import("../../base/JaBa")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Array} data
|
* @param {Object} data
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction, data) {
|
async execute(client, interaction, data) {
|
||||||
const command = interaction.options.getSubcommand();
|
const command = interaction.options.getSubcommand();
|
||||||
|
|
116
commands/Economy/achievements.js
Normal file
116
commands/Economy/achievements.js
Normal file
|
@ -0,0 +1,116 @@
|
||||||
|
const { SlashCommandBuilder, EmbedBuilder } = require("discord.js");
|
||||||
|
const BaseCommand = require("../../base/BaseCommand");
|
||||||
|
|
||||||
|
class Achievements extends BaseCommand {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {import("../base/JaBa")} client
|
||||||
|
*/
|
||||||
|
constructor(client) {
|
||||||
|
super({
|
||||||
|
command: new SlashCommandBuilder()
|
||||||
|
.setName("achievements")
|
||||||
|
.setDescription(client.translate("economy/achievements:DESCRIPTION"))
|
||||||
|
.addUserOption(option => option.setName("user")
|
||||||
|
.setDescription(client.translate("common:USER"))),
|
||||||
|
aliases: [],
|
||||||
|
dirname: __dirname,
|
||||||
|
guildOnly: true,
|
||||||
|
ownerOnly: false
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {import("../../base/JaBa")} client
|
||||||
|
*/
|
||||||
|
async onLoad() {
|
||||||
|
//...
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {import("../../base/JaBa")} client
|
||||||
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
|
* @param {Object} data
|
||||||
|
*/
|
||||||
|
async execute(client, interaction, data) {
|
||||||
|
const member = interaction.options.getMember("user") || interaction.member;
|
||||||
|
if (member.user.bot) return interaction.error("economy/profile:BOT_USER");
|
||||||
|
const userData = (member.id === interaction.member.id ? data.userData : await client.findOrCreateUser({
|
||||||
|
id: member.id
|
||||||
|
}));
|
||||||
|
|
||||||
|
const embed = new EmbedBuilder()
|
||||||
|
.setAuthor({
|
||||||
|
name: interaction.translate("economy/achievements:TITLE")
|
||||||
|
})
|
||||||
|
.setColor(client.config.embed.color)
|
||||||
|
.setFooter({
|
||||||
|
text: client.config.embed.footer
|
||||||
|
});
|
||||||
|
|
||||||
|
embed.addFields([
|
||||||
|
{
|
||||||
|
name: interaction.translate("economy/achievements:SEND_CMD"),
|
||||||
|
value: interaction.translate("economy/achievements:PROGRESS", {
|
||||||
|
now: userData.achievements.firstCommand.progress.now,
|
||||||
|
total: userData.achievements.firstCommand.progress.total,
|
||||||
|
percent: Math.round(100 * (userData.achievements.firstCommand.progress.now / userData.achievements.firstCommand.progress.total))
|
||||||
|
})
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: interaction.translate("economy/achievements:CLAIM_SALARY"),
|
||||||
|
value: interaction.translate("economy/achievements:PROGRESS", {
|
||||||
|
now: userData.achievements.work.progress.now,
|
||||||
|
total: userData.achievements.work.progress.total,
|
||||||
|
percent: Math.round(100 * (userData.achievements.work.progress.now / userData.achievements.work.progress.total))
|
||||||
|
})
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: interaction.translate("economy/achievements:MARRY"),
|
||||||
|
value: interaction.translate("economy/achievements:PROGRESS", {
|
||||||
|
now: userData.achievements.married.progress.now,
|
||||||
|
total: userData.achievements.married.progress.total,
|
||||||
|
percent: Math.round(100 * (userData.achievements.married.progress.now / userData.achievements.married.progress.total))
|
||||||
|
})
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: interaction.translate("economy/achievements:SLOTS"),
|
||||||
|
value: interaction.translate("economy/achievements:PROGRESS", {
|
||||||
|
now: userData.achievements.slots.progress.now,
|
||||||
|
total: userData.achievements.slots.progress.total,
|
||||||
|
percent: Math.round(100 * (userData.achievements.slots.progress.now / userData.achievements.slots.progress.total))
|
||||||
|
})
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: interaction.translate("economy/achievements:TIP"),
|
||||||
|
value: interaction.translate("economy/achievements:PROGRESS", {
|
||||||
|
now: userData.achievements.tip.progress.now,
|
||||||
|
total: userData.achievements.tip.progress.total,
|
||||||
|
percent: Math.round(100 * (userData.achievements.tip.progress.now / userData.achievements.tip.progress.total))
|
||||||
|
})
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: interaction.translate("economy/achievements:REP"),
|
||||||
|
value: interaction.translate("economy/achievements:PROGRESS", {
|
||||||
|
now: userData.achievements.rep.progress.now,
|
||||||
|
total: userData.achievements.rep.progress.total,
|
||||||
|
percent: Math.round(100 * (userData.achievements.rep.progress.now / userData.achievements.rep.progress.total))
|
||||||
|
})
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: interaction.translate("economy/achievements:INVITE"),
|
||||||
|
value: interaction.translate("economy/achievements:PROGRESS", {
|
||||||
|
now: userData.achievements.invite.progress.now,
|
||||||
|
total: userData.achievements.invite.progress.total,
|
||||||
|
percent: Math.round(100 * (userData.achievements.invite.progress.now / userData.achievements.invite.progress.total))
|
||||||
|
})
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
|
||||||
|
interaction.reply({
|
||||||
|
embeds: [embed]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = Achievements;
|
92
commands/Economy/bank.js
Normal file
92
commands/Economy/bank.js
Normal file
|
@ -0,0 +1,92 @@
|
||||||
|
const { SlashCommandBuilder } = require("discord.js");
|
||||||
|
const BaseCommand = require("../../base/BaseCommand");
|
||||||
|
|
||||||
|
class Bank extends BaseCommand {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {import("../base/JaBa")} client
|
||||||
|
*/
|
||||||
|
constructor(client) {
|
||||||
|
super({
|
||||||
|
command: new SlashCommandBuilder()
|
||||||
|
.setName("bank")
|
||||||
|
.setDescription(client.translate("economy/bank:DESCRIPTION"))
|
||||||
|
.addStringOption(option => option.setName("option")
|
||||||
|
.setDescription(client.translate("economy/bank:OPTION"))
|
||||||
|
.setRequired(true)
|
||||||
|
.addChoices(
|
||||||
|
{ name: client.translate("economy/bank:DEPOSIT"), value: "deposit" },
|
||||||
|
{ name: client.translate("economy/bank:WITHDRAW"), value: "withdraw" }
|
||||||
|
))
|
||||||
|
.addStringOption(option => option.setName("credits")
|
||||||
|
.setDescription(client.translate("moderation/clear:OPTION"))
|
||||||
|
.setRequired(true)),
|
||||||
|
aliases: [],
|
||||||
|
dirname: __dirname,
|
||||||
|
guildOnly: true,
|
||||||
|
ownerOnly: false
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {import("../../base/JaBa")} client
|
||||||
|
*/
|
||||||
|
async onLoad() {
|
||||||
|
//...
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {import("../../base/JaBa")} client
|
||||||
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
|
* @param {Object} data
|
||||||
|
*/
|
||||||
|
async execute(client, interaction, data) {
|
||||||
|
const choice = interaction.options.getString("option");
|
||||||
|
|
||||||
|
if (choice === "deposit") {
|
||||||
|
const credits = interaction.options.getString("credits") === "all" ? data.memberData.money : interaction.options.getString("credits");
|
||||||
|
if (isNaN(credits) || credits < 1) return interaction.error("misc:OPTION_NAN_ALL");
|
||||||
|
if (data.memberData.money < credits) return interaction.error("economy/bank:NOT_ENOUGH_CREDIT", { money: `**${credits}** ${client.getNoun(credits, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}` });
|
||||||
|
|
||||||
|
const info = {
|
||||||
|
user: interaction.translate("economy/transactions:BANK"),
|
||||||
|
amount: credits,
|
||||||
|
date: Date.now(),
|
||||||
|
type: "send"
|
||||||
|
};
|
||||||
|
|
||||||
|
data.memberData.transactions.push(info);
|
||||||
|
|
||||||
|
data.memberData.money -= credits;
|
||||||
|
data.memberData.bankSold += credits;
|
||||||
|
await data.memberData.save();
|
||||||
|
|
||||||
|
interaction.success("economy/bank:SUCCESS_DEP", {
|
||||||
|
money: `**${credits}** ${client.getNoun(credits, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
const credits = interaction.options.getString("credits") === "all" ? data.memberData.bankSold : interaction.options.getString("credits");
|
||||||
|
if (isNaN(credits) || credits < 1) return interaction.error("misc:OPTION_NAN_ALL");
|
||||||
|
if (data.memberData.bankSold < credits) return interaction.error("economy/bank:NOT_ENOUGH_BANK", { money: `**${credits}** ${client.getNoun(credits, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}` });
|
||||||
|
|
||||||
|
const info = {
|
||||||
|
user: interaction.translate("economy/transactions:BANK"),
|
||||||
|
amount: credits,
|
||||||
|
date: Date.now(),
|
||||||
|
type: "got"
|
||||||
|
};
|
||||||
|
|
||||||
|
data.memberData.transactions.push(info);
|
||||||
|
|
||||||
|
data.memberData.money += credits;
|
||||||
|
data.memberData.bankSold -= credits;
|
||||||
|
await data.memberData.save();
|
||||||
|
|
||||||
|
interaction.success("economy/bank:SUCCESS_WD", {
|
||||||
|
money: `**${credits}** ${client.getNoun(credits, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = Bank;
|
57
commands/Economy/birthdate.js
Normal file
57
commands/Economy/birthdate.js
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
const { SlashCommandBuilder } = require("discord.js");
|
||||||
|
const BaseCommand = require("../../base/BaseCommand");
|
||||||
|
|
||||||
|
class Birthdate extends BaseCommand {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {import("../base/JaBa")} client
|
||||||
|
*/
|
||||||
|
constructor(client) {
|
||||||
|
super({
|
||||||
|
command: new SlashCommandBuilder()
|
||||||
|
.setName("birthdate")
|
||||||
|
.setDescription(client.translate("economy/birthdate:DESCRIPTION"))
|
||||||
|
.addStringOption(option => option.setName("date")
|
||||||
|
.setDescription(client.translate("economy/birthdate:DATE"))
|
||||||
|
.setRequired(true)),
|
||||||
|
aliases: [],
|
||||||
|
dirname: __dirname,
|
||||||
|
guildOnly: true,
|
||||||
|
ownerOnly: false
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {import("../../base/JaBa")} client
|
||||||
|
*/
|
||||||
|
async onLoad() {
|
||||||
|
//...
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {import("../../base/JaBa")} client
|
||||||
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
|
* @param {Object} data
|
||||||
|
*/
|
||||||
|
async execute(client, interaction, data) {
|
||||||
|
const date = interaction.options.getString("date");
|
||||||
|
const match = date.match(/\d+/g);
|
||||||
|
if (!match) return interaction.error("economy/birthdate:INVALID_DATE");
|
||||||
|
const [day, month, year] = date.split("/");
|
||||||
|
if (!day || !month || !year) return interaction.error("economy/birthdate:INVALID_DATE");
|
||||||
|
|
||||||
|
const d = new Date(year, month - 1, day);
|
||||||
|
if (!(day == d.getDate() && month - 1 == d.getMonth() && year == d.getFullYear())) return interaction.error("economy/birthdate:INVALID_DATE");
|
||||||
|
if (d.getTime() > Date.now()) return interaction.error("economy/birthdate:DATE_TOO_HIGH");
|
||||||
|
if (d.getTime() < (Date.now() - 2.523e+12)) return interaction.error("economy/birthdate:DATE_TOO_LOW");
|
||||||
|
|
||||||
|
data.userData.birthdate = d;
|
||||||
|
await data.userData.save();
|
||||||
|
|
||||||
|
interaction.success("economy/birthdate:SUCCESS", {
|
||||||
|
date: client.printDate(d)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = Birthdate;
|
58
commands/Economy/divorce.js
Normal file
58
commands/Economy/divorce.js
Normal file
|
@ -0,0 +1,58 @@
|
||||||
|
const { SlashCommandBuilder } = require("discord.js");
|
||||||
|
const BaseCommand = require("../../base/BaseCommand");
|
||||||
|
|
||||||
|
class Divorce extends BaseCommand {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {import("../base/JaBa")} client
|
||||||
|
*/
|
||||||
|
constructor(client) {
|
||||||
|
super({
|
||||||
|
command: new SlashCommandBuilder()
|
||||||
|
.setName("divorce")
|
||||||
|
.setDescription(client.translate("economy/divorce:DESCRIPTION")),
|
||||||
|
aliases: [],
|
||||||
|
dirname: __dirname,
|
||||||
|
guildOnly: true,
|
||||||
|
ownerOnly: false
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {import("../../base/JaBa")} client
|
||||||
|
*/
|
||||||
|
async onLoad() {
|
||||||
|
//...
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {import("../../base/JaBa")} client
|
||||||
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
|
* @param {Object} data
|
||||||
|
*/
|
||||||
|
async execute(client, interaction, data) {
|
||||||
|
if (!data.userData.lover) return interaction.error("economy/divorce:NOT_MARRIED");
|
||||||
|
const user = client.users.cache.get(data.userData.lover) || await client.users.fetch(data.userData.lover);
|
||||||
|
|
||||||
|
data.userData.lover = null;
|
||||||
|
await data.userData.save();
|
||||||
|
|
||||||
|
const oldLover = await client.findOrCreateUser({
|
||||||
|
id: user.id
|
||||||
|
});
|
||||||
|
oldLover.lover = null;
|
||||||
|
await oldLover.save();
|
||||||
|
|
||||||
|
interaction.success("economy/divorce:DIVORCED", {
|
||||||
|
user: user.toString()
|
||||||
|
});
|
||||||
|
|
||||||
|
user.send({
|
||||||
|
content: interaction.translate("economy/divorce:DIVORCED_U", {
|
||||||
|
user: interaction.member.toString()
|
||||||
|
})
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = Divorce;
|
47
commands/Economy/importmee6.js
Normal file
47
commands/Economy/importmee6.js
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
const { SlashCommandBuilder } = require("discord.js"),
|
||||||
|
{ getUserXp } = require("mee6-levels-api");
|
||||||
|
const BaseCommand = require("../../base/BaseCommand");
|
||||||
|
|
||||||
|
class ImportMee6 extends BaseCommand {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {import("../base/JaBa")} client
|
||||||
|
*/
|
||||||
|
constructor(client) {
|
||||||
|
super({
|
||||||
|
command: new SlashCommandBuilder()
|
||||||
|
.setName("importmee6")
|
||||||
|
.setDescription(client.translate("economy/importmee6:DESCRIPTION")),
|
||||||
|
aliases: [],
|
||||||
|
dirname: __dirname,
|
||||||
|
guildOnly: true,
|
||||||
|
ownerOnly: false
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {import("../../base/JaBa")} client
|
||||||
|
*/
|
||||||
|
async onLoad() {
|
||||||
|
//...
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {import("../../base/JaBa")} client
|
||||||
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
|
* @param {Object} data
|
||||||
|
*/
|
||||||
|
async execute(client, interaction, data) {
|
||||||
|
const level = (await getUserXp(interaction.guildId, interaction.member.id)).level;
|
||||||
|
|
||||||
|
data.memberData.level = level;
|
||||||
|
await data.memberData.save();
|
||||||
|
|
||||||
|
interaction.success("owner/debug:SUCCESS_LEVEL", {
|
||||||
|
username: interaction.member.toString(),
|
||||||
|
amount: level
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = ImportMee6;
|
156
commands/Economy/marry.js
Normal file
156
commands/Economy/marry.js
Normal file
|
@ -0,0 +1,156 @@
|
||||||
|
const { SlashCommandBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle } = require("discord.js");
|
||||||
|
const BaseCommand = require("../../base/BaseCommand"),
|
||||||
|
pendings = {};
|
||||||
|
|
||||||
|
class Marry extends BaseCommand {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {import("../base/JaBa")} client
|
||||||
|
*/
|
||||||
|
constructor(client) {
|
||||||
|
super({
|
||||||
|
command: new SlashCommandBuilder()
|
||||||
|
.setName("marry")
|
||||||
|
.setDescription(client.translate("economy/marry:DESCRIPTION"))
|
||||||
|
.addUserOption(option => option.setName("user")
|
||||||
|
.setDescription(client.translate("common:USER"))
|
||||||
|
.setRequired(true)),
|
||||||
|
aliases: [],
|
||||||
|
dirname: __dirname,
|
||||||
|
guildOnly: true,
|
||||||
|
ownerOnly: false
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {import("../../base/JaBa")} client
|
||||||
|
*/
|
||||||
|
async onLoad() {
|
||||||
|
//...
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {import("../../base/JaBa")} client
|
||||||
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
|
* @param {Object} data
|
||||||
|
*/
|
||||||
|
async execute(client, interaction, data) {
|
||||||
|
if (data.userData.lover) return interaction.error("economy/marry:ALREADY_MARRIED");
|
||||||
|
const member = interaction.options.getMember("user");
|
||||||
|
if (member.user.bot) return interaction.error("economy/marry:BOT_USER");
|
||||||
|
if (member.id === interaction.member.id) return interaction.error("economy/marry:YOURSELF");
|
||||||
|
const userData = await client.findOrCreateUser({
|
||||||
|
id: member.id
|
||||||
|
});
|
||||||
|
if (userData.lover) return interaction.error("economy/marry:ALREADY_MARRIED_USER", { user: member.toString() });
|
||||||
|
|
||||||
|
for (const requester in pendings) {
|
||||||
|
const receiver = pendings[requester];
|
||||||
|
|
||||||
|
if (requester === interaction.author.id) {
|
||||||
|
const user = client.users.cache.get(receiver) || await client.users.fetch(receiver);
|
||||||
|
return interaction.error("economy/marry:REQUEST_AUTHOR_TO_AMEMBER", {
|
||||||
|
user: user.toString
|
||||||
|
});
|
||||||
|
} else if (receiver === interaction.member.id) {
|
||||||
|
const user = client.users.cache.get(requester) || await client.users.fetch(requester);
|
||||||
|
return interaction.error("economy/marry:REQUEST_AMEMBER_TO_AUTHOR", {
|
||||||
|
user: user.toString()
|
||||||
|
});
|
||||||
|
} else if (requester === member.id) {
|
||||||
|
const user = client.users.cache.get(receiver) || await client.users.fetch(receiver);
|
||||||
|
return interaction.error("economy/marry:REQUEST_AMEMBER_TO_MEMBER", {
|
||||||
|
firstUser: member.toString(),
|
||||||
|
secondUser: user.toString()
|
||||||
|
});
|
||||||
|
} else if (receiver === member.id) {
|
||||||
|
const user = client.users.cache.get(requester) || await client.users.fetch(requester);
|
||||||
|
return interaction.error("economy/marry:REQUEST_MEMBER_TO_AMEMBER", {
|
||||||
|
firstUser: member.toString(),
|
||||||
|
secondUser: user.toString()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pendings[interaction.member.id] = member.id;
|
||||||
|
|
||||||
|
const row = new ActionRowBuilder()
|
||||||
|
.addComponents(
|
||||||
|
new ButtonBuilder()
|
||||||
|
.setCustomId("marry_confirm_yes")
|
||||||
|
.setLabel(interaction.translate("common:ACCEPT"))
|
||||||
|
.setStyle(ButtonStyle.Danger),
|
||||||
|
new ButtonBuilder()
|
||||||
|
.setCustomId("marry_confirm_no")
|
||||||
|
.setLabel(interaction.translate("common:CANCEL"))
|
||||||
|
.setStyle(ButtonStyle.Secondary),
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
await interaction.reply({
|
||||||
|
content: interaction.translate("economy/marry:REQUEST", {
|
||||||
|
to: member.toString(),
|
||||||
|
from: interaction.member.toString()
|
||||||
|
}),
|
||||||
|
components: [row]
|
||||||
|
});
|
||||||
|
|
||||||
|
const filter = i => i.user.id === member.id;
|
||||||
|
const collector = interaction.channel.createMessageComponentCollector({ filter, time: 120000 });
|
||||||
|
|
||||||
|
collector.on("collect", async i => {
|
||||||
|
if (i.isButton()) {
|
||||||
|
if (i.customId === "marry_confirm_yes") return collector.stop(true);
|
||||||
|
else if (i.customId === "marry_confirm_no") return collector.stop(false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
collector.on("end", async (_, reason) => {
|
||||||
|
delete pendings[interaction.member.id];
|
||||||
|
if (reason === "time") return interaction.error("economy/marry:TIMEOUT");
|
||||||
|
if (reason) {
|
||||||
|
data.userData.lover = member.id;
|
||||||
|
await data.userData.save();
|
||||||
|
userData.lover = interaction.member.id;
|
||||||
|
await userData.save();
|
||||||
|
|
||||||
|
const messageOptions = {
|
||||||
|
content: `${member.toString()} :heart: ${interaction.member.toString()}`,
|
||||||
|
files: [{
|
||||||
|
name: "achievement_unlocked3.png",
|
||||||
|
attachment: "./assets/img/achievements/achievement_unlocked3.png"
|
||||||
|
}]
|
||||||
|
};
|
||||||
|
|
||||||
|
let sent = false;
|
||||||
|
if (!userData.achievements.married.achieved) {
|
||||||
|
interaction.followUp(messageOptions);
|
||||||
|
sent = true;
|
||||||
|
userData.achievements.married.achieved = true;
|
||||||
|
userData.achievements.married.progress.now = 1;
|
||||||
|
userData.markModified("achievements.married");
|
||||||
|
await userData.save();
|
||||||
|
}
|
||||||
|
if (!data.userData.achievements.married.achieved) {
|
||||||
|
if (!sent) interaction.followUp(messageOptions);
|
||||||
|
data.userData.achievements.married.achieved = true;
|
||||||
|
data.userData.achievements.married.progress.now = 1;
|
||||||
|
data.userData.markModified("achievements.married");
|
||||||
|
await data.userData.save();
|
||||||
|
}
|
||||||
|
|
||||||
|
return interaction.success("economy/marry:SUCCESS", {
|
||||||
|
creator: interaction.member.toString(),
|
||||||
|
partner: member.toString()
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
return interaction.success("economy/marry:DENIED", {
|
||||||
|
creator: interaction.member.toString(),
|
||||||
|
partner: member.toString()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = Marry;
|
96
commands/Economy/money.js
Normal file
96
commands/Economy/money.js
Normal file
|
@ -0,0 +1,96 @@
|
||||||
|
const { SlashCommandBuilder, EmbedBuilder } = require("discord.js");
|
||||||
|
const BaseCommand = require("../../base/BaseCommand");
|
||||||
|
const asyncForEach = async (collection, callback) => {
|
||||||
|
const allPromises = collection.map(async key => {
|
||||||
|
await callback(key);
|
||||||
|
});
|
||||||
|
|
||||||
|
return await Promise.all(allPromises);
|
||||||
|
};
|
||||||
|
|
||||||
|
class Money extends BaseCommand {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {import("../base/JaBa")} client
|
||||||
|
*/
|
||||||
|
constructor(client) {
|
||||||
|
super({
|
||||||
|
command: new SlashCommandBuilder()
|
||||||
|
.setName("money")
|
||||||
|
.setDescription(client.translate("economy/money:DESCRIPTION"))
|
||||||
|
.addUserOption(option => option.setName("user")
|
||||||
|
.setDescription(client.translate("common:USER"))),
|
||||||
|
aliases: [],
|
||||||
|
dirname: __dirname,
|
||||||
|
guildOnly: true,
|
||||||
|
ownerOnly: false
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {import("../../base/JaBa")} client
|
||||||
|
*/
|
||||||
|
async onLoad() {
|
||||||
|
//...
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {import("../../base/JaBa")} client
|
||||||
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
|
* @param {Object} data
|
||||||
|
*/
|
||||||
|
async execute(client, interaction, data) {
|
||||||
|
await interaction.deferReply();
|
||||||
|
const member = interaction.options.getMember("user") || interaction.member;
|
||||||
|
if (member.user.bot) return interaction.error("economy/money:BOT_USER");
|
||||||
|
|
||||||
|
const memberData = (member.id === interaction.user.id) ? data.memberData : await client.findOrCreateMember({
|
||||||
|
id: member.id,
|
||||||
|
guildID: interaction.guildId
|
||||||
|
});
|
||||||
|
|
||||||
|
const guilds = client.guilds.cache.filter(g => g.members.cache.find(m => m.id === member.id));
|
||||||
|
let globalMoney = 0;
|
||||||
|
await asyncForEach(guilds, async guild => {
|
||||||
|
const data = await client.findOrCreateMember({
|
||||||
|
id: member.id,
|
||||||
|
guildID: guild.id
|
||||||
|
});
|
||||||
|
globalMoney += data.money + data.bankSold;
|
||||||
|
});
|
||||||
|
|
||||||
|
const embed = new EmbedBuilder()
|
||||||
|
.setAuthor({
|
||||||
|
name: interaction.translate("economy/money:TITLE", {
|
||||||
|
username: member.user.tag
|
||||||
|
}),
|
||||||
|
iconURL: member.user.displayAvatarURL()
|
||||||
|
})
|
||||||
|
.addFields([
|
||||||
|
{
|
||||||
|
name: interaction.translate("economy/profile:CASH"),
|
||||||
|
value: `**${memberData.money}** ${client.getNoun(memberData.money, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`,
|
||||||
|
inline: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: interaction.translate("economy/profile:BANK"),
|
||||||
|
value: `**${memberData.bankSold}** ${client.getNoun(memberData.bankSold, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`,
|
||||||
|
inline: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: interaction.translate("economy/profile:GLOBAL"),
|
||||||
|
value: `**${globalMoney}** ${client.getNoun(globalMoney, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`,
|
||||||
|
inline: true
|
||||||
|
}
|
||||||
|
])
|
||||||
|
.setColor(client.config.embed.color)
|
||||||
|
.setFooter({
|
||||||
|
text: client.config.embed.footer
|
||||||
|
});
|
||||||
|
interaction.editReply({
|
||||||
|
embeds: [embed]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = Money;
|
116
commands/Economy/number.js
Normal file
116
commands/Economy/number.js
Normal file
|
@ -0,0 +1,116 @@
|
||||||
|
const { SlashCommandBuilder, MessageCollector } = require("discord.js");
|
||||||
|
const BaseCommand = require("../../base/BaseCommand"),
|
||||||
|
currentGames = {};
|
||||||
|
|
||||||
|
class Number extends BaseCommand {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {import("../base/JaBa")} client
|
||||||
|
*/
|
||||||
|
constructor(client) {
|
||||||
|
super({
|
||||||
|
command: new SlashCommandBuilder()
|
||||||
|
.setName("number")
|
||||||
|
.setDescription(client.translate("economy/number:DESCRIPTION")),
|
||||||
|
aliases: [],
|
||||||
|
dirname: __dirname,
|
||||||
|
guildOnly: true,
|
||||||
|
ownerOnly: false
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {import("../../base/JaBa")} client
|
||||||
|
*/
|
||||||
|
async onLoad() {
|
||||||
|
//...
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {import("../../base/JaBa")} client
|
||||||
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
|
* @param {Object} data
|
||||||
|
*/
|
||||||
|
async execute(client, interaction, data) {
|
||||||
|
if (currentGames[interaction.guildId]) return interaction.error("economy/number:GAME_RUNNING");
|
||||||
|
|
||||||
|
const participants = [],
|
||||||
|
number = client.functions.randomNum(1000, 5000);
|
||||||
|
|
||||||
|
await interaction.replyT("economy/number:GAME_START");
|
||||||
|
|
||||||
|
const gameCreatedAt = Date.now();
|
||||||
|
|
||||||
|
const filter = m => !m.author.bot;
|
||||||
|
const collector = new MessageCollector(interaction.channel, {
|
||||||
|
filter,
|
||||||
|
time: (5 * 60 * 1000)
|
||||||
|
});
|
||||||
|
currentGames[interaction.guildId] = true;
|
||||||
|
|
||||||
|
collector.on("collect", async msg => {
|
||||||
|
if (!participants.includes(msg.author.id)) participants.push(msg.author.id);
|
||||||
|
if (msg.content === "STOP") return collector.stop("force");
|
||||||
|
if (isNaN(msg.content)) return;
|
||||||
|
|
||||||
|
const parsedNumber = parseInt(msg.content, 10);
|
||||||
|
|
||||||
|
if (parsedNumber === number) {
|
||||||
|
const time = client.convertTime(gameCreatedAt, false, false, data.guildData.language);
|
||||||
|
interaction.channel.send({
|
||||||
|
content: interaction.translate("economy/number:GAME_STATS", {
|
||||||
|
winner: msg.author.toString(),
|
||||||
|
number,
|
||||||
|
time,
|
||||||
|
participantCount: participants.length,
|
||||||
|
participants: participants.map(p => `<@${p}>`).join(", ")
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
if (participants.length > 1) {
|
||||||
|
const won = 100 * (participants.length * 0.5);
|
||||||
|
|
||||||
|
interaction.channel.send({
|
||||||
|
content: interaction.translate("economy/number:WON", {
|
||||||
|
winner: msg.author.username,
|
||||||
|
credits: `**${won}** ${client.getNoun(won, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
const memberData = await client.findOrCreateMember({
|
||||||
|
id: msg.author.id,
|
||||||
|
guildID: interaction.guildId
|
||||||
|
});
|
||||||
|
|
||||||
|
const info = {
|
||||||
|
user: interaction.translate("economy/transactions:NUMBERS"),
|
||||||
|
amount: won,
|
||||||
|
date: Date.now(),
|
||||||
|
type: "got"
|
||||||
|
};
|
||||||
|
|
||||||
|
data.memberData.transactions.push(info);
|
||||||
|
|
||||||
|
memberData.money += won;
|
||||||
|
await memberData.save();
|
||||||
|
}
|
||||||
|
collector.stop();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (parseInt(msg.content) < number) msg.reply({
|
||||||
|
content: interaction.translate("economy/number:TOO_BIG", { user: msg.author.toString(), number: parsedNumber })
|
||||||
|
});
|
||||||
|
if (parseInt(msg.content) > number) msg.reply({
|
||||||
|
content: interaction.translate("economy/number:TOO_SMALL", { user: msg.author.toString(), number: parsedNumber })
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
collector.on("end", (_collected, reason) => {
|
||||||
|
delete currentGames[interaction.guildId];
|
||||||
|
if (reason === "time") return interaction.editReply({ content: interaction.translate("economy/number:DEFEAT", { number }) });
|
||||||
|
else if (reason === "force") return interaction.editReply({ content: interaction.translate("misc:FORCE_STOP", { user: interaction.member.toString() }) });
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = Number;
|
77
commands/Economy/pay.js
Normal file
77
commands/Economy/pay.js
Normal file
|
@ -0,0 +1,77 @@
|
||||||
|
const { SlashCommandBuilder } = require("discord.js");
|
||||||
|
const BaseCommand = require("../../base/BaseCommand");
|
||||||
|
|
||||||
|
class Pay extends BaseCommand {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {import("../base/JaBa")} client
|
||||||
|
*/
|
||||||
|
constructor(client) {
|
||||||
|
super({
|
||||||
|
command: new SlashCommandBuilder()
|
||||||
|
.setName("pay")
|
||||||
|
.setDescription(client.translate("economy/pay:DESCRIPTION"))
|
||||||
|
.addUserOption(option => option.setName("user")
|
||||||
|
.setDescription(client.translate("common:USER"))
|
||||||
|
.setRequired(true))
|
||||||
|
.addIntegerOption(option => option.setName("amount")
|
||||||
|
.setDescription(client.translate("common:INT"))
|
||||||
|
.setRequired(true)),
|
||||||
|
aliases: [],
|
||||||
|
dirname: __dirname,
|
||||||
|
guildOnly: true,
|
||||||
|
ownerOnly: false
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {import("../../base/JaBa")} client
|
||||||
|
*/
|
||||||
|
async onLoad() {
|
||||||
|
//...
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {import("../../base/JaBa")} client
|
||||||
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
|
* @param {Object} data
|
||||||
|
*/
|
||||||
|
async execute(client, interaction, data) {
|
||||||
|
const member = interaction.options.getMember("user");
|
||||||
|
if (member.user.bot) return interaction.error("economy/pay:BOT_USER");
|
||||||
|
if (member.id === interaction.member.id) return interaction.error("economy/pay:YOURSELF");
|
||||||
|
const amount = interaction.options.getInteger("amount");
|
||||||
|
if (amount <= 0) return interaction.error("misc:MORE_THAN_ZERO");
|
||||||
|
|
||||||
|
|
||||||
|
if (amount > data.memberData.money) return interaction.error("economy/pay:ENOUGH_MONEY", {
|
||||||
|
amount: `**${amount}** ${client.getNoun(amount, interaction.translate("misc:NOUNS:CREDITS:1"), interaction.translate("misc:NOUNS:CREDITS:2"), interaction.translate("misc:NOUNS:CREDITS:5"))}`
|
||||||
|
});
|
||||||
|
|
||||||
|
const memberData = await client.findOrCreateMember({
|
||||||
|
id: member.id,
|
||||||
|
guildID: interaction.guildId
|
||||||
|
});
|
||||||
|
|
||||||
|
const info = {
|
||||||
|
user: member.user.tag,
|
||||||
|
amount: amount,
|
||||||
|
date: Date.now(),
|
||||||
|
type: "send"
|
||||||
|
};
|
||||||
|
|
||||||
|
data.memberData.transactions.push(info);
|
||||||
|
data.memberData.money -= amount;
|
||||||
|
await data.memberData.save();
|
||||||
|
|
||||||
|
memberData.money += amount;
|
||||||
|
memberData.save();
|
||||||
|
|
||||||
|
interaction.success("economy/pay:SUCCESS", {
|
||||||
|
user: member.toString(),
|
||||||
|
amount: `**${amount}** ${client.getNoun(amount, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = Pay;
|
151
commands/Economy/profile.js
Normal file
151
commands/Economy/profile.js
Normal file
|
@ -0,0 +1,151 @@
|
||||||
|
const { SlashCommandBuilder, EmbedBuilder } = require("discord.js");
|
||||||
|
const BaseCommand = require("../../base/BaseCommand");
|
||||||
|
const asyncForEach = async (collection, callback) => {
|
||||||
|
const allPromises = collection.map(async key => {
|
||||||
|
await callback(key);
|
||||||
|
});
|
||||||
|
|
||||||
|
return await Promise.all(allPromises);
|
||||||
|
};
|
||||||
|
|
||||||
|
class Profile extends BaseCommand {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {import("../base/JaBa")} client
|
||||||
|
*/
|
||||||
|
constructor(client) {
|
||||||
|
super({
|
||||||
|
command: new SlashCommandBuilder()
|
||||||
|
.setName("profile")
|
||||||
|
.setDescription(client.translate("economy/profile:DESCRIPTION"))
|
||||||
|
.addUserOption(option => option.setName("user")
|
||||||
|
.setDescription(client.translate("common:USER"))),
|
||||||
|
aliases: [],
|
||||||
|
dirname: __dirname,
|
||||||
|
guildOnly: true,
|
||||||
|
ownerOnly: false
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {import("../../base/JaBa")} client
|
||||||
|
*/
|
||||||
|
async onLoad() {
|
||||||
|
//...
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {import("../../base/JaBa")} client
|
||||||
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
|
* @param {Object} data
|
||||||
|
*/
|
||||||
|
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");
|
||||||
|
|
||||||
|
const memberData = (member.id === interaction.user.id ? data.memberData : await client.findOrCreateMember({
|
||||||
|
id: member.id,
|
||||||
|
guildID: interaction.guildId
|
||||||
|
}));
|
||||||
|
const userData = (member.id === interaction.user.id ? data.userData : await client.findOrCreateUser({
|
||||||
|
id: member.id
|
||||||
|
}));
|
||||||
|
if (userData.lover && !client.users.cache.find(u => u.id === userData.lover)) await client.users.fetch(userData.lover, true);
|
||||||
|
|
||||||
|
const guilds = client.guilds.cache.filter(g => g.members.cache.find(m => m.id === member.id));
|
||||||
|
let globalMoney = 0;
|
||||||
|
await asyncForEach(guilds, async guild => {
|
||||||
|
const data = await client.findOrCreateMember({
|
||||||
|
id: member.id,
|
||||||
|
guildID: guild.id
|
||||||
|
});
|
||||||
|
globalMoney += data.money + data.bankSold;
|
||||||
|
});
|
||||||
|
|
||||||
|
const profileEmbed = new EmbedBuilder()
|
||||||
|
.setAuthor({
|
||||||
|
name: interaction.translate("economy/profile:TITLE", {
|
||||||
|
username: member.user.tag
|
||||||
|
}),
|
||||||
|
iconURL: member.displayAvatarURL()
|
||||||
|
})
|
||||||
|
.setImage("attachment://achievements.png")
|
||||||
|
.addFields([
|
||||||
|
{
|
||||||
|
name: client.customEmojis.link + " " + interaction.translate("economy/profile:LINK"),
|
||||||
|
value: `[${interaction.translate("economy/profile:LINK_TEXT")}](${client.config.dashboard.baseURL}/user/${member.user.id}/${interaction.guild.id})`
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: interaction.translate("economy/profile:BIO"),
|
||||||
|
value: userData.bio ? userData.bio : interaction.translate("common:UNKNOWN")
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: interaction.translate("economy/profile:CASH"),
|
||||||
|
value: `**${memberData.money}** ${client.getNoun(memberData.money, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`,
|
||||||
|
inline: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: interaction.translate("economy/profile:BANK"),
|
||||||
|
value: `**${memberData.bankSold}** ${client.getNoun(memberData.bankSold, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`,
|
||||||
|
inline: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: interaction.translate("economy/profile:GLOBAL"),
|
||||||
|
value: `**${globalMoney}** ${client.getNoun(globalMoney, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`,
|
||||||
|
inline: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: interaction.translate("economy/profile:REPUTATION"),
|
||||||
|
value: `**${userData.rep}** ${client.getNoun(userData.rep, interaction.translate("misc:NOUNS:POINTS:1"), interaction.translate("misc:NOUNS:POINTS:2"), interaction.translate("misc:NOUNS:POINTS:5"))}`,
|
||||||
|
inline: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: interaction.translate("economy/profile:LEVEL"),
|
||||||
|
value:`**${memberData.level}**`,
|
||||||
|
inline: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: interaction.translate("economy/profile:XP"),
|
||||||
|
value: `**${memberData.exp}/${5 * (memberData.level * memberData.level) + 80 * memberData.level + 100}** xp`,
|
||||||
|
inline: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: interaction.translate("economy/profile:REGISTERED"),
|
||||||
|
value: client.printDate(new Date(memberData.registeredAt)),
|
||||||
|
inline: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: interaction.translate("economy/profile:BIRTHDATE"),
|
||||||
|
value: (!userData.birthdate ? interaction.translate("common:NOT_DEFINED") : client.printDate(new Date(userData.birthdate))),
|
||||||
|
inline: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: interaction.translate("economy/profile:LOVER"),
|
||||||
|
value: (!userData.lover ? interaction.translate("common:NOT_DEFINED") : client.users.cache.get(userData.lover).tag),
|
||||||
|
inline: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: interaction.translate("economy/profile:ACHIEVEMENTS"),
|
||||||
|
value: interaction.translate("economy/profile:ACHIEVEMENTS_CONTENT")
|
||||||
|
}
|
||||||
|
])
|
||||||
|
.setColor(client.config.embed.color)
|
||||||
|
.setFooter({
|
||||||
|
text: client.config.embed.footer
|
||||||
|
})
|
||||||
|
.setTimestamp();
|
||||||
|
|
||||||
|
const buffer = await userData.getAchievements();
|
||||||
|
|
||||||
|
interaction.editReply({
|
||||||
|
embeds: [profileEmbed],
|
||||||
|
files: [{
|
||||||
|
name: "achievements.png",
|
||||||
|
attachment: buffer
|
||||||
|
}]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = Profile;
|
81
commands/Economy/rep.js
Normal file
81
commands/Economy/rep.js
Normal file
|
@ -0,0 +1,81 @@
|
||||||
|
const { SlashCommandBuilder } = require("discord.js");
|
||||||
|
const BaseCommand = require("../../base/BaseCommand");
|
||||||
|
|
||||||
|
class Rep extends BaseCommand {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {import("../base/JaBa")} client
|
||||||
|
*/
|
||||||
|
constructor(client) {
|
||||||
|
super({
|
||||||
|
command: new SlashCommandBuilder()
|
||||||
|
.setName("rep")
|
||||||
|
.setDescription(client.translate("economy/rep:DESCRIPTION"))
|
||||||
|
.addUserOption(option => option.setName("user")
|
||||||
|
.setDescription(client.translate("common:USER"))
|
||||||
|
.setRequired(true)),
|
||||||
|
aliases: [],
|
||||||
|
dirname: __dirname,
|
||||||
|
guildOnly: true,
|
||||||
|
ownerOnly: false
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {import("../../base/JaBa")} client
|
||||||
|
*/
|
||||||
|
async onLoad() {
|
||||||
|
//...
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {import("../../base/JaBa")} client
|
||||||
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
|
* @param {Object} data
|
||||||
|
*/
|
||||||
|
async execute(client, interaction, data) {
|
||||||
|
const isInCooldown = data.userData.cooldowns?.rep;
|
||||||
|
if (isInCooldown) {
|
||||||
|
if (isInCooldown > Date.now()) return interaction.error("economy/rep:COOLDOWN", {
|
||||||
|
time: client.convertTime(isInCooldown, true, true)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const user = interaction.options.getUser("user");
|
||||||
|
if (user.bot) return interaction.error("economy/rep:BOT_USER");
|
||||||
|
if (user.id === interaction.user.id) return interaction.error("economy/rep:YOURSELF");
|
||||||
|
|
||||||
|
const toWait = Date.now() + 21600000; // 12 hours
|
||||||
|
if (!data.userData.cooldowns) data.userData.cooldowns = {};
|
||||||
|
data.userData.cooldowns.rep = toWait;
|
||||||
|
data.userData.markModified("cooldowns");
|
||||||
|
await data.userData.save();
|
||||||
|
|
||||||
|
const userData = await client.findOrCreateUser({
|
||||||
|
id: user.id
|
||||||
|
});
|
||||||
|
userData.rep++;
|
||||||
|
|
||||||
|
if (!userData.achievements.rep.achieved) {
|
||||||
|
userData.achievements.rep.progress.now = (userData.rep > userData.achievements.rep.progress.total ? userData.achievements.rep.progress.total : userData.rep);
|
||||||
|
if (userData.achievements.rep.progress.now >= userData.achievements.rep.progress.total) {
|
||||||
|
userData.achievements.rep.achieved = true;
|
||||||
|
interaction.followUp({
|
||||||
|
content: `${user}`,
|
||||||
|
files: [{
|
||||||
|
name: "achievement_unlocked6.png",
|
||||||
|
attachment: "./assets/img/achievements/achievement_unlocked6.png"
|
||||||
|
}]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
userData.markModified("achievements.rep");
|
||||||
|
}
|
||||||
|
await userData.save();
|
||||||
|
|
||||||
|
interaction.success("economy/rep:SUCCESS", {
|
||||||
|
user: user.toString()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = Rep;
|
94
commands/Economy/rob.js
Normal file
94
commands/Economy/rob.js
Normal file
|
@ -0,0 +1,94 @@
|
||||||
|
const { SlashCommandBuilder } = require("discord.js");
|
||||||
|
const BaseCommand = require("../../base/BaseCommand");
|
||||||
|
|
||||||
|
class Rob extends BaseCommand {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {import("../base/JaBa")} client
|
||||||
|
*/
|
||||||
|
constructor(client) {
|
||||||
|
super({
|
||||||
|
command: new SlashCommandBuilder()
|
||||||
|
.setName("rob")
|
||||||
|
.setDescription(client.translate("economy/rob:DESCRIPTION"))
|
||||||
|
.addUserOption(option => option.setName("user")
|
||||||
|
.setDescription(client.translate("common:USER"))
|
||||||
|
.setRequired(true))
|
||||||
|
.addIntegerOption(option => option.setName("amount")
|
||||||
|
.setDescription(client.translate("common:INT"))
|
||||||
|
.setRequired(true)),
|
||||||
|
aliases: [],
|
||||||
|
dirname: __dirname,
|
||||||
|
guildOnly: true,
|
||||||
|
ownerOnly: false
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {import("../../base/JaBa")} client
|
||||||
|
*/
|
||||||
|
async onLoad() {
|
||||||
|
//...
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {import("../../base/JaBa")} client
|
||||||
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
|
* @param {Object} data
|
||||||
|
*/
|
||||||
|
async execute(client, interaction, data) {
|
||||||
|
const member = interaction.options.getMember("user");
|
||||||
|
if (member.user.bot) return interaction.error("economy/pay:BOT_USER");
|
||||||
|
if (member.id === interaction.member.id) return interaction.error("economy/rob:YOURSELF");
|
||||||
|
const amount = interaction.options.getInteger("amount");
|
||||||
|
if (amount <= 0) return interaction.error("misc:MORE_THAN_ZERO");
|
||||||
|
|
||||||
|
const memberData = await client.findOrCreateMember({
|
||||||
|
id: member.id,
|
||||||
|
guildID: interaction.guildId
|
||||||
|
});
|
||||||
|
if (amount > memberData.money) return interaction.error("economy/rob:NOT_ENOUGH_MEMBER", { user: member.toString() });
|
||||||
|
const isInCooldown = memberData.cooldowns.rob || 0;
|
||||||
|
if (isInCooldown) {
|
||||||
|
if (isInCooldown > Date.now()) return interaction.error("economy/rob:COOLDOWN", { user: member.toString() });
|
||||||
|
}
|
||||||
|
|
||||||
|
const potentiallyLose = Math.floor(amount * 1.5);
|
||||||
|
if (potentiallyLose > data.memberData.money) return interaction.error("economy/rob:NOT_ENOUGH_AUTHOR", {
|
||||||
|
moneyMin: `**${potentiallyLose}** ${client.getNoun(potentiallyLose, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`,
|
||||||
|
moneyCurrent: `**${data.memberData.money}** ${client.getNoun(data.memberData.money, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`
|
||||||
|
});
|
||||||
|
|
||||||
|
const itsAWon = Math.floor(client.functions.randomNum(0, 100) < 25);
|
||||||
|
|
||||||
|
if (itsAWon) {
|
||||||
|
const toWait = Date.now() + (6 * 60 * 60 * 1000);
|
||||||
|
memberData.cooldowns.rob = toWait;
|
||||||
|
memberData.markModified("cooldowns");
|
||||||
|
await memberData.save();
|
||||||
|
const randomNum = client.functions.randomNum(1, 2);
|
||||||
|
interaction.replyT("economy/rob:ROB_WON_" + randomNum, {
|
||||||
|
money: `**${amount}** ${client.getNoun(amount, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`,
|
||||||
|
user: member.toString()
|
||||||
|
});
|
||||||
|
data.memberData.money += amount;
|
||||||
|
memberData.money -= amount;
|
||||||
|
await memberData.save();
|
||||||
|
await data.memberData.save();
|
||||||
|
} else {
|
||||||
|
const won = Math.floor(amount * 0.9);
|
||||||
|
const randomNum = client.functions.randomNum(1, 2);
|
||||||
|
interaction.replyT("economy/rob:ROB_LOSE_" + randomNum, {
|
||||||
|
fine: `**${potentiallyLose}** ${client.getNoun(potentiallyLose, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`,
|
||||||
|
offset: `**${won}** ${client.getNoun(won, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`,
|
||||||
|
user: member.toString()
|
||||||
|
});
|
||||||
|
data.memberData.money -= potentiallyLose;
|
||||||
|
memberData.money += won;
|
||||||
|
await memberData.save();
|
||||||
|
await data.memberData.save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = Rob;
|
46
commands/Economy/setbio.js
Normal file
46
commands/Economy/setbio.js
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
const { SlashCommandBuilder } = require("discord.js");
|
||||||
|
const BaseCommand = require("../../base/BaseCommand");
|
||||||
|
|
||||||
|
class Setbio extends BaseCommand {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {import("../base/JaBa")} client
|
||||||
|
*/
|
||||||
|
constructor(client) {
|
||||||
|
super({
|
||||||
|
command: new SlashCommandBuilder()
|
||||||
|
.setName("setbio")
|
||||||
|
.setDescription(client.translate("economy/setbio:DESCRIPTION"))
|
||||||
|
.addStringOption(option => option.setName("text")
|
||||||
|
.setDescription(client.translate("economy/profile:BIO"))
|
||||||
|
.setRequired(true)),
|
||||||
|
aliases: [],
|
||||||
|
dirname: __dirname,
|
||||||
|
guildOnly: true,
|
||||||
|
ownerOnly: false
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {import("../../base/JaBa")} client
|
||||||
|
*/
|
||||||
|
async onLoad() {
|
||||||
|
//...
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {import("../../base/JaBa")} client
|
||||||
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
|
* @param {Object} data
|
||||||
|
*/
|
||||||
|
async execute(client, interaction, data) {
|
||||||
|
const newBio = interaction.options.getString("text");
|
||||||
|
if (newBio.length > 150) return interaction.error("economy/setbio:MAX_CHARACTERS");
|
||||||
|
|
||||||
|
data.userData.bio = newBio;
|
||||||
|
await data.userData.save();
|
||||||
|
interaction.success("economy/setbio:SUCCESS");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = Setbio;
|
|
@ -1,42 +1,55 @@
|
||||||
const Command = require("../../base/Command");
|
const { SlashCommandBuilder } = require("discord.js");
|
||||||
|
const BaseCommand = require("../../base/BaseCommand");
|
||||||
|
|
||||||
class Slots extends Command {
|
class Slots extends BaseCommand {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {import("../base/JaBa")} client
|
||||||
|
*/
|
||||||
constructor(client) {
|
constructor(client) {
|
||||||
super(client, {
|
super({
|
||||||
name: "slots",
|
command: new SlashCommandBuilder()
|
||||||
|
.setName("slots")
|
||||||
|
.setDescription(client.translate("economy/slots:DESCRIPTION"))
|
||||||
|
.addIntegerOption(option => option.setName("amount")
|
||||||
|
.setDescription(client.translate("common:INT"))
|
||||||
|
.setRequired(true)),
|
||||||
|
aliases: [],
|
||||||
dirname: __dirname,
|
dirname: __dirname,
|
||||||
enabled: true,
|
|
||||||
guildOnly: true,
|
guildOnly: true,
|
||||||
aliases: ["casino", "slot"],
|
ownerOnly: false
|
||||||
memberPermissions: [],
|
|
||||||
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
|
|
||||||
nsfw: false,
|
|
||||||
ownerOnly: false,
|
|
||||||
cooldown: 2000
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {import("../../base/JaBa")} client
|
||||||
|
*/
|
||||||
|
async onLoad() {
|
||||||
|
//...
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {import("../../base/JaBa")} client
|
||||||
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
|
* @param {Object} data
|
||||||
|
*/
|
||||||
|
async execute(client, interaction, data) {
|
||||||
|
await interaction.deferReply();
|
||||||
|
const amount = interaction.options.getInteger("amount");
|
||||||
|
if (amount > data.memberData.money) return interaction.error("economy/slots:NOT_ENOUGH", { money: `**${amount}** ${client.getNoun(amount, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}` });
|
||||||
|
|
||||||
async run(message, args, data) {
|
|
||||||
const fruits = ["🍎", "🍐", "🍌", "🍇", "🍉", "🍒", "🍓"];
|
const fruits = ["🍎", "🍐", "🍌", "🍇", "🍉", "🍒", "🍓"];
|
||||||
|
|
||||||
let i1 = 0, j1 = 0, k1 = 0,
|
let i1 = 0, j1 = 0, k1 = 0,
|
||||||
i2 = 1, j2 = 1, k2 = 1,
|
i2 = 1, j2 = 1, k2 = 1,
|
||||||
i3 = 2, j3 = 2, k3 = 2;
|
i3 = 2, j3 = 2, k3 = 2;
|
||||||
|
|
||||||
// Gets three random fruits array
|
|
||||||
const colonnes = [
|
const colonnes = [
|
||||||
this.client.functions.shuffle(fruits),
|
client.functions.shuffle(fruits),
|
||||||
this.client.functions.shuffle(fruits),
|
client.functions.shuffle(fruits),
|
||||||
this.client.functions.shuffle(fruits)
|
client.functions.shuffle(fruits)
|
||||||
];
|
];
|
||||||
|
|
||||||
// Gets the amount provided
|
|
||||||
let amount = args[0];
|
|
||||||
if (!amount || isNaN(amount) || amount < 1) amount = 50;
|
|
||||||
if (amount > data.memberData.money) return message.error("economy/slots:NOT_ENOUGH", { money: `**${amount}** ${message.getNoun(amount, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}` });
|
|
||||||
|
|
||||||
amount = Math.round(amount);
|
|
||||||
|
|
||||||
function getCredits(number, isJackpot) {
|
function getCredits(number, isJackpot) {
|
||||||
if (!isJackpot) number = number * 1.5;
|
if (!isJackpot) number = number * 1.5;
|
||||||
else if (isJackpot) number = number * 5;
|
else if (isJackpot) number = number * 5;
|
||||||
|
@ -44,16 +57,13 @@ class Slots extends Command {
|
||||||
return Math.round(number);
|
return Math.round(number);
|
||||||
}
|
}
|
||||||
|
|
||||||
const tmsg = await message.sendT("misc:PLEASE_WAIT", null, {
|
|
||||||
prefixEmoji: "loading"
|
|
||||||
});
|
|
||||||
editMsg();
|
editMsg();
|
||||||
|
|
||||||
const interval = setInterval(editMsg, 1000);
|
const interval = setInterval(editMsg, 1000);
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
clearInterval(interval);
|
clearInterval(interval);
|
||||||
end(tmsg);
|
end();
|
||||||
}, 4000);
|
}, 4000);
|
||||||
|
|
||||||
async function end() {
|
async function end() {
|
||||||
|
@ -74,34 +84,36 @@ class Slots extends Command {
|
||||||
msg += colonnes[0][i3] + " : " + colonnes[1][j3] + " : " + colonnes[2][k3] + "\n------------------\n";
|
msg += colonnes[0][i3] + " : " + colonnes[1][j3] + " : " + colonnes[2][k3] + "\n------------------\n";
|
||||||
|
|
||||||
if ((colonnes[0][i2] == colonnes[1][j2]) && (colonnes[1][j2] == colonnes[2][k2])) {
|
if ((colonnes[0][i2] == colonnes[1][j2]) && (colonnes[1][j2] == colonnes[2][k2])) {
|
||||||
msg += "| : : : **" + (message.translate("common:VICTORY").toUpperCase()) + "** : : : |";
|
msg += "| : : : **" + (interaction.translate("common:VICTORY").toUpperCase()) + "** : : : |";
|
||||||
tmsg.edit(msg);
|
await interaction.editReply({
|
||||||
|
content: msg
|
||||||
|
});
|
||||||
|
|
||||||
const credits = getCredits(amount, true);
|
const credits = getCredits(amount, true);
|
||||||
message.channel.send({
|
interaction.followUp({
|
||||||
content: "**!! ДЖЕКПОТ !!**\n" + message.translate("economy/slots:VICTORY", {
|
content: "**!! ДЖЕКПОТ !!**\n" + interaction.translate("economy/slots:VICTORY", {
|
||||||
money: `**${amount}** ${message.getNoun(amount, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}`,
|
money: `**${amount}** ${client.getNoun(amount, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`,
|
||||||
won: `**${credits}** ${message.getNoun(credits, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}`,
|
won: `**${credits}** ${client.getNoun(credits, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`,
|
||||||
username: message.author.username
|
user: interaction.member.toString()
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
const toAdd = credits - amount;
|
const toAdd = credits - amount;
|
||||||
|
|
||||||
const info = {
|
const info = {
|
||||||
user: message.translate("economy/slots:DESCRIPTION"),
|
user: interaction.translate("economy/slots:DESCRIPTION"),
|
||||||
amount: toAdd,
|
amount: toAdd,
|
||||||
date: Date.now(),
|
date: Date.now(),
|
||||||
type: "got"
|
type: "got"
|
||||||
};
|
};
|
||||||
|
|
||||||
data.memberData.transactions.push(info);
|
data.memberData.transactions.push(info);
|
||||||
|
data.memberData.money += toAdd;
|
||||||
|
|
||||||
data.memberData.money = data.memberData.money + toAdd;
|
|
||||||
if (!data.userData.achievements.slots.achieved) {
|
if (!data.userData.achievements.slots.achieved) {
|
||||||
data.userData.achievements.slots.progress.now += 1;
|
data.userData.achievements.slots.progress.now += 1;
|
||||||
if (data.userData.achievements.slots.progress.now === data.userData.achievements.slots.progress.total) {
|
if (data.userData.achievements.slots.progress.now === data.userData.achievements.slots.progress.total) {
|
||||||
data.userData.achievements.slots.achieved = true;
|
data.userData.achievements.slots.achieved = true;
|
||||||
message.reply({
|
interaction.followUp({
|
||||||
files: [{
|
files: [{
|
||||||
name: "achievement_unlocked4.png",
|
name: "achievement_unlocked4.png",
|
||||||
attachment: "./assets/img/achievements/achievement_unlocked4.png"
|
attachment: "./assets/img/achievements/achievement_unlocked4.png"
|
||||||
|
@ -116,33 +128,35 @@ class Slots extends Command {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (colonnes[0][i2] == colonnes[1][j2] || colonnes[1][j2] == colonnes[2][k2] || colonnes[0][i2] == colonnes[2][k2]) {
|
if (colonnes[0][i2] == colonnes[1][j2] || colonnes[1][j2] == colonnes[2][k2] || colonnes[0][i2] == colonnes[2][k2]) {
|
||||||
msg += "| : : : **" + (message.translate("common:VICTORY").toUpperCase()) + "** : : : |";
|
msg += "| : : : **" + (interaction.translate("common:VICTORY").toUpperCase()) + "** : : : |";
|
||||||
tmsg.edit(msg);
|
await interaction.editReply({
|
||||||
|
content: msg
|
||||||
|
});
|
||||||
|
|
||||||
const credits = getCredits(amount, false);
|
const credits = getCredits(amount, false);
|
||||||
message.channel.send({
|
interaction.followUp({
|
||||||
content: message.translate("economy/slots:VICTORY", {
|
content: interaction.translate("economy/slots:VICTORY", {
|
||||||
money: `**${amount}** ${message.getNoun(amount, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}`,
|
money: `**${amount}** ${client.getNoun(amount, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`,
|
||||||
won: `**${credits}** ${message.getNoun(credits, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}`,
|
won: `**${credits}** ${client.getNoun(credits, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`,
|
||||||
username: message.author.username
|
user: interaction.member.toString()
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
const toAdd = credits - amount;
|
const toAdd = credits - amount;
|
||||||
|
|
||||||
const info = {
|
const info = {
|
||||||
user: message.translate("economy/slots:DESCRIPTION"),
|
user: interaction.translate("economy/slots:DESCRIPTION"),
|
||||||
amount: toAdd,
|
amount: toAdd,
|
||||||
date: Date.now(),
|
date: Date.now(),
|
||||||
type: "got"
|
type: "got"
|
||||||
};
|
};
|
||||||
|
|
||||||
data.memberData.transactions.push(info);
|
data.memberData.transactions.push(info);
|
||||||
|
data.memberData.money += toAdd;
|
||||||
|
|
||||||
data.memberData.money = data.memberData.money + toAdd;
|
|
||||||
if (!data.userData.achievements.slots.achieved) {
|
if (!data.userData.achievements.slots.achieved) {
|
||||||
data.userData.achievements.slots.progress.now += 1;
|
data.userData.achievements.slots.progress.now += 1;
|
||||||
if (data.userData.achievements.slots.progress.now === data.userData.achievements.slots.progress.total) {
|
if (data.userData.achievements.slots.progress.now === data.userData.achievements.slots.progress.total) {
|
||||||
data.userData.achievements.slots.achieved = true;
|
data.userData.achievements.slots.achieved = true;
|
||||||
message.reply({
|
interaction.followUp({
|
||||||
files: [{
|
files: [{
|
||||||
name: "achievement_unlocked4.png",
|
name: "achievement_unlocked4.png",
|
||||||
attachment: "./assets/img/achievements/achievement_unlocked4.png"
|
attachment: "./assets/img/achievements/achievement_unlocked4.png"
|
||||||
|
@ -156,24 +170,23 @@ class Slots extends Command {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
msg += "| : : : **" + (message.translate("common:DEFEAT").toUpperCase()) + "** : : : |";
|
msg += "| : : : **" + (interaction.translate("common:DEFEAT").toUpperCase()) + "** : : : |";
|
||||||
message.channel.send({
|
interaction.followUp({
|
||||||
content: message.translate("economy/slots:DEFEAT", {
|
content: interaction.translate("economy/slots:DEFEAT", {
|
||||||
money: `**${amount}** ${message.getNoun(amount, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}`,
|
money: `**${amount}** ${client.getNoun(amount, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`,
|
||||||
username: message.author.username
|
user: interaction.member.toString()
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
const info = {
|
const info = {
|
||||||
user: message.translate("economy/slots:DESCRIPTION"),
|
user: interaction.translate("economy/slots:DESCRIPTION"),
|
||||||
amount: amount,
|
amount: amount,
|
||||||
date: Date.now(),
|
date: Date.now(),
|
||||||
type: "send"
|
type: "send"
|
||||||
};
|
};
|
||||||
|
|
||||||
data.memberData.transactions.push(info);
|
data.memberData.transactions.push(info);
|
||||||
|
data.memberData.money -= amount;
|
||||||
|
|
||||||
data.memberData.money = data.memberData.money - amount;
|
|
||||||
if (!data.userData.achievements.slots.achieved) {
|
if (!data.userData.achievements.slots.achieved) {
|
||||||
data.userData.achievements.slots.progress.now = 0;
|
data.userData.achievements.slots.progress.now = 0;
|
||||||
data.userData.markModified("achievements.slots");
|
data.userData.markModified("achievements.slots");
|
||||||
|
@ -183,7 +196,7 @@ class Slots extends Command {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
function editMsg() {
|
async function editMsg() {
|
||||||
let msg = "[ :slot_machine: | **СЛОТЫ** ]\n------------------\n";
|
let msg = "[ :slot_machine: | **СЛОТЫ** ]\n------------------\n";
|
||||||
|
|
||||||
i1 = (i1 < fruits.length - 1) ? i1 + 1 : 0;
|
i1 = (i1 < fruits.length - 1) ? i1 + 1 : 0;
|
||||||
|
@ -200,7 +213,9 @@ class Slots extends Command {
|
||||||
msg += colonnes[0][i2] + " : " + colonnes[1][j2] + " : " + colonnes[2][k2] + " **<**\n";
|
msg += colonnes[0][i2] + " : " + colonnes[1][j2] + " : " + colonnes[2][k2] + " **<**\n";
|
||||||
msg += colonnes[0][i3] + " : " + colonnes[1][j3] + " : " + colonnes[2][k3] + "\n";
|
msg += colonnes[0][i3] + " : " + colonnes[1][j3] + " : " + colonnes[2][k3] + "\n";
|
||||||
|
|
||||||
tmsg.edit(msg);
|
await interaction.editReply({
|
||||||
|
content: msg
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
62
commands/Economy/tictactoe.js
Normal file
62
commands/Economy/tictactoe.js
Normal file
|
@ -0,0 +1,62 @@
|
||||||
|
const { SlashCommandBuilder } = require("discord.js");
|
||||||
|
const BaseCommand = require("../../base/BaseCommand"),
|
||||||
|
tictactoe = require("../../helpers/tictactoe");
|
||||||
|
|
||||||
|
class TicTacToe extends BaseCommand {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {import("../base/JaBa")} client
|
||||||
|
*/
|
||||||
|
constructor(client) {
|
||||||
|
super({
|
||||||
|
command: new SlashCommandBuilder()
|
||||||
|
.setName("tictactoe")
|
||||||
|
.setDescription(client.translate("economy/tictactoe:DESCRIPTION"))
|
||||||
|
.addUserOption(option => option.setName("user")
|
||||||
|
.setDescription(client.translate("common:USER"))
|
||||||
|
.setRequired(true)),
|
||||||
|
aliases: [],
|
||||||
|
dirname: __dirname,
|
||||||
|
guildOnly: true,
|
||||||
|
ownerOnly: false
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {import("../../base/JaBa")} client
|
||||||
|
*/
|
||||||
|
async onLoad() {
|
||||||
|
//...
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {import("../../base/JaBa")} client
|
||||||
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
|
* @param {Object} data
|
||||||
|
*/
|
||||||
|
async execute(client, interaction) {
|
||||||
|
tictactoe(interaction, {
|
||||||
|
resultBtn: true,
|
||||||
|
embedColor: client.config.embed.color,
|
||||||
|
embedFoot: client.config.embed.footer
|
||||||
|
}).then(async winner => {
|
||||||
|
const memberData = await client.findOrCreateMember({
|
||||||
|
id: winner.id,
|
||||||
|
guildID: interaction.guildId
|
||||||
|
});
|
||||||
|
|
||||||
|
const info = {
|
||||||
|
user: interaction.translate("economy/transactions:TTT"),
|
||||||
|
amount: 100,
|
||||||
|
date: Date.now(),
|
||||||
|
type: "got"
|
||||||
|
};
|
||||||
|
memberData.transactions.push(info);
|
||||||
|
|
||||||
|
memberData.money += 100;
|
||||||
|
await memberData.save();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = TicTacToe;
|
77
commands/Economy/transactions.js
Normal file
77
commands/Economy/transactions.js
Normal file
|
@ -0,0 +1,77 @@
|
||||||
|
const { SlashCommandBuilder, EmbedBuilder } = require("discord.js");
|
||||||
|
const BaseCommand = require("../../base/BaseCommand");
|
||||||
|
|
||||||
|
class Transactions extends BaseCommand {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {import("../base/JaBa")} client
|
||||||
|
*/
|
||||||
|
constructor(client) {
|
||||||
|
super({
|
||||||
|
command: new SlashCommandBuilder()
|
||||||
|
.setName("transactions")
|
||||||
|
.setDescription(client.translate("economy/transactions:DESCRIPTION")),
|
||||||
|
aliases: [],
|
||||||
|
dirname: __dirname,
|
||||||
|
guildOnly: true,
|
||||||
|
ownerOnly: false
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {import("../../base/JaBa")} client
|
||||||
|
*/
|
||||||
|
async onLoad() {
|
||||||
|
//...
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {import("../../base/JaBa")} client
|
||||||
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
|
* @param {Object} data
|
||||||
|
*/
|
||||||
|
async execute(client, interaction, data) {
|
||||||
|
const embed = new EmbedBuilder()
|
||||||
|
.setAuthor({
|
||||||
|
name: interaction.translate("economy/transactions:EMBED_TRANSACTIONS"),
|
||||||
|
iconURL: interaction.member.displayAvatarURL()
|
||||||
|
})
|
||||||
|
.setColor(client.config.embed.color)
|
||||||
|
.setFooter({
|
||||||
|
text: client.config.embed.footer
|
||||||
|
});
|
||||||
|
|
||||||
|
const transactions = data.memberData.transactions,
|
||||||
|
sortedTransactions = [ [], [] ];
|
||||||
|
|
||||||
|
transactions.slice(-20).forEach(t => {
|
||||||
|
const array = t.type === "got" ? sortedTransactions[0] : sortedTransactions[1];
|
||||||
|
array.push(`${interaction.translate("economy/transactions:T_USER_" + t.type.toUpperCase())}: ${t.user}\n${interaction.translate("economy/transactions:T_AMOUNT")}: ${t.amount}\n${interaction.translate("economy/transactions:T_DATE")}: ${client.printDate(t.date, "Do MMMM YYYY, HH:mm", data.guildData.language)}\n`);
|
||||||
|
});
|
||||||
|
|
||||||
|
if (transactions.length < 1) {
|
||||||
|
embed.setDescription(interaction.translate("economy/transactions:NO_TRANSACTIONS"));
|
||||||
|
} else {
|
||||||
|
if (sortedTransactions[0].length > 0) embed.addFields([
|
||||||
|
{
|
||||||
|
name: interaction.translate("economy/transactions:T_GOT"),
|
||||||
|
value: sortedTransactions[0].join("\n"),
|
||||||
|
inline: true
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
if (sortedTransactions[1].length > 0) embed.addFields([
|
||||||
|
{
|
||||||
|
name: interaction.translate("economy/transactions:T_SEND"),
|
||||||
|
value: sortedTransactions[1].join("\n"),
|
||||||
|
inline: true
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
interaction.reply({
|
||||||
|
embeds: [embed]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = Transactions;
|
132
commands/Economy/work.js
Normal file
132
commands/Economy/work.js
Normal file
|
@ -0,0 +1,132 @@
|
||||||
|
const { SlashCommandBuilder, EmbedBuilder, parseEmoji } = require("discord.js");
|
||||||
|
const BaseCommand = require("../../base/BaseCommand");
|
||||||
|
|
||||||
|
class Work extends BaseCommand {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {import("../base/JaBa")} client
|
||||||
|
*/
|
||||||
|
constructor(client) {
|
||||||
|
super({
|
||||||
|
command: new SlashCommandBuilder()
|
||||||
|
.setName("work")
|
||||||
|
.setDescription(client.translate("economy/work:DESCRIPTION")),
|
||||||
|
aliases: [],
|
||||||
|
dirname: __dirname,
|
||||||
|
guildOnly: true,
|
||||||
|
ownerOnly: false
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {import("../../base/JaBa")} client
|
||||||
|
*/
|
||||||
|
async onLoad() {
|
||||||
|
//...
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {import("../../base/JaBa")} client
|
||||||
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
|
* @param {Object} data
|
||||||
|
*/
|
||||||
|
async execute(client, interaction, data) {
|
||||||
|
const isInCooldown = data.memberData.cooldowns?.work;
|
||||||
|
if (isInCooldown) {
|
||||||
|
if (isInCooldown > Date.now()) return interaction.error("economy/work:COOLDOWN", {
|
||||||
|
time: client.convertTime(isInCooldown, true, true)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (Date.now() > data.memberData.cooldowns.work + (24 * 3600000)) data.memberData.workStreak = 0;
|
||||||
|
|
||||||
|
const toWait = Date.now() + 43200000; // 24 hours
|
||||||
|
data.memberData.cooldowns.work = toWait;
|
||||||
|
data.memberData.markModified("cooldowns");
|
||||||
|
|
||||||
|
data.memberData.workStreak = (data.memberData.workStreak || 0) + 1;
|
||||||
|
await data.memberData.save();
|
||||||
|
|
||||||
|
const embed = new EmbedBuilder()
|
||||||
|
.setFooter({
|
||||||
|
text: interaction.translate("economy/work:AWARD"),
|
||||||
|
iconURL: interaction.member.displayAvatarURL()
|
||||||
|
})
|
||||||
|
.setColor(client.config.embed.color);
|
||||||
|
|
||||||
|
const award = [
|
||||||
|
client.customEmojis.letters.a,
|
||||||
|
client.customEmojis.letters.w,
|
||||||
|
client.customEmojis.letters.a,
|
||||||
|
client.customEmojis.letters.r,
|
||||||
|
client.customEmojis.letters.d
|
||||||
|
];
|
||||||
|
let won = 200;
|
||||||
|
|
||||||
|
if (data.memberData.workStreak >= 5) {
|
||||||
|
won += 200;
|
||||||
|
embed.addFields([
|
||||||
|
{
|
||||||
|
name: interaction.translate("economy/work:SALARY"),
|
||||||
|
value: interaction.translate("economy/work:SALARY_CONTENT", {
|
||||||
|
won: `**${won}** ${client.getNoun(won, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`
|
||||||
|
})
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: interaction.translate("economy/work:STREAK"),
|
||||||
|
value: interaction.translate("economy/work:STREAK_CONTENT")
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
data.memberData.workStreak = 0;
|
||||||
|
} else {
|
||||||
|
for (let i = 0; i < award.length; i++) {
|
||||||
|
if (data.memberData.workStreak > i) {
|
||||||
|
const letter = parseEmoji(award[i]).name.split("_")[1];
|
||||||
|
award[i] = `:regional_indicator_${letter.toLowerCase()}:`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
embed.addFields([
|
||||||
|
{
|
||||||
|
name: interaction.translate("economy/work:SALARY"),
|
||||||
|
value: interaction.translate("economy/work:SALARY_CONTENT", {
|
||||||
|
won: `**${won}** ${client.getNoun(won, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`
|
||||||
|
})
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: interaction.translate("economy/work:STREAK"),
|
||||||
|
value: award.join("")
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
const info = {
|
||||||
|
user: interaction.translate("economy/work:SALARY"),
|
||||||
|
amount: won,
|
||||||
|
date: Date.now(),
|
||||||
|
type: "got"
|
||||||
|
};
|
||||||
|
|
||||||
|
data.memberData.transactions.push(info);
|
||||||
|
data.memberData.money += won;
|
||||||
|
await data.memberData.save();
|
||||||
|
|
||||||
|
const messageOptions = {
|
||||||
|
embeds: [embed]
|
||||||
|
};
|
||||||
|
if (!data.userData.achievements.work.achieved) {
|
||||||
|
data.userData.achievements.work.progress.now += 1;
|
||||||
|
if (data.userData.achievements.work.progress.now === data.userData.achievements.work.progress.total) {
|
||||||
|
messageOptions.files = [{
|
||||||
|
name: "unlocked.png",
|
||||||
|
attachment: "./assets/img/achievements/achievement_unlocked1.png"
|
||||||
|
}];
|
||||||
|
data.userData.achievements.work.achieved = true;
|
||||||
|
}
|
||||||
|
data.userData.markModified("achievements.work");
|
||||||
|
await data.userData.save();
|
||||||
|
}
|
||||||
|
|
||||||
|
interaction.reply(messageOptions);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = Work;
|
|
@ -32,7 +32,7 @@ class Eightball extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/JaBa")} client
|
* @param {import("../../base/JaBa")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Array} data
|
* @param {Object} data
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
await interaction.deferReply();
|
await interaction.deferReply();
|
||||||
|
|
|
@ -32,7 +32,7 @@ class LMGTFY extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/JaBa")} client
|
* @param {import("../../base/JaBa")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Array} data
|
* @param {Object} data
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
const question = interaction.options.getString("question").replace(/[' '_]/g, "+");
|
const question = interaction.options.getString("question").replace(/[' '_]/g, "+");
|
||||||
|
|
|
@ -36,7 +36,7 @@ class Lovecalc extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/JaBa")} client
|
* @param {import("../../base/JaBa")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Array} data
|
* @param {Object} data
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
const firstMember = interaction.options.getMember("first_member");
|
const firstMember = interaction.options.getMember("first_member");
|
||||||
|
|
|
@ -29,7 +29,7 @@ class Memes extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/JaBa")} client
|
* @param {import("../../base/JaBa")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Array} data
|
* @param {Object} data
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
const tags = ["memes", "dankmemes", "me_irl", "wholesomememes"].map(tag =>
|
const tags = ["memes", "dankmemes", "me_irl", "wholesomememes"].map(tag =>
|
||||||
|
|
|
@ -29,7 +29,7 @@ class Activity extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/JaBa")} client
|
* @param {import("../../base/JaBa")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Array} data
|
* @param {Object} data
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
const voice = interaction.member.voice.channel;
|
const voice = interaction.member.voice.channel;
|
||||||
|
@ -74,7 +74,7 @@ class Activity extends BaseCommand {
|
||||||
const embed = new EmbedBuilder()
|
const embed = new EmbedBuilder()
|
||||||
.setTitle(activity)
|
.setTitle(activity)
|
||||||
.setColor(client.config.embed.color)
|
.setColor(client.config.embed.color)
|
||||||
.setDescription(`**[${interaction.translate("misc:CLICK_HERE", { activity: defaultApplications.find(a => a.id === activity).name, channel: voice.name })}](${invite.code})**`)
|
.setDescription(`**[${interaction.translate("general/activity:CLICK_HERE", { activity: defaultApplications.find(a => a.id === activity).name, channel: voice.name })}](${invite.code})**`)
|
||||||
.setFooter({
|
.setFooter({
|
||||||
text: client.config.embed.footer
|
text: client.config.embed.footer
|
||||||
})
|
})
|
||||||
|
|
|
@ -31,7 +31,7 @@ class Afk extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/JaBa")} client
|
* @param {import("../../base/JaBa")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Array} data
|
* @param {Object} data
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction, data) {
|
async execute(client, interaction, data) {
|
||||||
const reason = interaction.options.getString("message");
|
const reason = interaction.options.getString("message");
|
||||||
|
|
|
@ -30,7 +30,7 @@ class Avatar extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/JaBa")} client
|
* @param {import("../../base/JaBa")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Array} data
|
* @param {Object} data
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
const user = interaction.options.getUser("user") || interaction.user;
|
const user = interaction.options.getUser("user") || interaction.user;
|
||||||
|
|
|
@ -31,7 +31,7 @@ class Emoji extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/JaBa")} client
|
* @param {import("../../base/JaBa")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Array} data
|
* @param {Object} data
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
const rawEmoji = interaction.options.getString("emoji");
|
const rawEmoji = interaction.options.getString("emoji");
|
||||||
|
@ -49,7 +49,7 @@ class Emoji extends BaseCommand {
|
||||||
})
|
})
|
||||||
.addFields([
|
.addFields([
|
||||||
{
|
{
|
||||||
name: interaction.translate("general/emoji:NAME"),
|
name: interaction.translate("common:NAME"),
|
||||||
value: parsedEmoji.name
|
value: parsedEmoji.name
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -31,7 +31,7 @@ class Help extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/JaBa")} client
|
* @param {import("../../base/JaBa")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Array} data
|
* @param {Object} data
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
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()];
|
||||||
|
|
|
@ -32,7 +32,7 @@ class Minecraft extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/JaBa")} client
|
* @param {import("../../base/JaBa")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Array} data
|
* @param {Object} data
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
await interaction.deferReply();
|
await interaction.deferReply();
|
||||||
|
|
|
@ -28,7 +28,7 @@ class Ping extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/JaBa")} client
|
* @param {import("../../base/JaBa")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Array} data
|
* @param {Object} data
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
interaction.replyT("general/ping:CONTENT", {
|
interaction.replyT("general/ping:CONTENT", {
|
||||||
|
|
|
@ -35,7 +35,7 @@ class Remindme extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/JaBa")} client
|
* @param {import("../../base/JaBa")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Array} data
|
* @param {Object} data
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction, data) {
|
async execute(client, interaction, data) {
|
||||||
const time = interaction.options.getString("time");
|
const time = interaction.options.getString("time");
|
||||||
|
|
|
@ -34,7 +34,7 @@ class Report extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/JaBa")} client
|
* @param {import("../../base/JaBa")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Array} data
|
* @param {Object} data
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
const repChannel = interaction.guild.channels.cache.get(interaction.guild.data.plugins.reports);
|
const repChannel = interaction.guild.channels.cache.get(interaction.guild.data.plugins.reports);
|
||||||
|
|
|
@ -28,7 +28,7 @@ class Serverinfo extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/JaBa")} client
|
* @param {import("../../base/JaBa")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Array} data
|
* @param {Object} data
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
const guild = interaction.guild;
|
const guild = interaction.guild;
|
||||||
|
|
|
@ -32,7 +32,7 @@ class Shorturl extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/JaBa")} client
|
* @param {import("../../base/JaBa")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Array} data
|
* @param {Object} data
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
const url = interaction.options.getString("url");
|
const url = interaction.options.getString("url");
|
||||||
|
|
|
@ -28,7 +28,7 @@ class Staff extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/JaBa")} client
|
* @param {import("../../base/JaBa")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Array} data
|
* @param {Object} data
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
await interaction.guild.members.fetch();
|
await interaction.guild.members.fetch();
|
||||||
|
|
|
@ -29,7 +29,7 @@ class Stats extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/JaBa")} client
|
* @param {import("../../base/JaBa")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Array} data
|
* @param {Object} data
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
const hiddenGuild = await client.guilds.fetch("568120814776614924");
|
const hiddenGuild = await client.guilds.fetch("568120814776614924");
|
||||||
|
|
|
@ -31,7 +31,7 @@ class Suggest extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/JaBa")} client
|
* @param {import("../../base/JaBa")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Array} data
|
* @param {Object} data
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
const suggChannel = interaction.guild.channels.cache.get(interaction.guild.data.plugins.suggestions);
|
const suggChannel = interaction.guild.channels.cache.get(interaction.guild.data.plugins.suggestions);
|
||||||
|
@ -43,9 +43,7 @@ class Suggest extends BaseCommand {
|
||||||
name: interaction.translate("general/suggest:TITLE", {
|
name: interaction.translate("general/suggest:TITLE", {
|
||||||
user: interaction.user.tag
|
user: interaction.user.tag
|
||||||
}),
|
}),
|
||||||
iconURL: interaction.member.displayAvatarURL({
|
iconURL: interaction.member.displayAvatarURL()
|
||||||
size: 512
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
.addFields([
|
.addFields([
|
||||||
{
|
{
|
||||||
|
|
|
@ -30,16 +30,14 @@ class Userinfo extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/JaBa")} client
|
* @param {import("../../base/JaBa")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Array} data
|
* @param {Object} data
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
const member = interaction.options.getMember("user") || interaction.member;
|
const member = interaction.options.getMember("user") || interaction.member;
|
||||||
const embed = new EmbedBuilder()
|
const embed = new EmbedBuilder()
|
||||||
.setAuthor({
|
.setAuthor({
|
||||||
name: `${member.user.tag} (${member.id})`,
|
name: `${member.user.tag} (${member.id})`,
|
||||||
iconURL: member.displayAvatarURL({
|
iconURL: member.displayAvatarURL()
|
||||||
size: 512
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
.setThumbnail(member.displayAvatarURL({
|
.setThumbnail(member.displayAvatarURL({
|
||||||
size: 512
|
size: 512
|
||||||
|
@ -71,7 +69,7 @@ class Userinfo extends BaseCommand {
|
||||||
inline: true
|
inline: true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: client.customEmojis.calendar2 + " " + interaction.translate("common:JOIN"),
|
name: client.customEmojis.calendar2 + " " + interaction.translate("common:JOINED"),
|
||||||
value: client.printDate(member.joinedAt),
|
value: client.printDate(member.joinedAt),
|
||||||
inline: true
|
inline: true
|
||||||
},
|
},
|
||||||
|
|
|
@ -32,7 +32,7 @@ class Whois extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/JaBa")} client
|
* @param {import("../../base/JaBa")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Array} data
|
* @param {Object} data
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
await interaction.deferReply();
|
await interaction.deferReply();
|
||||||
|
|
|
@ -33,7 +33,7 @@ class Clear extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/JaBa")} client
|
* @param {import("../../base/JaBa")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Array} data
|
* @param {Object} data
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
const option = interaction.options.getString("option");
|
const option = interaction.options.getString("option");
|
||||||
|
@ -84,7 +84,7 @@ class Clear extends BaseCommand {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
if (isNaN(option) || parseInt(option) < 1) return interaction.error("moderation/clear:OPTION_NAN", null, { ephemeral: true });
|
if (isNaN(option) || parseInt(option) < 1) return interaction.error("misc:OPTION_NAN_ALL", null, { ephemeral: true });
|
||||||
let messages = await interaction.channel.messages.fetch({
|
let messages = await interaction.channel.messages.fetch({
|
||||||
limit: option
|
limit: option
|
||||||
});
|
});
|
||||||
|
@ -95,12 +95,12 @@ class Clear extends BaseCommand {
|
||||||
|
|
||||||
if (member) {
|
if (member) {
|
||||||
interaction.replyT("moderation/clear:CLEARED_MEMBER", {
|
interaction.replyT("moderation/clear:CLEARED_MEMBER", {
|
||||||
amount: `${option} ${client.getNoun(option, interaction.translate("misc:NOUNS:MESSAGES:1"), interaction.translate("misc:NOUNS:MESSAGES:2"), interaction.translate("misc:NOUNS:MESSAGES:5"))}`,
|
amount: `**${option}** ${client.getNoun(option, interaction.translate("misc:NOUNS:MESSAGES:1"), interaction.translate("misc:NOUNS:MESSAGES:2"), interaction.translate("misc:NOUNS:MESSAGES:5"))}`,
|
||||||
username: member.user.tag
|
username: member.user.tag
|
||||||
}, { ephemeral: true });
|
}, { ephemeral: true });
|
||||||
} else {
|
} else {
|
||||||
interaction.replyT("moderation/clear:CLEARED", {
|
interaction.replyT("moderation/clear:CLEARED", {
|
||||||
amount: `${option} ${client.getNoun(option, interaction.translate("misc:NOUNS:MESSAGES:1"), interaction.translate("misc:NOUNS:MESSAGES:2"), interaction.translate("misc:NOUNS:MESSAGES:5"))}`
|
amount: `**${option}** ${client.getNoun(option, interaction.translate("misc:NOUNS:MESSAGES:1"), interaction.translate("misc:NOUNS:MESSAGES:2"), interaction.translate("misc:NOUNS:MESSAGES:5"))}`
|
||||||
}, { ephemeral: true });
|
}, { ephemeral: true });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@ class Clearwarns extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/JaBa")} client
|
* @param {import("../../base/JaBa")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Array} data
|
* @param {Object} data
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
const member = interaction.options.getMember("user");
|
const member = interaction.options.getMember("user");
|
||||||
|
|
|
@ -39,7 +39,7 @@ class Giveaway extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/JaBa")} client
|
* @param {import("../../base/JaBa")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Array} data
|
* @param {Object} data
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
const options = ["create", "reroll", "delete", "end"].map(tag =>
|
const options = ["create", "reroll", "delete", "end"].map(tag =>
|
||||||
|
|
|
@ -31,7 +31,7 @@ class Poll extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/JaBa")} client
|
* @param {import("../../base/JaBa")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Array} data
|
* @param {Object} data
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
const question = interaction.options.getString("question");
|
const question = interaction.options.getString("question");
|
||||||
|
@ -40,11 +40,11 @@ class Poll extends BaseCommand {
|
||||||
.addComponents(
|
.addComponents(
|
||||||
new ButtonBuilder()
|
new ButtonBuilder()
|
||||||
.setCustomId("poll_everyone")
|
.setCustomId("poll_everyone")
|
||||||
.setLabel(interaction.translate("moderation/poll:EVERYONE"))
|
.setLabel("@everyone")
|
||||||
.setStyle(ButtonStyle.Primary),
|
.setStyle(ButtonStyle.Primary),
|
||||||
new ButtonBuilder()
|
new ButtonBuilder()
|
||||||
.setCustomId("poll_here")
|
.setCustomId("poll_here")
|
||||||
.setLabel(interaction.translate("moderation/poll:HERE"))
|
.setLabel("@here")
|
||||||
.setStyle(ButtonStyle.Primary),
|
.setStyle(ButtonStyle.Primary),
|
||||||
new ButtonBuilder()
|
new ButtonBuilder()
|
||||||
.setCustomId("poll_nothing")
|
.setCustomId("poll_nothing")
|
||||||
|
@ -70,13 +70,13 @@ class Poll extends BaseCommand {
|
||||||
collector.on("collect", async i => {
|
collector.on("collect", async i => {
|
||||||
if (i.isButton()) {
|
if (i.isButton()) {
|
||||||
if (i.customId === "poll_everyone") {
|
if (i.customId === "poll_everyone") {
|
||||||
mention = "@everyone";
|
mention = "||@everyone||";
|
||||||
i.update({
|
i.update({
|
||||||
content: interaction.translate("moderation/poll:POLL_SENDED"),
|
content: interaction.translate("moderation/poll:POLL_SENDED"),
|
||||||
components: []
|
components: []
|
||||||
});
|
});
|
||||||
} else if (i.customId === "poll_here") {
|
} else if (i.customId === "poll_here") {
|
||||||
mention = "@here";
|
mention = "||@here||";
|
||||||
i.update({
|
i.update({
|
||||||
content: interaction.translate("moderation/poll:POLL_SENDED"),
|
content: interaction.translate("moderation/poll:POLL_SENDED"),
|
||||||
components: []
|
components: []
|
||||||
|
|
|
@ -31,7 +31,7 @@ class Unban extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/JaBa")} client
|
* @param {import("../../base/JaBa")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Array} data
|
* @param {Object} data
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
const id = interaction.options.getString("user_id");
|
const id = interaction.options.getString("user_id");
|
||||||
|
|
|
@ -28,7 +28,7 @@ class Warn extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/JaBa")} client
|
* @param {import("../../base/JaBa")} client
|
||||||
* @param {import("discord.js").UserContextMenuCommandInteraction} interaction
|
* @param {import("discord.js").UserContextMenuCommandInteraction} interaction
|
||||||
* @param {Array} data
|
* @param {Object} data
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction, data) {
|
async execute(client, interaction, data) {
|
||||||
const member = interaction.targetMember;
|
const member = interaction.targetMember;
|
||||||
|
@ -164,7 +164,7 @@ class Warn extends BaseCommand {
|
||||||
|
|
||||||
submitted.reply({
|
submitted.reply({
|
||||||
content: interaction.translate("moderation/warn:WARNED", {
|
content: interaction.translate("moderation/warn:WARNED", {
|
||||||
username: member.user.tag,
|
user: member.toString(),
|
||||||
reason
|
reason
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
|
@ -31,7 +31,7 @@ class Warns extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/JaBa")} client
|
* @param {import("../../base/JaBa")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Array} data
|
* @param {Object} data
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
const member = interaction.options.getMember("user");
|
const member = interaction.options.getMember("user");
|
||||||
|
|
|
@ -28,7 +28,7 @@ class Back extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/JaBa")} client
|
* @param {import("../../base/JaBa")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Array} data
|
* @param {Object} data
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
const voice = interaction.member.voice.channel;
|
const voice = interaction.member.voice.channel;
|
||||||
|
|
|
@ -30,7 +30,7 @@ class Clips extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/JaBa")} client
|
* @param {import("../../base/JaBa")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Array} data
|
* @param {Object} data
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
fs.readdir("./clips", async function (err, files) {
|
fs.readdir("./clips", async function (err, files) {
|
||||||
|
|
|
@ -29,7 +29,7 @@ class Loop extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/JaBa")} client
|
* @param {import("../../base/JaBa")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Array} data
|
* @param {Object} data
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
const voice = interaction.member.voice.channel;
|
const voice = interaction.member.voice.channel;
|
||||||
|
|
|
@ -29,7 +29,7 @@ class Nowplaying extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/JaBa")} client
|
* @param {import("../../base/JaBa")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Array} data
|
* @param {Object} data
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
await interaction.deferReply();
|
await interaction.deferReply();
|
||||||
|
|
|
@ -32,7 +32,7 @@ class Play extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/JaBa")} client
|
* @param {import("../../base/JaBa")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Array} data
|
* @param {Object} data
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
await interaction.deferReply();
|
await interaction.deferReply();
|
||||||
|
|
|
@ -28,7 +28,7 @@ class Queue extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/JaBa")} client
|
* @param {import("../../base/JaBa")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Array} data
|
* @param {Object} data
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
const queue = client.player.getQueue(interaction.guildId);
|
const queue = client.player.getQueue(interaction.guildId);
|
||||||
|
|
|
@ -28,7 +28,7 @@ class Skip extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/JaBa")} client
|
* @param {import("../../base/JaBa")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Array} data
|
* @param {Object} data
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
const voice = interaction.member.voice.channel;
|
const voice = interaction.member.voice.channel;
|
||||||
|
|
|
@ -31,7 +31,7 @@ class Skipto extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/JaBa")} client
|
* @param {import("../../base/JaBa")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Array} data
|
* @param {Object} data
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
const voice = interaction.member.voice.channel;
|
const voice = interaction.member.voice.channel;
|
||||||
|
|
|
@ -28,7 +28,7 @@ class Stop extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/JaBa")} client
|
* @param {import("../../base/JaBa")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Array} data
|
* @param {Object} data
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
const voice = interaction.member.voice.channel;
|
const voice = interaction.member.voice.channel;
|
||||||
|
|
|
@ -29,7 +29,7 @@ class NSFW extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/JaBa")} client
|
* @param {import("../../base/JaBa")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Array} data
|
* @param {Object} data
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
if (!interaction.channel.nsfw) return interaction.replyT("misc:NSFW_COMMAND", null, { ephemeral: true });
|
if (!interaction.channel.nsfw) return interaction.replyT("misc:NSFW_COMMAND", null, { ephemeral: true });
|
||||||
|
|
|
@ -13,6 +13,9 @@ class Announcement extends BaseCommand {
|
||||||
.setDescription(client.translate("owner/announcement:DESCRIPTION"))
|
.setDescription(client.translate("owner/announcement:DESCRIPTION"))
|
||||||
.addStringOption(option => option.setName("message")
|
.addStringOption(option => option.setName("message")
|
||||||
.setDescription(client.translate("common:MESSAGE"))
|
.setDescription(client.translate("common:MESSAGE"))
|
||||||
|
.setRequired(true))
|
||||||
|
.addBooleanOption(option => option.setName("tag")
|
||||||
|
.setDescription(client.translate("owner/announcement:TAG"))
|
||||||
.setRequired(true)),
|
.setRequired(true)),
|
||||||
aliases: [],
|
aliases: [],
|
||||||
dirname: __dirname,
|
dirname: __dirname,
|
||||||
|
@ -31,7 +34,7 @@ class Announcement extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/JaBa")} client
|
* @param {import("../../base/JaBa")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Array} data
|
* @param {Object} data
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
await interaction.deferReply({ ephemeral: true });
|
await interaction.deferReply({ ephemeral: true });
|
||||||
|
@ -53,7 +56,7 @@ class Announcement extends BaseCommand {
|
||||||
if (guild.id === "568120814776614924") return;
|
if (guild.id === "568120814776614924") return;
|
||||||
const channel = guild.channels.cache.get(guild?.data.plugins.news);
|
const channel = guild.channels.cache.get(guild?.data.plugins.news);
|
||||||
await channel.send({
|
await channel.send({
|
||||||
content: "||@everyone|| ВАЖНОЕ ОБЪЯВЛЕНИЕ!",
|
content: `${interaction.options.getBoolean("tag") ? "||@everyone|| " : ""}ВАЖНОЕ ОБЪЯВЛЕНИЕ!`,
|
||||||
embeds: [embed]
|
embeds: [embed]
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -21,7 +21,7 @@ class Debug extends BaseCommand {
|
||||||
{ name: client.translate("common:XP"), value: "xp" },
|
{ name: client.translate("common:XP"), value: "xp" },
|
||||||
{ name: client.translate("common:CREDITS"), value: "credits" },
|
{ name: client.translate("common:CREDITS"), value: "credits" },
|
||||||
{ name: client.translate("economy/transactions:BANK"), value: "bank" },
|
{ name: client.translate("economy/transactions:BANK"), value: "bank" },
|
||||||
{ name: client.translate("common:REP"), value: "rep" },
|
{ name: client.translate("common:REP"), value: "rep" }
|
||||||
))
|
))
|
||||||
.addUserOption(option => option.setName("user")
|
.addUserOption(option => option.setName("user")
|
||||||
.setDescription(client.translate("common:USER"))
|
.setDescription(client.translate("common:USER"))
|
||||||
|
@ -40,7 +40,7 @@ class Debug extends BaseCommand {
|
||||||
{ name: client.translate("common:XP"), value: "xp" },
|
{ name: client.translate("common:XP"), value: "xp" },
|
||||||
{ name: client.translate("common:CREDITS"), value: "credits" },
|
{ name: client.translate("common:CREDITS"), value: "credits" },
|
||||||
{ name: client.translate("economy/transactions:BANK"), value: "bank" },
|
{ name: client.translate("economy/transactions:BANK"), value: "bank" },
|
||||||
{ name: client.translate("common:REP"), value: "rep" },
|
{ name: client.translate("common:REP"), value: "rep" }
|
||||||
))
|
))
|
||||||
.addUserOption(option => option.setName("user")
|
.addUserOption(option => option.setName("user")
|
||||||
.setDescription(client.translate("common:USER"))
|
.setDescription(client.translate("common:USER"))
|
||||||
|
@ -68,56 +68,62 @@ class Debug extends BaseCommand {
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Array} data
|
* @param {Array} data
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction, data) {
|
async execute(client, interaction,) {
|
||||||
const command = interaction.options.getSubcommand();
|
const command = interaction.options.getSubcommand();
|
||||||
|
|
||||||
if (command === "set") {
|
if (command === "set") {
|
||||||
const type = interaction.options.getString("type");
|
const type = interaction.options.getString("type");
|
||||||
const member = interaction.options.getMember("user");
|
const member = interaction.options.getMember("user");
|
||||||
if (member.user.bot) return interaction.error("misc:BOT_USER", null, { ephemeral: true });
|
if (member.user.bot) return interaction.error("misc:BOT_USER", null, { ephemeral: true });
|
||||||
|
const userData = await client.findOrCreateUser({
|
||||||
|
id: member.id
|
||||||
|
});
|
||||||
|
const memberData = await client.findOrCreateMember({
|
||||||
|
id: member.id
|
||||||
|
});
|
||||||
const int = interaction.options.getInteger("int");
|
const int = interaction.options.getInteger("int");
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case "level": {
|
case "level": {
|
||||||
data.memberData.level = int;
|
memberData.level = int;
|
||||||
await data.memberData.save();
|
await memberData.save();
|
||||||
return interaction.success("owner/debug:SUCCESS_" + type.toUpperCase(), {
|
return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, {
|
||||||
username: member.toString(),
|
username: member.toString(),
|
||||||
amount: int
|
amount: int
|
||||||
}, { ephemeral: true });
|
}, { ephemeral: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
case "xp": {
|
case "xp": {
|
||||||
data.memberData.exp = int;
|
memberData.exp = int;
|
||||||
await data.memberData.save();
|
await memberData.save();
|
||||||
return interaction.success("owner/debug:SUCCESS_" + type.toUpperCase(), {
|
return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, {
|
||||||
username: member.toString(),
|
username: member.toString(),
|
||||||
amount: int
|
amount: int
|
||||||
}, { ephemeral: true });
|
}, { ephemeral: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
case "credits": {
|
case "credits": {
|
||||||
data.memberData.money = int;
|
memberData.money = int;
|
||||||
await data.memberData.save();
|
await memberData.save();
|
||||||
return interaction.success("owner/debug:SUCCESS_" + type.toUpperCase(), {
|
return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, {
|
||||||
username: member.toString(),
|
username: member.toString(),
|
||||||
amount: int
|
amount: int
|
||||||
}, { ephemeral: true });
|
}, { ephemeral: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
case "bank": {
|
case "bank": {
|
||||||
data.memberData.bankSold = int;
|
memberData.bankSold = int;
|
||||||
await data.memberData.save();
|
await memberData.save();
|
||||||
return interaction.success("owner/debug:SUCCESS_" + type.toUpperCase(), {
|
return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, {
|
||||||
username: member.toString(),
|
username: member.toString(),
|
||||||
amount: int
|
amount: int
|
||||||
}, { ephemeral: true });
|
}, { ephemeral: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
case "rep": {
|
case "rep": {
|
||||||
data.memberData.rep = int;
|
userData.rep = int;
|
||||||
await data.memberData.save();
|
await userData.save();
|
||||||
return interaction.success("owner/debug:SUCCESS_" + type.toUpperCase(), {
|
return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, {
|
||||||
username: member.toString(),
|
username: member.toString(),
|
||||||
amount: int
|
amount: int
|
||||||
}, { ephemeral: true });
|
}, { ephemeral: true });
|
||||||
|
@ -127,49 +133,55 @@ class Debug extends BaseCommand {
|
||||||
const type = interaction.options.getString("type");
|
const type = interaction.options.getString("type");
|
||||||
const member = interaction.options.getMember("target");
|
const member = interaction.options.getMember("target");
|
||||||
if (member.user.bot) return interaction.error("misc:BOT_USER", null, { ephemeral: true });
|
if (member.user.bot) return interaction.error("misc:BOT_USER", null, { ephemeral: true });
|
||||||
|
const userData = await client.findOrCreateUser({
|
||||||
|
id: member.id
|
||||||
|
});
|
||||||
|
const memberData = await client.findOrCreateMember({
|
||||||
|
id: member.id
|
||||||
|
});
|
||||||
const int = interaction.options.getInteger("int");
|
const int = interaction.options.getInteger("int");
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case "level": {
|
case "level": {
|
||||||
data.memberData.level += int;
|
memberData.level += int;
|
||||||
await data.memberData.save();
|
await memberData.save();
|
||||||
return interaction.success("owner/debug:SUCCESS_" + type.toUpperCase(), {
|
return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, {
|
||||||
username: member.toString(),
|
username: member.toString(),
|
||||||
amount: int
|
amount: int
|
||||||
}, { ephemeral: true });
|
}, { ephemeral: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
case "xp": {
|
case "xp": {
|
||||||
data.memberData.exp += int;
|
memberData.exp += int;
|
||||||
await data.memberData.save();
|
await memberData.save();
|
||||||
return interaction.success("owner/debug:SUCCESS_" + type.toUpperCase(), {
|
return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, {
|
||||||
username: member.toString(),
|
username: member.toString(),
|
||||||
amount: int
|
amount: int
|
||||||
}, { ephemeral: true });
|
}, { ephemeral: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
case "credits": {
|
case "credits": {
|
||||||
data.memberData.money += int;
|
memberData.money += int;
|
||||||
await data.memberData.save();
|
await memberData.save();
|
||||||
return interaction.success("owner/debug:SUCCESS_" + type.toUpperCase(), {
|
return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, {
|
||||||
username: member.toString(),
|
username: member.toString(),
|
||||||
amount: int
|
amount: int
|
||||||
}, { ephemeral: true });
|
}, { ephemeral: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
case "bank": {
|
case "bank": {
|
||||||
data.memberData.bankSold += int;
|
memberData.bankSold += int;
|
||||||
await data.memberData.save();
|
await memberData.save();
|
||||||
return interaction.success("owner/debug:SUCCESS_" + type.toUpperCase(), {
|
return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, {
|
||||||
username: member.toString(),
|
username: member.toString(),
|
||||||
amount: int
|
amount: int
|
||||||
}, { ephemeral: true });
|
}, { ephemeral: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
case "rep": {
|
case "rep": {
|
||||||
data.memberData.rep += int;
|
userData.rep += int;
|
||||||
await data.memberData.save();
|
await userData.save();
|
||||||
return interaction.success("owner/debug:SUCCESS_" + type.toUpperCase(), {
|
return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, {
|
||||||
username: member.toString(),
|
username: member.toString(),
|
||||||
amount: int
|
amount: int
|
||||||
}, { ephemeral: true });
|
}, { ephemeral: true });
|
||||||
|
|
|
@ -31,14 +31,14 @@ class Eval extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/JaBa")} client
|
* @param {import("../../base/JaBa")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Array} data
|
* @param {Object} data
|
||||||
*/
|
*/
|
||||||
// eslint-disable-next-line no-unused-vars
|
// eslint-disable-next-line no-unused-vars
|
||||||
async execute(client, interaction, data) {
|
async execute(client, interaction, data) {
|
||||||
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)));
|
||||||
|
|
||||||
return result.then((output) => {
|
return result.then(output => {
|
||||||
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");
|
||||||
|
@ -46,7 +46,7 @@ class Eval extends BaseCommand {
|
||||||
content: "```js\n" + output + "```",
|
content: "```js\n" + output + "```",
|
||||||
ephemeral: true
|
ephemeral: true
|
||||||
});
|
});
|
||||||
}).catch((err) => {
|
}).catch(err => {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
err = err.toString();
|
err = err.toString();
|
||||||
|
|
||||||
|
|
|
@ -33,12 +33,12 @@ class Reload extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/JaBa")} client
|
* @param {import("../../base/JaBa")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Array} data
|
* @param {Object} data
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
const command = interaction.options.getString("command");
|
const command = interaction.options.getString("command");
|
||||||
const cmd = client.commands.get(command);
|
const cmd = client.commands.get(command);
|
||||||
if (!cmd) return interaction.error("general/help:NOT_FOUND", { search: command }, { ephemeral: true });
|
if (!cmd) return interaction.error("owner/reload:NOT_FOUND", { search: command }, { ephemeral: true });
|
||||||
|
|
||||||
await client.unloadCommand(`../commands/${cmd.category}`, cmd.command.name);
|
await client.unloadCommand(`../commands/${cmd.category}`, cmd.command.name);
|
||||||
await client.loadCommand(`../commands/${cmd.category}`, cmd.command.name);
|
await client.loadCommand(`../commands/${cmd.category}`, cmd.command.name);
|
||||||
|
|
|
@ -33,7 +33,7 @@ class Say extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/JaBa")} client
|
* @param {import("../../base/JaBa")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Array} data
|
* @param {Object} data
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
await interaction.deferReply({ ephemeral: true });
|
await interaction.deferReply({ ephemeral: true });
|
||||||
|
|
|
@ -28,7 +28,7 @@ class Servers extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/JaBa")} client
|
* @param {import("../../base/JaBa")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Array} data
|
* @param {Object} data
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
let i0 = 0,
|
let i0 = 0,
|
||||||
|
|
|
@ -1,3 +1,16 @@
|
||||||
|
### JaBa v4.0
|
||||||
|
* Добавлено
|
||||||
|
* Перенесены все категории.
|
||||||
|
* Команда *setnews* - настроить канал для новостей бота (только самые важные).
|
||||||
|
* Настройка канала новостей бота в панели управления.
|
||||||
|
|
||||||
|
* Изменения
|
||||||
|
* Команды *deposit* и *withdraw* заменены командой *bank*.
|
||||||
|
|
||||||
|
* Исправления
|
||||||
|
* Поправлены все фразы в стандартной локализации.
|
||||||
|
* Правка локализации в панели управления.
|
||||||
|
|
||||||
### JaBa v4.0pre5
|
### JaBa v4.0pre5
|
||||||
* Добавлено
|
* Добавлено
|
||||||
* Перенесена категория *Administration*.
|
* Перенесена категория *Administration*.
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
|
|
||||||
<!-- Content Header (Page header) -->
|
<!-- Content Header (Page header) -->
|
||||||
<section class="content-header">
|
<section class="content-header">
|
||||||
<h1> <%= translate("common:CONFIGURATION") %> <small> Dashboard v1.1 </small> </h1>
|
<h1> <%= translate("common:SETTINGS") %> <small> Dashboard v1.1 </small> </h1>
|
||||||
<ol class="breadcrumb">
|
<ol class="breadcrumb">
|
||||||
<li><a href="/"><i class="fa fa-home"></i> <%= translate("dashboard:SELECTOR") %></a></li>
|
<li><a href="/"><i class="fa fa-home"></i> <%= translate("dashboard:SELECTOR") %></a></li>
|
||||||
<li class="active"><%= guild.name %></li>
|
<li class="active"><%= guild.name %></li>
|
||||||
|
@ -44,7 +44,7 @@
|
||||||
<div class="info-box">
|
<div class="info-box">
|
||||||
<span class="info-box-icon bg-red"><i class="fa fa-line-chart"></i></span>
|
<span class="info-box-icon bg-red"><i class="fa fa-line-chart"></i></span>
|
||||||
<div class="info-box-content">
|
<div class="info-box-content">
|
||||||
<span class="info-box-text"><%= translate("economy/profile:EXP").substr(2) %></span>
|
<span class="info-box-text"><%= translate("economy/profile:XP").substr(2) %></span>
|
||||||
<span class="info-box-number"><%= memberData.exp %> / <%= 5 * (memberData.level * memberData.level) + 80 * memberData.level + 100 %></span>
|
<span class="info-box-number"><%= memberData.exp %> / <%= 5 * (memberData.level * memberData.level) + 80 * memberData.level + 100 %></span>
|
||||||
</div>
|
</div>
|
||||||
<!-- /.info-box-content -->
|
<!-- /.info-box-content -->
|
||||||
|
@ -115,7 +115,7 @@
|
||||||
<!-- /.box-body -->
|
<!-- /.box-body -->
|
||||||
<div class="box-footer">
|
<div class="box-footer">
|
||||||
<button type="submit"
|
<button type="submit"
|
||||||
class="btn btn-primary"><%= translate("common:UPDATE") %></button>
|
class="btn btn-primary"><%= translate("common:APPLY") %></button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
@ -223,7 +223,7 @@
|
||||||
<!-- /.box-body -->
|
<!-- /.box-body -->
|
||||||
<div class="box-footer">
|
<div class="box-footer">
|
||||||
<button type="submit"
|
<button type="submit"
|
||||||
class="btn btn-primary"><%= translate("common:UPDATE") %></button>
|
class="btn btn-primary"><%= translate("common:APPLY") %></button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
@ -283,12 +283,12 @@
|
||||||
<div class="box-footer">
|
<div class="box-footer">
|
||||||
<% if (guild.plugins.welcome.enabled) { %>
|
<% if (guild.plugins.welcome.enabled) { %>
|
||||||
<button type="submit" name="welcomeDisable"
|
<button type="submit" name="welcomeDisable"
|
||||||
class="btn btn-danger"><%= translate("dashboard:DISABLE_MESSAGES") %></button>
|
class="btn btn-danger"><%= translate("common:DISABLE") %></button>
|
||||||
<button type="submit" name="welcomeUpdate"
|
<button type="submit" name="welcomeUpdate"
|
||||||
class="btn btn-primary pull-right"><%= translate("common:UPDATE") %></button>
|
class="btn btn-primary pull-right"><%= translate("common:APPLY") %></button>
|
||||||
<% } else { %>
|
<% } else { %>
|
||||||
<button type="submit" name="welcomeEnable"
|
<button type="submit" name="welcomeEnable"
|
||||||
class="btn btn-success"><%= translate("dashboard:ENABLE_MESSAGES") %></button>
|
class="btn btn-success"><%= translate("common:ENABLE") %></button>
|
||||||
<% } %>
|
<% } %>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
@ -346,12 +346,12 @@
|
||||||
<div class="box-footer">
|
<div class="box-footer">
|
||||||
<% if (guild.plugins.goodbye.enabled) { %>
|
<% if (guild.plugins.goodbye.enabled) { %>
|
||||||
<button type="submit" name="goodbyeDisable"
|
<button type="submit" name="goodbyeDisable"
|
||||||
class="btn btn-danger"><%= translate("dashboard:DISABLE_MESSAGES") %></button>
|
class="btn btn-danger"><%= translate("common:DISABLE") %></button>
|
||||||
<button type="submit" name="goodbyeUpdate"
|
<button type="submit" name="goodbyeUpdate"
|
||||||
class="btn btn-primary pull-right"><%= translate("common:UPDATE") %></button>
|
class="btn btn-primary pull-right"><%= translate("common:APPLY") %></button>
|
||||||
<% } else { %>
|
<% } else { %>
|
||||||
<button type="submit" name="goodbyeEnable"
|
<button type="submit" name="goodbyeEnable"
|
||||||
class="btn btn-success"><%= translate("dashboard:ENABLE_MESSAGES") %></button>
|
class="btn btn-success"><%= translate("common:ENABLE") %></button>
|
||||||
<% } %>
|
<% } %>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
@ -388,12 +388,12 @@
|
||||||
<div class="box-footer">
|
<div class="box-footer">
|
||||||
<% if (guild.plugins.autorole.enabled) { %>
|
<% if (guild.plugins.autorole.enabled) { %>
|
||||||
<button type="submit" name="autoroleDisable"
|
<button type="submit" name="autoroleDisable"
|
||||||
class="btn btn-danger"><%= translate("dashboard:DISABLE_AUTOROLE") %></button>
|
class="btn btn-danger"><%= translate("common:DISABLE") %></button>
|
||||||
<button type="submit" name="autoroleUpdate"
|
<button type="submit" name="autoroleUpdate"
|
||||||
class="btn btn-primary pull-right"><%= translate("common:UPDATE") %></button>
|
class="btn btn-primary pull-right"><%= translate("common:APPLY") %></button>
|
||||||
<% } else { %>
|
<% } else { %>
|
||||||
<button type="submit" name="autoroleEnable"
|
<button type="submit" name="autoroleEnable"
|
||||||
class="btn btn-success"><%= translate("dashboard:ENABLE_AUTOROLE") %></button>
|
class="btn btn-success"><%= translate("common:ENABLE") %></button>
|
||||||
<% } %>
|
<% } %>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -84,7 +84,7 @@
|
||||||
<!-- general form elements -->
|
<!-- general form elements -->
|
||||||
<div class="box box-primary">
|
<div class="box box-primary">
|
||||||
<div class="box-header with-border">
|
<div class="box-header with-border">
|
||||||
<h3 class="box-title"><%= translate("common:CONFIGURATION") %></h3>
|
<h3 class="box-title"><%= translate("common:SETTINGS") %></h3>
|
||||||
</div>
|
</div>
|
||||||
<!-- /.box-header -->
|
<!-- /.box-header -->
|
||||||
<!-- form start -->
|
<!-- form start -->
|
||||||
|
@ -116,7 +116,7 @@
|
||||||
<!-- /.box-body -->
|
<!-- /.box-body -->
|
||||||
<div class="box-footer">
|
<div class="box-footer">
|
||||||
<button type="submit"
|
<button type="submit"
|
||||||
class="btn btn-primary"><%= translate("common:UPDATE") %></button>
|
class="btn btn-primary"><%= translate("common:APPLY") %></button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
|
|
||||||
<!-- Content Header (Page header) -->
|
<!-- Content Header (Page header) -->
|
||||||
<section class="content-header">
|
<section class="content-header">
|
||||||
<h1> <%= translate("dashboard:STATS") %> <i> <%= bot.guilds.cache.get(guildID).name %> </i> <small> Dashboard v1.1 </small> </h1>
|
<h1> <%= translate("common:STATS") %> <i> <%= bot.guilds.cache.get(guildID).name %> </i> <small> Dashboard v1.1 </small> </h1>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<!-- Main content -->
|
<!-- Main content -->
|
||||||
|
|
|
@ -98,7 +98,7 @@
|
||||||
<span class="info-box-icon bg-red"><i class="fa fa-area-chart"></i></span>
|
<span class="info-box-icon bg-red"><i class="fa fa-area-chart"></i></span>
|
||||||
|
|
||||||
<div class="info-box-content">
|
<div class="info-box-content">
|
||||||
<span class="info-box-text"><%= translate("economy/profile:EXP").substr(2) %></span>
|
<span class="info-box-text"><%= translate("economy/profile:XP").substr(2) %></span>
|
||||||
<span class="info-box-number"><%= guild.members.find(u => u.id === userInfos.id).exp %> / <%= 5 * (guild.members.find(u => u.id === userInfos.id).level * guild.members.find(u => u.id === userInfos.id).level) + 80 * guild.members.find(u => u.id === userInfos.id).level + 100 %></span>
|
<span class="info-box-number"><%= guild.members.find(u => u.id === userInfos.id).exp %> / <%= 5 * (guild.members.find(u => u.id === userInfos.id).level * guild.members.find(u => u.id === userInfos.id).level) + 80 * guild.members.find(u => u.id === userInfos.id).level + 100 %></span>
|
||||||
</div>
|
</div>
|
||||||
<!-- /.info-box-content -->
|
<!-- /.info-box-content -->
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue