Salut j’ai plein d’erreur sur mon bot et sa me soule donc voilà les erreur et le code
erreur:
C:\Program Files\nodejs\node.exe --inspect-brk=22165 index.js
Debugger listening on ws:
For help, see: https:
Debugger attached.
internal/modules/cjs/loader.js:584
throw err;
^
Error: Cannot find module 'discord.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:582:15)
at Function.Module._load (internal/modules/cjs/loader.js:508:25)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:22:18)
at Object.<anonymous> (c:\Users\white\Desktop\BotDiscord\index.js:1:79)
at Module._compile (internal/modules/cjs/loader.js:698:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
at Module.load (internal/modules/cjs/loader.js:600:32)
at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
at Function.Module._load(internal/modules/cjs/loader.js:531:3)
Waiting
Error: Cannot find module 'discord.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:582:15)
at Function.Module._load (internal/modules/cjs/loader.js:508:25)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:22:18)
at Object.<anonymous> (c:\Users\white\Desktop\BotDiscord\index.js:1:79)
at Module._compile (internal/modules/cjs/loader.js:698:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
at Module.load (internal/modules/cjs/loader.js:600:32)
at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
at Function.Module._load (internal/modules/cjs/loader.js:531:3)
for the debugger to disconnect...
Code/index:
const Discord = require('discord.js');
const client = new Discord.Client();
const fs = require('fs');
client.login("token");
client.commands = new Discord.Collection();
fs.readdir("./Commandes/", (error, f) => {
if(error) console.log(error);
let commandes = f.filter(f => f.split(".").pop() === "js");
if(commandes.length <= 0) return console.log('Aucune commande trouvé !');
commandes.forEach((f) => {
let commande = require(`./Commande/${f}`);
console.log(`${f} Commande chragé !`);
client.commands.set(commande.help.name, commande);
});
});
Code/kick:
const Discord = require ('discord.js');
module.exports.run = async(client, message, args) => {
if(!message.guild.member(message.author).hasPermission("KICK_MEMBERS")) return message.channel.send(`Vous n'avez pas la permission !`);
if(message.mentions.users.size === 0) {
return message.channel.send('Vous devez mentionner un utilisateur !');
}
let kick = message.guild.member(message.mentions.users.first());
if(!kick) {
return message.channel.send(`Je n'ai pas trouvé l'utilisateur !`);
}
if(!message.guild.member(client.user).haspermission("KICK_MEMBERS")) return message.channel.send(`L'esclave de FolYx n'a pas le permission !`);
kick.kick().then(member => {
message.channel.send(`${member.user.username}est kick par ${message.author.username}`);
message.mention.user.first().send(`Vous êtes expulsé du serveur **${message.guild.name}**par ${message.author.username}`);
});
};
module.exports.help = {
name:"kick"
};
Voilà j’espert que vous pourrais m’aidé merci encore
—EDIT @amael: mise en forme du code—