Commande qui ne fonction pas pour mon bot Discord
Résolu
SlyEyes
-
SlyEyes -
SlyEyes -
Bonjour,
J'ai fait pour mon bot Discord un code pour pouvoir mettre mes commandes dans un dossier à part et alléger le code de mon fichier index.js.
Bout du code index.js qui concerne les commandes :
bot.on('message', message => {
if (message.author.bot) return
if (message.content.indexOf(config.prefix) !== 0) return
const args = message.content.slice(config.prefix.length).trim().split(/ +/g);
const command = args.shift().toLowerCase();
try {
let commandFile = require(`./commands/${command}.js`);
commandFile.run(client, message, args);
} catch (err) {
message.channel.send({embed: {
color: 16711680,
description: 'This command doesn\'t exist !'
}});
}
})
Cependant, j'ai beau essayer de faire mes commandes, le bot ne les trouvent pas et me renvoi toujours mon message d'erreur.
Code de mon fichier help.js qui contient la commande help :
module.exports.run = async (client, message, args) => {
message.reply("\n__Hi there, the next commands are available for EmoticatBot :__\n**<help** [*Display a list of all the available commands and their effects*]\n**<aaah** [*Aaah cat Emoticat*]\n**<relax** [*Relax cat Emoticat*]\n**<sad** [*Sad cat Emoticat*]\n**<hi** [*Hi cat Emoticat*]\n**<raaage** [*Raaage cat Emoticat*]\n**<lil** [*Lil cat Emoticat*]\n**<dance** [*Dance cat Emoticat*]\n**<demon dance** [*Demon dance cat Emoticat*]\n(*Go to https://github.com/users/SlyEyes/projects/2 to follow the developpement of this bot !*)")
}
Merci d'avance.
J'ai fait pour mon bot Discord un code pour pouvoir mettre mes commandes dans un dossier à part et alléger le code de mon fichier index.js.
Bout du code index.js qui concerne les commandes :
bot.on('message', message => {
if (message.author.bot) return
if (message.content.indexOf(config.prefix) !== 0) return
const args = message.content.slice(config.prefix.length).trim().split(/ +/g);
const command = args.shift().toLowerCase();
try {
let commandFile = require(`./commands/${command}.js`);
commandFile.run(client, message, args);
} catch (err) {
message.channel.send({embed: {
color: 16711680,
description: 'This command doesn\'t exist !'
}});
}
})
Cependant, j'ai beau essayer de faire mes commandes, le bot ne les trouvent pas et me renvoi toujours mon message d'erreur.
Code de mon fichier help.js qui contient la commande help :
module.exports.run = async (client, message, args) => {
message.reply("\n__Hi there, the next commands are available for EmoticatBot :__\n**<help** [*Display a list of all the available commands and their effects*]\n**<aaah** [*Aaah cat Emoticat*]\n**<relax** [*Relax cat Emoticat*]\n**<sad** [*Sad cat Emoticat*]\n**<hi** [*Hi cat Emoticat*]\n**<raaage** [*Raaage cat Emoticat*]\n**<lil** [*Lil cat Emoticat*]\n**<dance** [*Dance cat Emoticat*]\n**<demon dance** [*Demon dance cat Emoticat*]\n(*Go to https://github.com/users/SlyEyes/projects/2 to follow the developpement of this bot !*)")
}
Merci d'avance.
A voir également:
- Commande qui ne fonction pas pour mon bot Discord
- Invite de commande - Guide
- Fonction si et - Guide
- Commande terminal mac - Guide
- Connexion sctr discord - Forum Discord
- Stream discord crash, suivit d'un problème de connexion SCTR - Forum Discord
https://codes-sources.commentcamarche.net/faq/11288-les-balises-de-code