mirror of
https://github.com/arthur-pbty/bot-discord-coins.git
synced 2026-06-03 23:36:29 +02:00
Update global
This commit is contained in:
@@ -29,7 +29,7 @@ module.exports = {
|
||||
}
|
||||
|
||||
db.run(
|
||||
`UPDATE users SET blacklist = true WHERE guildId = ? AND userId = ?`,
|
||||
`UPDATE users SET blacklist = 1 WHERE guildId = ? AND userId = ?`,
|
||||
[message.guild.id, member.id],
|
||||
);
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ module.exports = {
|
||||
}
|
||||
|
||||
db.run(
|
||||
`UPDATE users SET blacklist = false WHERE guildId = ? AND userId = ?`,
|
||||
`UPDATE users SET blacklist = 0 WHERE guildId = ? AND userId = ?`,
|
||||
[message.guild.id, member.id],
|
||||
);
|
||||
|
||||
|
||||
+21
-4
@@ -34,12 +34,29 @@ module.exports = {
|
||||
},
|
||||
);
|
||||
});
|
||||
const pocket = Math.round(user.pocket);
|
||||
const bank = Math.round(user.bank);
|
||||
function convert(labelValue) {
|
||||
|
||||
return Math.abs(Number(labelValue)) >= 1.0e+9
|
||||
|
||||
? (Math.abs(Number(labelValue)) / 1.0e+9).toFixed(2) + "B"
|
||||
|
||||
: Math.abs(Number(labelValue)) >= 1.0e+6
|
||||
|
||||
? (Math.abs(Number(labelValue)) / 1.0e+6).toFixed(2) + "M"
|
||||
|
||||
: Math.abs(Number(labelValue)) >= 1.0e+3
|
||||
|
||||
? (Math.abs(Number(labelValue)) / 1.0e+3).toFixed(2) + "K"
|
||||
|
||||
: Math.abs(Number(labelValue));
|
||||
|
||||
}
|
||||
const pocket = convert(Math.round(user.pocket));
|
||||
const bank = convert(Math.round(user.bank));
|
||||
const reputation = user.reputation;
|
||||
const niveau = user.lvl;
|
||||
const xp = user.xp;
|
||||
const tdrop = Math.round(user.tdroper);
|
||||
const xp = convert(user.xp);
|
||||
const tdrop = convert(Math.round(user.teamDroper));
|
||||
|
||||
let anti_rob = ``;
|
||||
if (user.antiRob + 7200000 > Date.now()) {
|
||||
|
||||
@@ -93,7 +93,7 @@ module.exports = {
|
||||
);
|
||||
});
|
||||
|
||||
if (memberInfo.antiRob + 7200000 > Date.now()) {
|
||||
if ((memberInfo.antiRob + 7200000) > Date.now()) {
|
||||
const embed = new EmbedBuilder()
|
||||
.setTitle("Erreur")
|
||||
.setDescription(
|
||||
|
||||
@@ -112,7 +112,7 @@ module.exports = {
|
||||
if (!interaction.isSelectMenu()) return;
|
||||
|
||||
if (!interaction.customId === "sell") return;
|
||||
const selected = interaction.values[0];
|
||||
const selected = interaction.values;
|
||||
|
||||
if (selected === "1") {
|
||||
if (user.objet < 1) {
|
||||
|
||||
+29
-1
@@ -187,6 +187,24 @@ module.exports = {
|
||||
});
|
||||
}
|
||||
|
||||
function convert(labelValue) {
|
||||
|
||||
return Math.abs(Number(labelValue)) >= 1.0e+9
|
||||
|
||||
? (Math.abs(Number(labelValue)) / 1.0e+9).toFixed(2) + "B"
|
||||
|
||||
: Math.abs(Number(labelValue)) >= 1.0e+6
|
||||
|
||||
? (Math.abs(Number(labelValue)) / 1.0e+6).toFixed(2) + "M"
|
||||
|
||||
: Math.abs(Number(labelValue)) >= 1.0e+3
|
||||
|
||||
? (Math.abs(Number(labelValue)) / 1.0e+3).toFixed(2) + "K"
|
||||
|
||||
: Math.abs(Number(labelValue));
|
||||
|
||||
}
|
||||
|
||||
const emoji = {
|
||||
coins: "🪙",
|
||||
pocket: "💰",
|
||||
@@ -200,6 +218,16 @@ module.exports = {
|
||||
|
||||
let leaderboard = data
|
||||
.map((row, i) => {
|
||||
const user = {
|
||||
coins: '<@' + row.userId + '>',
|
||||
pocket: '<@' + row.userId + '>',
|
||||
bank: '<@' + row.userId + '>',
|
||||
reputation: '<@' + row.userId + '>',
|
||||
niveau: '<@' + row.userId + '>',
|
||||
team: row.name,
|
||||
teamreputation: row.name,
|
||||
teamdroper: '<@' + row.userId + '>'
|
||||
}
|
||||
let position;
|
||||
switch (i) {
|
||||
case 0:
|
||||
@@ -214,7 +242,7 @@ module.exports = {
|
||||
default:
|
||||
position = `**${i + 1}.**`;
|
||||
}
|
||||
return `${position} <@${row.userId}> - \`${row.coins}\` ${emoji[type]}`;
|
||||
return `${position} ${user[type]} - \`${convert(row.coins)}\` ${emoji[type]}`;
|
||||
})
|
||||
.join("\n\n");
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ module.exports = {
|
||||
if (args[0] === "None") {
|
||||
role = "None";
|
||||
} else {
|
||||
role = message.mentions.roles.first().id;
|
||||
role = message.mentions.roles.first()?.id;
|
||||
}
|
||||
|
||||
if (isNaN(parseInt(args[1]))) {
|
||||
|
||||
+5
-47
@@ -93,7 +93,7 @@ module.exports = {
|
||||
const embed = new EmbedBuilder()
|
||||
.setTitle("Hack Impossible")
|
||||
.setDescription(
|
||||
`❌ Vous avez déjà hack une team récemment. Veuillez attendre ${Math.floor((lastHack + 7200000 - Date.now()) / 60000)} minutes avant de pouvoir ajouter une reputation à nouveau.`,
|
||||
`❌ Vous avez déjà hack une team récemment. Veuillez attendre ${Math.floor((lastHack + 7200000 - Date.now()) / 60000)} minutes avant de pouvoir hacker à nouveau.`,
|
||||
)
|
||||
.setColor(await embedColor(message.author.id, message.guild.id))
|
||||
.setTimestamp()
|
||||
@@ -150,57 +150,15 @@ module.exports = {
|
||||
text: `Demandé par ${message.author.tag}`,
|
||||
iconURL: message.author.displayAvatarURL(),
|
||||
});
|
||||
|
||||
if (team.padlock == 1) {
|
||||
db.run(
|
||||
`UPDATE users SET bank =? WHERE guildId =? AND userId =?`,
|
||||
[user.bank + team.bank, message.guild.id, message.author.id],
|
||||
(err) => {
|
||||
if (err) {
|
||||
console.log(`${err}`.red);
|
||||
}
|
||||
},
|
||||
);
|
||||
db.run(
|
||||
`UPDATE teams SET bank = 0 WHERE guildId =? AND userId =?`,
|
||||
[message.guild.id, message.author.id],
|
||||
(err) => {
|
||||
if (err) {
|
||||
console.log(`${err}`.red);
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
const embed2 = new EmbedBuilder()
|
||||
.setTitle("Vole de la banque !")
|
||||
.setDescription("Vous n'avez pas reussi à casser un cadenas de la team `" + team.name + "`, qui à donc, toujours, `" + team.padlock + "` cadenas.")
|
||||
.setColor(await embedColor(message.author.id, message.guild.id))
|
||||
.setTimestamp()
|
||||
.setImage("")
|
||||
.setFooter({
|
||||
text: `Demandé par ${message.author.tag}`,
|
||||
iconURL: message.author.displayAvatarURL(),
|
||||
});
|
||||
|
||||
message.reply({
|
||||
embeds: [embed, embed2],
|
||||
allowedMentions: { repliedUser: false },
|
||||
});
|
||||
} else {
|
||||
message.reply({
|
||||
embeds: [embed],
|
||||
allowedMentions: { repliedUser: false },
|
||||
});
|
||||
}
|
||||
} else {
|
||||
const embed = new EmbedBuilder()
|
||||
.setTitle("Erreur lors du hack !")
|
||||
.setDescription(
|
||||
"Vous n'avez pas reussi à casser un cadenas de la team `" +
|
||||
team.name +
|
||||
"`, qui à donc, toujours, `" +
|
||||
team.padlock +
|
||||
"` cadenas.",
|
||||
team.name +
|
||||
"`, qui à donc, toujours, `" +
|
||||
team.padlock +
|
||||
"` cadenas.",
|
||||
)
|
||||
.setColor(await embedColor(message.author.id, message.guild.id))
|
||||
.setTimestamp()
|
||||
|
||||
@@ -12,17 +12,21 @@ module.exports = {
|
||||
async execute(message, args, client) {
|
||||
if (args.length > 0) {
|
||||
let subCommand = args[0].toLowerCase();
|
||||
subCommand = subCommand.replice("n", "name");
|
||||
subCommand = subCommand.replice("nom", "name");
|
||||
subCommand = subCommand.replice("noms", "name");
|
||||
subCommand = subCommand.replice("banniere", "banner");
|
||||
subCommand = subCommand.replice("bannière", "banner");
|
||||
subCommand = subCommand.replice("b", "banner");
|
||||
subCommand = subCommand.replice("i", "icon");
|
||||
subCommand = subCommand.replice("p", "icon");
|
||||
subCommand = subCommand.replice("photo", "icon");
|
||||
subCommand = subCommand.replice("icone", "icon");
|
||||
subCommand = subCommand.replice("d", "description");
|
||||
if (!["name", "banner", "icon", "description"].includes(subCommand)) {
|
||||
subCommand = subCommand.replace("nom", "name");
|
||||
subCommand = subCommand.replace("banniere", "banner");
|
||||
subCommand = subCommand.replace("bannière", "banner");
|
||||
subCommand = subCommand.replace("photo", "icon");
|
||||
subCommand = subCommand.replace("icone", "icon");
|
||||
if (!["name", "banner", "icon", "description"].includes(subCommand)) {
|
||||
subCommand = subCommand.replace("d", "description");
|
||||
subCommand = subCommand.replace("n", "name");
|
||||
subCommand = subCommand.replace("i", "icon");
|
||||
subCommand = subCommand.replace("p", "icon");
|
||||
subCommand = subCommand.replace("b", "banner");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const newValue = args.slice(1).join(" ");
|
||||
|
||||
@@ -56,7 +60,7 @@ module.exports = {
|
||||
const embed = new EmbedBuilder()
|
||||
.setTitle("🖋️ Modification de team")
|
||||
.setDescription(
|
||||
"❌ Vous devez spécifier ce que vous voulez modifier (name, banner, icon ou description).",
|
||||
"❌ Vous devez spécifier ce que vous voulez modifier (nom, banner, icon ou description).",
|
||||
)
|
||||
.setColor(await embedColor(message.author.id, message.guild.id))
|
||||
.setTimestamp()
|
||||
|
||||
@@ -6,11 +6,26 @@ module.exports = {
|
||||
aliases: ["tcadena"],
|
||||
description: "Ajoute un cadenas à une team. (max : 5, coût : 3reputation)",
|
||||
emote: "🔒",
|
||||
utilisation: "<team-id>",
|
||||
utilisation: "[team-id]",
|
||||
permission: 0,
|
||||
|
||||
async execute(message, args, client) {
|
||||
const teamID = args[0]
|
||||
const user = await new Promise((resolve, reject) => {
|
||||
db.get(
|
||||
`SELECT * FROM users WHERE guildId = ? AND userId = ?`,
|
||||
[message.guild.id, message.author.id],
|
||||
(err, row) => {
|
||||
if (err) reject(err);
|
||||
resolve(row);
|
||||
},
|
||||
);
|
||||
});
|
||||
let teamID;
|
||||
if (args) {
|
||||
teamID = args[0]
|
||||
} else (
|
||||
teamID = user.teamId
|
||||
)
|
||||
const team = await new Promise((resolve, reject) => {
|
||||
db.get(
|
||||
`SELECT * FROM teams WHERE guildId = ? AND id = ?`,
|
||||
|
||||
@@ -96,8 +96,8 @@ module.exports = {
|
||||
|
||||
const team = await new Promise((resolve, reject) => {
|
||||
db.get(
|
||||
`SELECT * FROM users WHERE guildId = ? AND userId = ?`,
|
||||
[message.guild.id, message.author.id],
|
||||
`SELECT * FROM teams WHERE guildId = ? AND id = (SELECT teamId FROM users WHERE guildId = ? AND userId = ?)`,
|
||||
[message.guild.id, message.guild.id, message.author.id],
|
||||
(err, row) => {
|
||||
if (err) reject(err);
|
||||
resolve(row);
|
||||
@@ -120,13 +120,8 @@ module.exports = {
|
||||
allowedMentions: { repliedUser: false },
|
||||
});
|
||||
} else {
|
||||
db.run(
|
||||
`UPDATE users SET pocket = pocket - ?, teamDroper = teamDroper + ? WHERE guildId = ? AND userId = ?`,
|
||||
[amout, amout, message.guild.id, message.author.id],
|
||||
);
|
||||
db.run(`UPDATE teams SET bank = bank + ? WHERE guildId = ? AND id = ?`,
|
||||
[ amout, message.guild.id, team.id ]
|
||||
);
|
||||
db.run(`UPDATE users SET pocket = pocket - ?, teamDroper = teamDroper + ? WHERE guildId = ? AND userId = ?`, [amout, amout, message.guild.id, message.author.id]);
|
||||
db.run(`UPDATE teams SET bank = bank + ? WHERE guildId = ? AND id = ?`, [amout, message.guild.id, team.id]);
|
||||
|
||||
const embed = new EmbedBuilder()
|
||||
.setTitle("Dépôt Effectué")
|
||||
|
||||
+8
-24
@@ -10,24 +10,6 @@ module.exports = {
|
||||
permission: 0,
|
||||
|
||||
async execute(message, args, client) {
|
||||
if (!args[0]) {
|
||||
const embed = new EmbedBuilder()
|
||||
.setTitle("Ajout Impossible")
|
||||
.setDescription(`❌ Veuillez indiquer l'id une team.`)
|
||||
.setColor(await embedColor(message.author.id, message.guild.id))
|
||||
.setTimestamp()
|
||||
.setFooter({
|
||||
text: `Demandé par ${message.author.tag}`,
|
||||
iconURL: message.author.displayAvatarURL(),
|
||||
});
|
||||
|
||||
return message.reply({
|
||||
embeds: [embed],
|
||||
allowedMentions: { repliedUser: false },
|
||||
});
|
||||
}
|
||||
const teamID = args[0].toLowerCase();
|
||||
|
||||
const user = await new Promise((resolve, reject) => {
|
||||
db.get(
|
||||
`SELECT * FROM users WHERE guildId = ? AND userId = ?`,
|
||||
@@ -40,6 +22,13 @@ module.exports = {
|
||||
});
|
||||
const lastTrep = user.lastTrep;
|
||||
|
||||
let teamID;
|
||||
if (!args[0]) {
|
||||
teamID = user.teamId
|
||||
} else {
|
||||
teamID = args[0].toLowerCase();
|
||||
}
|
||||
|
||||
const team = await new Promise((resolve, reject) => {
|
||||
db.get(
|
||||
`SELECT * FROM teams WHERE guildId = ? AND id = ?`,
|
||||
@@ -110,12 +99,7 @@ module.exports = {
|
||||
|
||||
const embed = new EmbedBuilder()
|
||||
.setTitle("Reputation ajouté !")
|
||||
.setDescription(
|
||||
"Vous avez ajouter une reputation à la team `" +
|
||||
team.name +
|
||||
"`, qui a maintement `" +
|
||||
(team.reputation + 1) +
|
||||
"` reputation !",
|
||||
.setDescription(await "Vous avez ajouter une reputation à la team `" + team.name + "`, qui a maintement `" + (team.reputation + 1) + "` reputation !",
|
||||
)
|
||||
.setColor(await embedColor(message.author.id, message.guild.id))
|
||||
.setTimestamp()
|
||||
|
||||
@@ -18,7 +18,7 @@ module.exports = {
|
||||
},
|
||||
);
|
||||
});
|
||||
if (user.blacklist == true) {
|
||||
if (user.blacklist == 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -39,8 +39,10 @@ module.exports = {
|
||||
message.member,
|
||||
);
|
||||
if (
|
||||
permissionLevel < command.permission &&
|
||||
!client.config.owners.includes(message.author.id)
|
||||
(permissionLevel <= command.permission) &&
|
||||
(client.config.owners.includes(!message.author.id) /*||
|
||||
(!message.guild.ownerId == message.author.id)*/
|
||||
)
|
||||
) {
|
||||
return message.reply(
|
||||
"Vous n'avez pas la permission d'utiliser cette commande.",
|
||||
@@ -50,7 +52,7 @@ module.exports = {
|
||||
try {
|
||||
command.execute(message, args, client);
|
||||
console.log(
|
||||
`[${prefix}}] ${message.guild.name} | ${message.author.tag} | ${command.name}`
|
||||
`[${prefix}] ${message.guild.name} | ${message.author.tag} | ${command.name}`
|
||||
.blue,
|
||||
);
|
||||
loggT(
|
||||
|
||||
@@ -19,7 +19,7 @@ module.exports = {
|
||||
},
|
||||
);
|
||||
});
|
||||
if (user.blacklist == true) {
|
||||
if (user.blacklist == 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
+12
-3
@@ -45,6 +45,7 @@ module.exports = {
|
||||
guild.members.cache
|
||||
.filter((member) => member.voice.channel)
|
||||
.forEach((member) => {
|
||||
if (member.bot == true) return
|
||||
if (member.voice.selfMute == true) {
|
||||
db.run(
|
||||
"UPDATE users SET pocket = pocket + 50 WHERE guildId = ? AND userId = ?",
|
||||
@@ -68,6 +69,7 @@ module.exports = {
|
||||
guild.members.cache
|
||||
.filter((member) => member.voice.channel && member.voice.streaming)
|
||||
.forEach((member) => {
|
||||
if (member.bot == true) return
|
||||
db.run(
|
||||
"UPDATE users SET pocket = pocket + 200 WHERE guildId = ? AND userId = ?",
|
||||
[guild.id, member.id],
|
||||
@@ -80,6 +82,7 @@ module.exports = {
|
||||
guild.members.cache
|
||||
.filter((member) => member.voice.channel && member.voice.selfVideo)
|
||||
.forEach((member) => {
|
||||
if (member.bot == true) return
|
||||
db.run(
|
||||
"UPDATE users SET pocket = pocket + 200 WHERE guildId = ? AND userId = ?",
|
||||
[guild.id, member.id],
|
||||
@@ -93,7 +96,7 @@ module.exports = {
|
||||
},
|
||||
15 * 60 * 1000,
|
||||
);
|
||||
|
||||
/*
|
||||
setInterval(
|
||||
async () => {
|
||||
const team = await new Promise((resolve, reject) => {
|
||||
@@ -108,11 +111,13 @@ module.exports = {
|
||||
},
|
||||
1 * 60 * 1000,
|
||||
);
|
||||
|
||||
*/
|
||||
//AntiCrash
|
||||
process.on("unhandledRejection", (error) => {
|
||||
if (error.code == "10064") return;
|
||||
if (error.code == "10062") return;
|
||||
if (error.code == "10008") return;
|
||||
if (error.code == "50007") return;
|
||||
console.log(" [antiCrash] :: Unhandled Rejection/Catch".red);
|
||||
console.log(`${error}`.grey);
|
||||
loggE(error);
|
||||
@@ -120,7 +125,8 @@ module.exports = {
|
||||
|
||||
process.on("uncaughtException", (error, origin) => {
|
||||
if (error.code == "10064") return;
|
||||
if (error.code == "10008") return;
|
||||
if (error.code == "10008") return;
|
||||
if (error.code == "10062") return;
|
||||
console.log(" [antiCrash] :: Uncaught Exception/Catch".red);
|
||||
console.log(`${error}`.grey);
|
||||
console.log("Information supplémentaire:", origin);
|
||||
@@ -129,6 +135,7 @@ module.exports = {
|
||||
|
||||
process.on("uncaughtExceptionMonitor", (error, origin) => {
|
||||
if (error.code == "10064") return;
|
||||
if (error.code == "10062") return;
|
||||
if (error.code == "10008") return;
|
||||
console.log(" [antiCrash] :: Uncaught Exception Monitor/Catch".red);
|
||||
console.log(`${error}`.grey);
|
||||
@@ -139,6 +146,7 @@ module.exports = {
|
||||
process.on("beforeExit", (code) => {
|
||||
if (error.code == "10064") return;
|
||||
if (error.code == "10008") return;
|
||||
if (error.code == "10062") return;
|
||||
console.log(" [antiCrash] :: Before Exit".red);
|
||||
console.log("Code de sortie:", code);
|
||||
});
|
||||
@@ -146,6 +154,7 @@ module.exports = {
|
||||
process.on("exit", (code) => {
|
||||
if (error.code == "10064") return;
|
||||
if (error.code == "10008") return;
|
||||
if (error.code == "10062") return;
|
||||
console.log(" [antiCrash] :: Exit".red);
|
||||
console.log("Code de sortie:", code);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user