mirror of
https://github.com/arthur-pbty/bot-discord-coins.git
synced 2026-06-03 23:36:29 +02:00
Update top (ajout de top team)
This commit is contained in:
+34
-4
@@ -3,10 +3,10 @@ const db = require('../../fonctions/database.js');
|
|||||||
const embedColor = require('../../fonctions/embedColor.js');
|
const embedColor = require('../../fonctions/embedColor.js');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
aliases: ['leaderboard', 'lb'],
|
aliases: ['leaderboard', 'lb', 'ttop'],
|
||||||
description: 'Affiche le top 10 des membres du serveur.',
|
description: 'Affiche le top 10 des membres/teams du serveur.',
|
||||||
emote: '🏆',
|
emote: '🏆',
|
||||||
utilisation: '[global|pocket|bank|reputation|niveau|teamdonnateur]',
|
utilisation: '[global|pocket|bank|reputation|niveau|team|teamreputation|teamdonnateur]',
|
||||||
permission: 0,
|
permission: 0,
|
||||||
|
|
||||||
async execute(message, args, client) {
|
async execute(message, args, client) {
|
||||||
@@ -20,6 +20,10 @@ module.exports = {
|
|||||||
args[0] = 'reputation'
|
args[0] = 'reputation'
|
||||||
} else if (args[0] === 'niveau' || args[0] === 'lvl' || args[0] === 'level' || args[0] === 'lvl') {
|
} else if (args[0] === 'niveau' || args[0] === 'lvl' || args[0] === 'level' || args[0] === 'lvl') {
|
||||||
args[0] = 'niveau'
|
args[0] = 'niveau'
|
||||||
|
} else if (args[0] === 'team' || args[0] === 't') {
|
||||||
|
args[0] = 'team'
|
||||||
|
} else if (args[0] === 'teamreputation' || args[0] === 'treputation' || args[0] === 'teamrep' || args[0] === 'trep') {
|
||||||
|
args[0] = 'team'
|
||||||
} else if (args[0] === 'teamdonnateur' || args[0] === ' tdonnateur' || args[0] === 'tdroper' || args[0] === ' tdropper' || args[0] === ' teamdrop' || args[0] === 'tdrop' || args[0] === 'teamdroper' || args[0] === 'teamdropper') {
|
} else if (args[0] === 'teamdonnateur' || args[0] === ' tdonnateur' || args[0] === 'tdroper' || args[0] === ' tdropper' || args[0] === ' teamdrop' || args[0] === 'tdrop' || args[0] === 'teamdroper' || args[0] === 'teamdropper') {
|
||||||
args[0] = 'teamdroper'
|
args[0] = 'teamdroper'
|
||||||
} else if (!args[0]) {
|
} else if (!args[0]) {
|
||||||
@@ -29,7 +33,7 @@ module.exports = {
|
|||||||
message.reply({ embeds: [
|
message.reply({ embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setTitle('Argument invalide')
|
.setTitle('Argument invalide')
|
||||||
.setDescription(`Vous pouvez utiliser les arguments suivants: \`coins\`, \`pocket\`, \`bank\`, \`reputation\`, \`niveau\` ou ne rien mettre pour afficher le top 10 des membres du serveur.`)
|
.setDescription(`Vous pouvez utiliser les arguments suivants: \`coins\`, \`pocket\`, \`bank\`, \`reputation\`, \`niveau\`, \`team\`, \`teamreputation\`, \`teamdonnateur\`, ou ne rien mettre pour afficher le top 10 des membres du serveur.`)
|
||||||
.setColor(await embedColor(message.author.id, message.guild.id))
|
.setColor(await embedColor(message.author.id, message.guild.id))
|
||||||
.setTimestamp()
|
.setTimestamp()
|
||||||
.setFooter({ text: `Demandé par ${message.author.tag}`, iconURL: message.author.displayAvatarURL() })
|
.setFooter({ text: `Demandé par ${message.author.tag}`, iconURL: message.author.displayAvatarURL() })
|
||||||
@@ -73,6 +77,20 @@ module.exports = {
|
|||||||
resolve(rows);
|
resolve(rows);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
} else if (type === 'team') {
|
||||||
|
data = await new Promise((resolve, reject) => {
|
||||||
|
db.all(`SELECT name, bank AS coins FROM teams WHERE guildId = ? ORDER BY coins DESC LIMIT 10`, [message.guild.id], (err, rows) => {
|
||||||
|
if (err) reject(err);
|
||||||
|
resolve(rows);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
} else if (type === 'teamreputation') {
|
||||||
|
data = await new Promise((resolve, reject) => {
|
||||||
|
db.all(`SELECT name, reputation AS teams FROM users WHERE guildId = ? ORDER BY coins DESC LIMIT 10`, [message.guild.id], (err, rows) => {
|
||||||
|
if (err) reject(err);
|
||||||
|
resolve(rows);
|
||||||
|
});
|
||||||
|
});
|
||||||
} else if (type === 'teamdroper') {
|
} else if (type === 'teamdroper') {
|
||||||
data = await new Promise((resolve, reject) => {
|
data = await new Promise((resolve, reject) => {
|
||||||
db.all(`SELECT userId, teamdroper AS coins FROM users WHERE guildId = ? ORDER BY coins DESC LIMIT 10`, [message.guild.id], (err, rows) => {
|
db.all(`SELECT userId, teamdroper AS coins FROM users WHERE guildId = ? ORDER BY coins DESC LIMIT 10`, [message.guild.id], (err, rows) => {
|
||||||
@@ -88,6 +106,8 @@ module.exports = {
|
|||||||
bank: '🏦',
|
bank: '🏦',
|
||||||
reputation: '🔺',
|
reputation: '🔺',
|
||||||
niveau: '📊',
|
niveau: '📊',
|
||||||
|
team: '👑',
|
||||||
|
teamreputation: '🔺',
|
||||||
teamdroper: '🎁'
|
teamdroper: '🎁'
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -150,6 +170,16 @@ module.exports = {
|
|||||||
.setEmoji('📊')
|
.setEmoji('📊')
|
||||||
.setDescription('Affiche le top en fonction du niveau')
|
.setDescription('Affiche le top en fonction du niveau')
|
||||||
.setValue('niveau'),
|
.setValue('niveau'),
|
||||||
|
new StringSelectMenuOptionBuilder()
|
||||||
|
.setLabel('Teams bank')
|
||||||
|
.setEmoji('👑')
|
||||||
|
.setDescription('Affiche le top en fonction de l\'argent des teams')
|
||||||
|
.setValue('team'),
|
||||||
|
new StringSelectMenuOptionBuilder()
|
||||||
|
.setLabel('Teams réputation')
|
||||||
|
.setEmoji('🔺')
|
||||||
|
.setDescription('Affiche le top en fonction de la réputation des teams')
|
||||||
|
.setValue('teamreputation'),
|
||||||
new StringSelectMenuOptionBuilder()
|
new StringSelectMenuOptionBuilder()
|
||||||
.setLabel('TeamDroper')
|
.setLabel('TeamDroper')
|
||||||
.setEmoji('🎁')
|
.setEmoji('🎁')
|
||||||
|
|||||||
Reference in New Issue
Block a user