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:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user