-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
40 changed files
with
2,428 additions
and
1,515 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
node_modules | ||
.git | ||
.vs_code | ||
.idea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"env": { | ||
"node": true, | ||
"es2021": true | ||
}, | ||
"extends": [ | ||
"prettier", | ||
"eslint:recommended", | ||
"plugin:prettier/recommended" | ||
], | ||
"parserOptions": { | ||
"ecmaVersion": 2021, | ||
"sourceType": "module" | ||
}, | ||
"plugins": ["prettier"], | ||
"rules": { | ||
"no-console": "warn", | ||
"prefer-const": "error", | ||
"no-var": "error", | ||
"prettier/prettier": "error", | ||
"eqeqeq": "error" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
node_modules | ||
.git | ||
.vs_code | ||
.idea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"printWidth": 80, | ||
"tabWidth": 2, | ||
"useTabs": false, | ||
"semi": true, | ||
"singleQuote": false, | ||
"bracketSpacing": true, | ||
"arrowParens": "avoid", | ||
"endOfLine": "lf" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,99 @@ | ||
const { SlashCommandBuilder } = require('@discordjs/builders'); | ||
const { MessageButton, MessageActionRow, MessageEmbed} = require('discord.js'); | ||
const {isMod, isAdmin} = require("../functions/isModOrAdmin"); | ||
const { SlashCommandBuilder } = require("@discordjs/builders"); | ||
const { MessageButton, MessageActionRow, MessageEmbed } = require("discord.js"); | ||
const { isMod, isAdmin } = require("../functions/isModOrAdmin"); | ||
|
||
module.exports = { | ||
data: new SlashCommandBuilder() | ||
.setName('ban') | ||
.setDescription('Bannir un membre (ADMIN).') | ||
.addUserOption(option => option.setName('utilisateur').setDescription('Le membre à bannir').setRequired(true)) | ||
.addStringOption(option => option.setName('raison').setDescription('La raison pour laquelle bannir le membre').setRequired(true)), | ||
async execute(client, interaction) { | ||
const author = interaction.member; | ||
const user = interaction.options.getMember('utilisateur'); | ||
const row = new MessageActionRow() | ||
.addComponents( | ||
new MessageButton() | ||
.setCustomId('oui') | ||
.setLabel('Oui') | ||
.setStyle('SUCCESS'), | ||
new MessageButton() | ||
.setCustomId('non') | ||
.setLabel('Non') | ||
.setStyle('DANGER'), | ||
); | ||
if (!isMod(client, interaction.member) && !isAdmin(client, interaction.member) && !interaction.member.permissions.has("BAN_MEMBERS")) { | ||
return interaction.reply({ content: `Vous n'avez pas le droit d'exécuter cette commande !`, ephemeral: true }) | ||
} | ||
interaction.reply({ content: 'Voulez-vous bannir ' + user.user.username + "#" + user.user.discriminator + ' ?', components: [row], ephemeral: true }) | ||
const filter = i => i.user.id === author.id; | ||
data: new SlashCommandBuilder() | ||
.setName("ban") | ||
.setDescription("Bannir un membre (ADMIN).") | ||
.addUserOption(option => | ||
option | ||
.setName("utilisateur") | ||
.setDescription("Le membre à bannir") | ||
.setRequired(true) | ||
) | ||
.addStringOption(option => | ||
option | ||
.setName("raison") | ||
.setDescription("La raison pour laquelle bannir le membre") | ||
.setRequired(true) | ||
), | ||
async execute(client, interaction) { | ||
const author = interaction.member; | ||
const user = interaction.options.getMember("utilisateur"); | ||
const row = new MessageActionRow().addComponents( | ||
new MessageButton() | ||
.setCustomId("oui") | ||
.setLabel("Oui") | ||
.setStyle("SUCCESS"), | ||
new MessageButton().setCustomId("non").setLabel("Non").setStyle("DANGER") | ||
); | ||
if ( | ||
!isMod(client, interaction.member) && | ||
!isAdmin(client, interaction.member) && | ||
!interaction.member.permissions.has("BAN_MEMBERS") | ||
) { | ||
return interaction.reply({ | ||
content: "Vous n'avez pas le droit d'exécuter cette commande !", | ||
ephemeral: true, | ||
}); | ||
} | ||
interaction.reply({ | ||
content: | ||
"Voulez-vous bannir " + | ||
user.user.username + | ||
"#" + | ||
user.user.discriminator + | ||
" ?", | ||
components: [row], | ||
ephemeral: true, | ||
}); | ||
const filter = i => i.user.id === author.id; | ||
|
||
const collector = interaction.channel.createMessageComponentCollector({ filter, time: 15000 }); | ||
const collector = interaction.channel.createMessageComponentCollector({ | ||
filter, | ||
time: 15000, | ||
}); | ||
|
||
const reason = interaction.options.getString('raison'); | ||
const reason = interaction.options.getString("raison"); | ||
|
||
collector.on('collect', async i => { | ||
if (i.customId === 'oui') { | ||
await user.send('Vous avez été banni de ' + interaction.guild.name + ' pour :\n`' + reason + "`"); | ||
await user.ban({reason: reason}) | ||
collector.on("collect", async i => { | ||
if (i.customId === "oui") { | ||
await user.send( | ||
"Vous avez été banni de " + | ||
interaction.guild.name + | ||
" pour :\n`" + | ||
reason + | ||
"`" | ||
); | ||
await user.ban({ reason: reason }); | ||
|
||
const embed = new MessageEmbed() | ||
.setAuthor("Membre banni") | ||
.setColor("#ff1500") | ||
.setTimestamp(Date.now()) | ||
.setThumbnail(user.avatarURL({ dynamic: true })) | ||
.addField("Utilisateur :", `${user.id}`, true) | ||
.addField("Modérateur :", `<@${author.id}>`, true) | ||
.addField("Raison :", reason, true) | ||
const embed = new MessageEmbed() | ||
.setAuthor("Membre banni") | ||
.setColor("#ff1500") | ||
.setTimestamp(Date.now()) | ||
.setThumbnail(user.avatarURL({ dynamic: true })) | ||
.addField("Utilisateur :", `${user.id}`, true) | ||
.addField("Modérateur :", `<@${author.id}>`, true) | ||
.addField("Raison :", reason, true); | ||
|
||
const channel = await interaction.guild.channels.fetch(client.config.logs.modChannelId) | ||
await channel.send({ embeds: [embed] }) | ||
const channel = await interaction.guild.channels.fetch( | ||
client.config.logs.modChannelId | ||
); | ||
await channel.send({ embeds: [embed] }); | ||
|
||
await i.update({ content: 'Vous avez banni ' + user.user.username + "#" + user.user.discriminator + ' avec succès !', components: [] }); | ||
}else{ | ||
await i.update({ content: 'Opération annulée !', components: [] }); | ||
} | ||
}); | ||
}, | ||
await i.update({ | ||
content: | ||
"Vous avez banni " + | ||
user.user.username + | ||
"#" + | ||
user.user.discriminator + | ||
" avec succès !", | ||
components: [], | ||
}); | ||
} else { | ||
await i.update({ content: "Opération annulée !", components: [] }); | ||
} | ||
}); | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,25 @@ | ||
const { SlashCommandBuilder } = require('@discordjs/builders'); | ||
const { Permissions } = require('discord.js') | ||
const { SlashCommandBuilder } = require("@discordjs/builders"); | ||
const { Permissions } = require("discord.js"); | ||
|
||
module.exports = { | ||
data: new SlashCommandBuilder() | ||
.setName('initcount') | ||
.setDescription('Initialiser le système de comptage (ADMIN).'), | ||
async execute(client, interaction) { | ||
const author = interaction.member; | ||
if (!author.permissions.has(Permissions.FLAGS.ADMINISTRATOR)) { | ||
return interaction.reply({ content: `Vous n'avez pas le droit d'exécuter cette commande !`, ephemeral: true }) | ||
} | ||
await client.countdb.set(`${interaction.guild.id}`, ({author: "null", currentNumber: 0})); | ||
interaction.reply({ content: `Système de comptage initialisé !`, ephemeral: true }) | ||
}, | ||
}; | ||
data: new SlashCommandBuilder() | ||
.setName("initcount") | ||
.setDescription("Initialiser le système de comptage (ADMIN)."), | ||
async execute(client, interaction) { | ||
const author = interaction.member; | ||
if (!author.permissions.has(Permissions.FLAGS.ADMINISTRATOR)) { | ||
return interaction.reply({ | ||
content: "Vous n'avez pas le droit d'exécuter cette commande !", | ||
ephemeral: true, | ||
}); | ||
} | ||
await client.countdb.set(`${interaction.guild.id}`, { | ||
author: "null", | ||
currentNumber: 0, | ||
}); | ||
interaction.reply({ | ||
content: "Système de comptage initialisé !", | ||
ephemeral: true, | ||
}); | ||
}, | ||
}; |
Oops, something went wrong.