mirror of
https://github.com/arthur-pbty/gestion.git
synced 2026-06-27 06:27:51 +02:00
add owner , wl and blacklist
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
const { EmbedBuilder } = require('discord.js');
|
||||
const db = require('quick.db');
|
||||
const GestionDb = new db.table("gestion");
|
||||
|
||||
module.exports = {
|
||||
name: 'wl',
|
||||
description: 'Ajouter un utilisateur à la liste blanche ou afficher la liste blanche',
|
||||
async execute(message, args, client) {
|
||||
const botId = message.client.user.id;
|
||||
const guildId = message.guild.id;
|
||||
|
||||
if (args.length > 0) {
|
||||
const userId = args[0].replace(/<@!?(\d+)>/, '$1');
|
||||
let whitelist = await GestionDb.get(`${botId}.${guildId}.whitelist`) || {};
|
||||
|
||||
if (!whitelist[userId]) {
|
||||
whitelist[userId] = true;
|
||||
await GestionDb.set(`${botId}.${guildId}.whitelist`, whitelist);
|
||||
message.reply('Utilisateur ajouté à la liste blanche.');
|
||||
} else {
|
||||
message.reply('Cet utilisateur est déjà sur la liste blanche.');
|
||||
}
|
||||
} else {
|
||||
let whitelist = await GestionDb.get(`${botId}.${guildId}.whitelist`) || {};
|
||||
const embed = new EmbedBuilder()
|
||||
.setTitle('Liste blanche')
|
||||
.setDescription(Object.keys(whitelist).map(id => `<@${id}>`).join('\n') || 'Aucun utilisateur sur la liste blanche')
|
||||
.setFooter({ text: 'design by valou336', iconURL: client.user.displayAvatarURL({dynamic: true})});
|
||||
|
||||
message.channel.send({ embeds: [embed] });
|
||||
}
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user