mirror of
https://github.com/arthur-pbty/gestion.git
synced 2026-06-19 13:46:56 +02:00
grand commit que tutur attend ( marche pas le raidmode en dev)
sinon il y a pleins de truc comme les anti raid , des coorectif ect
This commit is contained in:
@@ -9,10 +9,22 @@ module.exports = {
|
||||
utilisation: 'rolelimit',
|
||||
category: 'antiraid',
|
||||
|
||||
async execute(interaction) {
|
||||
const botId = interaction.client.user.id;
|
||||
const guildId = interaction.guild.id;
|
||||
|
||||
async execute(message, args, client) {
|
||||
const botId = message.client.user.id;
|
||||
const guildId = message.guild.id;
|
||||
const clear = args[0] === "clear"
|
||||
console.log(clear)
|
||||
if (args[0] === "clear") {
|
||||
db.run('DELETE FROM gestion WHERE id LIKE ?', [`${botId}.${guildId}.rolelimits%`], (err) => {
|
||||
if (err) {
|
||||
console.error(err.message);
|
||||
return message.reply('Une erreur s\'est produite lors de la suppression des rôles limités.');
|
||||
} else {
|
||||
return message.reply('Tous les rôles limités ont été supprimés avec succès.');
|
||||
}
|
||||
});
|
||||
|
||||
}else {
|
||||
let limitedRoles = await new Promise((resolve, reject) => {
|
||||
db.get('SELECT value FROM gestion WHERE id = ?', [`${botId}.${guildId}.rolelimits`], (err, row) => {
|
||||
if (err) {
|
||||
@@ -27,7 +39,6 @@ module.exports = {
|
||||
limitedRoles = [];
|
||||
}
|
||||
|
||||
// Crée un embed avec les rôles limités
|
||||
const embed = new EmbedBuilder()
|
||||
.setTitle('Rôles limités')
|
||||
.setDescription(limitedRoles.map(role => `<@&${role.id}>: ${role.limit}`).join('\n') || 'Aucun rôle limité.')
|
||||
@@ -45,7 +56,7 @@ module.exports = {
|
||||
.setStyle(ButtonStyle.Danger);
|
||||
const row = new ActionRowBuilder()
|
||||
.addComponents(addButton, removeButton);
|
||||
const sentMessage = await interaction.reply({ embeds: [embed], components: [row], fetchReply: true });
|
||||
const sentMessage = await message.reply({ embeds: [embed], components: [row], fetchReply: true });
|
||||
|
||||
|
||||
const filter = i => i.isButton() && i.customId.startsWith('rolelimit_') && i.user;
|
||||
@@ -57,7 +68,7 @@ module.exports = {
|
||||
const questionMessage = await i.reply('Mentionnez un rôle ou fournissez un ID de rôle à limiter.');
|
||||
const filter = m => m.author && m.author.id === i.user.id;
|
||||
const collected = await i.channel.awaitMessages({ filter, max: 1, time: 60000 });
|
||||
const role = collected.first().mentions.roles.first() || interaction.guild.roles.cache.get(collected.first().content);
|
||||
const role = collected.first().mentions.roles.first() || message.guild.roles.cache.get(collected.first().content);
|
||||
if (!role) {
|
||||
return i.followUp('Rôle invalide.');
|
||||
}
|
||||
@@ -103,7 +114,7 @@ module.exports = {
|
||||
const questionMessage = await i.reply('Mentionnez un rôle ou fournissez un ID de rôle à supprimer.');
|
||||
const filter = m => m.author && m.author.id === i.user.id;
|
||||
const collected = await i.channel.awaitMessages({ filter, max: 1, time: 60000 });
|
||||
const roleToRemove = collected.first().mentions.roles.first() || interaction.guild.roles.cache.get(collected.first().content);
|
||||
const roleToRemove = collected.first().mentions.roles.first() || message.guild.roles.cache.get(collected.first().content);
|
||||
if (!roleToRemove) {
|
||||
return i.followUp('Rôle invalide.');
|
||||
}
|
||||
@@ -134,5 +145,6 @@ module.exports = {
|
||||
collector.on('end', collected => {
|
||||
sentMessage.edit({ components: [] });
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user