mirror of
https://github.com/arthur-pbty/bot-discord-coins.git
synced 2026-06-03 23:36:29 +02:00
Update kill.js
This commit is contained in:
+25
-3
@@ -4,7 +4,7 @@ const embedColor = require('../../fonctions/embedColor.js');
|
||||
|
||||
module.exports = {
|
||||
aliases: [],
|
||||
description: 'Vole les reputations d\'un membre.',
|
||||
description: 'Vole des reputations à un membre. (coût 3rep)',
|
||||
emote: '🦹',
|
||||
utilisation: '<@membre>',
|
||||
permission: 0,
|
||||
@@ -49,7 +49,16 @@ module.exports = {
|
||||
|
||||
const memberRep = memberInfo.reputation;
|
||||
|
||||
if (memberRep <= 0) {
|
||||
if (memberRep < 3) {
|
||||
const embed = new EmbedBuilder()
|
||||
.setTitle('Erreur')
|
||||
.setDescription('❌ Vous devez avoir `3`reputation.')
|
||||
.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 } });
|
||||
} else if (memberRep <= 0) {
|
||||
const embed = new EmbedBuilder()
|
||||
.setTitle('Erreur')
|
||||
.setDescription(`❌ <@${member.id}> n'a pas de reputation.`)
|
||||
@@ -59,10 +68,12 @@ module.exports = {
|
||||
|
||||
return message.reply({ embeds: [embed], allowedMentions: { repliedUser: false } });
|
||||
}
|
||||
|
||||
if (Math.floor(Math.random() * 5) <= 1) {
|
||||
|
||||
const amount = Math.floor(Math.random() * memberRep) + 1;
|
||||
db.run(`UPDATE users SET reputation = reputation - ? WHERE guildId = ? AND userId = ?`, [amount, message.guild.id, member.id]);
|
||||
db.run(`UPDATE users SET reputation = reputation + ?, lastKill = ? WHERE guildId = ? AND userId = ?`, [amount, Date.now(), message.guild.id, message.author.id]);
|
||||
db.run(`UPDATE users SET reputation = reputation + ?, lastKill = ? WHERE guildId = ? AND userId = ?`, [amount - 3, Date.now(), message.guild.id, message.author.id]);
|
||||
|
||||
const embed = new EmbedBuilder()
|
||||
.setTitle('Vol')
|
||||
@@ -72,5 +83,16 @@ module.exports = {
|
||||
.setFooter({ text: `Demandé par ${message.author.tag}`, iconURL: message.author.displayAvatarURL() });
|
||||
|
||||
message.reply({ embeds: [embed], allowedMentions: { repliedUser: false } });
|
||||
|
||||
} else {
|
||||
const embed = new EmbedBuilder()
|
||||
.setTitle('Erreur lors du kill !')
|
||||
.setDescription('Vous n\'avez pas reussi à voler de reputation à <@' + member.id + '>, qui à donc, toujours, `' + memberRep + '` cadenas.')
|
||||
.setColor(await embedColor(message.author.id, message.guild.id))
|
||||
.setTimestamp()
|
||||
.setImage('https://cdn.discordapp.com/attachments/1173221717024448573/1188280123485601842/hacker-meme.gif?ex=6655d0da&is=66547f5a&hm=103ee9971cdb67eb528df4c6031e4da69366fb1d1c638f21d4ebf0ef34220691&')
|
||||
.setFooter({ text: `Demandé par ${message.author.tag}`, iconURL: message.author.displayAvatarURL() });
|
||||
|
||||
message.reply({ embeds: [embed], allowedMentions: { repliedUser: false } });}
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user