У меня есть бот дискорд, я хочу сделать чтоб у одной команды было два название, чтоб код один код отликался на два название !help и !commands, как мне это сделать ?
Мой код:
index.js
const Discord = require("discord.js");
const sdr = new Discord.Client();
const fs = require('fs');
sdr.commands = new Discord.Collection();
fs.readdir("./utils/", (err, files) => {
if(err) console.log(err);
let jsfile = files.filter(f => f.split(".").pop() === "js")
if(jsfile.length <= 0){
console.log("Не удалось найти команды.");
return;
}
jsfile.forEach((f, i) =>{
let props1 = require(`./utils/${f}`);
console.log(`Loaded: ${f}`);
sdr.commands.set(props1.help.name, props1);
});
});
sdr.on("message", async message => {
if(!message.guild)
if(message.author.bot) return;
if(message.channel.type === "dm") return;
if(message.content.indexOf(settings.prefix) !== 0) return;
let messageArray = message.content.split(" ");
let cmd = messageArray[0];
let args = messageArray.slice(1)
let commandfile = sdr.commands.get(cmd.slice(config.prefix.length));
if(commandfile) commandfile.run(sdr,message,args, settings, premiumakk);
});
help.js
const Discord = require('discord.js');
module.exports.run = async (bot, message, args) => {
const Embed = new Discord.MessageEmbed()
.setTitle('Все команды')
.setDescription('!help - показать все команды\n!ping - показать пинг')
message.channel.send(Embed);
}
module.exports.help = {
name: "help",
info: "help commands"
}
Я пробовал
module.exports.help = {
name: ["help" || 'commands'], //name: ['help', 'commands'], //name: ['help', && 'commands']
info: "help commands"
}
Но у меня ничего не получилось