diff --git a/commands/botcontrol/reload.js b/commands/botcontrol/reload.js index 25eb9a2..f9be00f 100644 --- a/commands/botcontrol/reload.js +++ b/commands/botcontrol/reload.js @@ -4,28 +4,30 @@ module.exports = { emote: '🔄', utilisation: 'reload ', category: 'botcontrol', - execute(message, args) { + async execute(message, args) { const commandName = args[0].toLowerCase(); const command = message.client.commands.get(commandName); if (args[0].toLowerCase() === 'all') { message.reply('Toutes les commandes vont être rechargées.') - .then(sendmessage => { + .then(async sendmessage => { const commands = Array.from(message.client.commands.values()); - commands.forEach(command => { + const reloadPromises = commands.map(async (command) => { const commandFile = command.file; delete require.cache[require.resolve(commandFile)]; - + try { const newCommand = require(commandFile); newCommand.file = commandFile; message.client.commands.set(newCommand.name, newCommand); - sendmessage.edit(`La commande ${newCommand.name} a été rechargée.`); + await sendmessage.edit(`La commande ${newCommand.name} a été rechargée.`); } catch (error) { console.error(`Erreur lors du rechargement de la commande ${command.name}:`, error); - message.reply(`Une erreur est survenue lors du rechargement de la commande ${command.name}: ${error.message}`); + await message.reply(`Une erreur est survenue lors du rechargement de la commande ${command.name}: ${error.message}`); } }); - sendmessage.edit('Toutes les commandes ont été rechargées.'); + + await Promise.all(reloadPromises); + await sendmessage.edit('Toutes les commandes ont été rechargées.'); }) .catch(error => { console.error('Erreur lors de l\'envoi du message de rechargement:', error); diff --git a/commands/botcontrol/setactivity.js b/commands/botcontrol/setactivity.js index 7541aed..687a600 100644 --- a/commands/botcontrol/setactivity.js +++ b/commands/botcontrol/setactivity.js @@ -83,7 +83,7 @@ module.exports = { const messageCollector = message.channel.createMessageCollector({ filter, time: 60000 }); messageCollector.on('collect', async (messageCollect) => { const text = messageCollect.content; - const url = 'https://www.twitch.tv/tuturp33'; + const url = 'https://www.twitch.tv/valou336_ytb'; if (!client.user) return; if (value === 'playing') { diff --git a/commands/game/marry.js b/commands/game/marry.js index 3e24e76..68c8563 100644 --- a/commands/game/marry.js +++ b/commands/game/marry.js @@ -6,7 +6,7 @@ module.exports = { description: 'Proposez en mariage à un utilisateur', emote: '💍', category: 'game', - category: '+marry @user', + utilisation: '+marry @user', async execute(message, args, client) { const targetUser = message.mentions.users.first() || message.guild.members.cache.get(args[0]); if (!targetUser) { diff --git a/commands/game/zalgo.js b/commands/game/zalgo.js index 673e67f..53146ff 100644 --- a/commands/game/zalgo.js +++ b/commands/game/zalgo.js @@ -1,11 +1,12 @@ const { EmbedBuilder } = require('discord.js'); const Zalgo = require('to-zalgo') - module.exports = { name: 'zalgo', aliases: ['zlg'], description: 'Convertissez vos textes en Zalgo', - usage: 'zalgo ', + utilisation: 'zalgo ', + emote: '🔤', + category: 'utils', async execute(message, args, client) { message.channel.send({embeds: [ new EmbedBuilder() diff --git a/commands/gestion/autoreact.js b/commands/gestion/autoreact.js index b6e1a5f..9278783 100644 --- a/commands/gestion/autoreact.js +++ b/commands/gestion/autoreact.js @@ -4,7 +4,9 @@ const db = new sqlite3.Database('myDatabase.db'); module.exports = { name: 'autoreact', description: 'Ajoute des réactions automatiques à un salon', - usage: '+autoreact ...', + emote: '🔄', + utilisation: '+autoreact #salon/id ...', + category: 'gestion', async execute(message, args) { if (args[0] === "remove" || args[0] === "del" ){ const channel = message.mentions.channels.first() || message.guild.channels.cache.get(args[0]); diff --git a/commands/moderation/banlist.js b/commands/moderation/banlist.js new file mode 100644 index 0000000..3e0658e --- /dev/null +++ b/commands/moderation/banlist.js @@ -0,0 +1,67 @@ +const { EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle } = require('discord.js'); + +module.exports = { + name: 'banlist', + description: 'Liste tous les utilisateurs bannis avec leur raison de bannissement', + emote: '🚫', + utilisation: 'banlist', + category: 'moderation', + async execute(message) { + try { + const bans = await message.guild.bans.fetch(); + const embeds = []; + const maxPerPage = 10; + let currentPage = 0; + + for (let i = 0; i < bans.size; i += maxPerPage) { + const embed = new EmbedBuilder() + .setTitle('Liste des utilisateurs bannis') + .setColor('#ff0000'); + + bans.each((ban, index) => { + if (index >= i && index < i + maxPerPage) { + const reason = ban.reason || 'Raison non disponible'; + embed.addFields({ name: ban.user.tag, value: `Raison: ${reason}` }); + } + }); + + embeds.push(embed); + } + + + const row = new ActionRowBuilder() + .addComponents( + new ButtonBuilder() + .setCustomId('previous') + .setLabel('Précédent') + .setStyle(ButtonStyle.Primary), + new ButtonBuilder() + .setCustomId('next') + .setLabel('Suivant') + .setStyle(ButtonStyle.Primary) + ); + + await message.channel.send({ embeds: [embeds[currentPage]], components: [row] }); + + const filter = i => i.customId === 'previous' || i.customId === 'next' && i.user.id === message.author.id; + const collector = message.channel.createMessageComponentCollector({ filter, time: 60000 }); + + collector.on('collect', async i => { + if (i.customId === 'previous') { + currentPage = Math.max(currentPage - 1, 0); + } else if (i.customId === 'next') { + currentPage = Math.min(currentPage + 1, embeds.length - 1); + } + + await i.update({ embeds: [embeds[currentPage]], components: [row] }); + }); + + collector.on('end', collected => { + message.channel.send('Navigation terminée.'); + }); + } catch (error) { + console.error('Erreur lors de la récupération des utilisateurs bannis:', error); + message.reply('Une erreur est survenue lors de la récupération des utilisateurs bannis.'); + } + }, +}; diff --git a/commands/moderation/mutelist.js b/commands/moderation/mutelist.js new file mode 100644 index 0000000..eafd09c --- /dev/null +++ b/commands/moderation/mutelist.js @@ -0,0 +1,23 @@ +const { EmbedBuilder } = require('discord.js'); + +module.exports = { + name: 'mutelist', + description: 'Liste tous les utilisateurs avec la communication désactivée', + emote: '🔇', + utilisation: 'mutelist', + category: 'moderation', + async execute(message) { + const members = await message.guild.members.fetch(); + const disabledMembers = members.filter(member => member.isCommunicationDisabled()); + + const embed = new EmbedBuilder() + .setTitle('Liste des utilisateurs mute') + .setColor('#0099ff'); + + disabledMembers.forEach(member => { + embed.addFields({name:' ',value: member.user.tag}); + }); + + message.channel.send({ embeds: [embed] }); + }, +}; \ No newline at end of file diff --git a/commands/utils/films.js b/commands/utils/films.js new file mode 100644 index 0000000..12a89cc --- /dev/null +++ b/commands/utils/films.js @@ -0,0 +1,43 @@ +const { EmbedBuilder } = require('discord.js'); +const axios = require('axios'); +module.exports = { + name: 'film', + description: 'Affiche les films populaires et les plus récents.', + emote: '📽️', + utilisation: 'film', + category: 'utils', + async execute(message, args, client) { + const botUser = message.client.user; + const randomColor = Math.floor(Math.random() * 16777215).toString(16); + + const apiKey = '15392d7432f6d070f28918e626362a93'; + const popularUrl = `https://api.themoviedb.org/3/movie/popular?api_key=${apiKey}&language=fr-FR`; + const recentUrl = `https://api.themoviedb.org/3/movie/now_playing?api_key=${apiKey}&language=fr-FR`; + + try { + const [popularResponse, recentResponse] = await Promise.all([ + axios.get(popularUrl), + axios.get(recentUrl) + ]); + + const popularFilms = popularResponse.data.results.slice(0, 50); + const recentFilms = recentResponse.data.results.slice(0, 50); + + const filmsEmbed = new EmbedBuilder() + .setColor(`#${randomColor}`) // Couleur aléatoire de l'embed + .setTitle('🎬 Films Populaires & Récents 🎥') + .setDescription('Voici les films populaires et les plus récents en ce moment :') + .setThumbnail(botUser.displayAvatarURL()) + .setTimestamp() // Ajoute l'heure actuelle + .setFooter({ text: 'Commande Films', iconURL: 'https://media.discordapp.net/attachments/997345844019859467/1200213219336274030/Megabot2.png?ex=65d7d1aa&is=65c55caa&hm=59a836a51fa2734b0a65de117ebea8531ac45184d14cb8456a785737ec045d6d&=&format=webp&quality=lossless&width=671&height=671' }); // Footer de l'embed + + filmsEmbed.addFields({ name: 'Films Populaires', value: popularFilms.map(film => film.title).join('\n') || 'Non disponible' }); + filmsEmbed.addFields({ name: 'Nouveautés au Cinéma', value: recentFilms.map(film => film.title).join('\n') || 'Non disponible' }); + + await message.reply({ embeds: [filmsEmbed] }); + } catch (error) { + console.error('Erreur lors de la récupération des films :', error); + await interaction.reply('Impossible de récupérer les informations des films. Veuillez réessayer plus tard.'); + } + }, +};