mirror of
https://github.com/arthur-pbty/gestion.git
synced 2026-06-21 22:05:04 +02:00
finished bl system
This commit is contained in:
@@ -1,33 +0,0 @@
|
|||||||
const { EmbedBuilder, User } = require("discord.js")
|
|
||||||
const permissionLevel = await getPermissionLevel(member, client);
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
name: 'kick',
|
|
||||||
description: 'Kick a member',
|
|
||||||
emote: '🔍',
|
|
||||||
utilisation: 'kick <@member> [reason]',
|
|
||||||
category: 'utils',
|
|
||||||
|
|
||||||
async execute(message, args, client) {
|
|
||||||
const member = message.mentions.members.first();
|
|
||||||
const reason = args.slice(1).join(' ') || 'Aucune raison spécifiée';
|
|
||||||
if (!member) {
|
|
||||||
return message.reply('Veuillez mentionner un membre à kick');
|
|
||||||
}
|
|
||||||
if (member.id === message.author.id) {
|
|
||||||
return message.reply('Vous ne pouvez pas vous kick vous même');
|
|
||||||
}
|
|
||||||
if (member.id === client.user.id) {
|
|
||||||
return message.reply('Vous ne pouvez pas me kick');
|
|
||||||
}
|
|
||||||
if (await permissionLevel(member, client) >= await permissionLevel(message.member, client)) {
|
|
||||||
return message.reply('Vous ne pouvez pas kick un membre avec une permission égale ou supérieure à la votre');
|
|
||||||
}
|
|
||||||
|
|
||||||
member.kick(reason).then(() => {
|
|
||||||
message.reply(`${member.user.tag} a bien été kick`);
|
|
||||||
}).catch((err) => {
|
|
||||||
message.reply(`Une erreur est survenue lors du kick de ${member.user.tag}`);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
};
|
|
||||||
@@ -2,7 +2,7 @@ const { Events, InteractionType } = require("discord.js");
|
|||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: Events.InteractionCreate,
|
name: Events.InteractionCreate,
|
||||||
async run(client, interaction) {
|
async execute(client, interaction) {
|
||||||
if (interaction.type === InteractionType.ApplicationCommand) {
|
if (interaction.type === InteractionType.ApplicationCommand) {
|
||||||
const command = client.commands.get(interaction.commandName);
|
const command = client.commands.get(interaction.commandName);
|
||||||
await command.execute(interaction, client);
|
await command.execute(interaction, client);
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
const { Events } = require("discord.js");
|
||||||
|
const db = require('quick.db');
|
||||||
|
const GestionDb = new db.table('gestion')
|
||||||
|
module.exports = {
|
||||||
|
name: Events.GuildMemberAdd,
|
||||||
|
once: false,
|
||||||
|
async execute(member, client) {
|
||||||
|
const userId = member.user.id;
|
||||||
|
const bl = await GestionDb.get(`${client.user.id}.bl`);
|
||||||
|
|
||||||
|
if (bl && bl[userId]) {
|
||||||
|
try {
|
||||||
|
await member.ban({ reason: 'Blacklisted' });
|
||||||
|
} catch (error) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
@@ -1,11 +1,9 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
name: 'messageDelete',
|
name: 'messageDelete',
|
||||||
once: false,
|
once: false,
|
||||||
execute(message, client) {
|
async execute(message, client) {
|
||||||
// Ignore les messages de bots
|
|
||||||
if (message.author.bot) return;
|
if (message.author.bot) return;
|
||||||
|
|
||||||
// Enregistre le message supprimé dans la collection snipes
|
|
||||||
client.snipes.set(message.channel.id, {
|
client.snipes.set(message.channel.id, {
|
||||||
content: message.content,
|
content: message.content,
|
||||||
author: message.author.id,
|
author: message.author.id,
|
||||||
|
|||||||
@@ -83,5 +83,3 @@ module.exports = (client) => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = { getPermissionLevel };
|
|
||||||
Reference in New Issue
Block a user