我最近开始将我所有的命令移到文件中,以进行一些清除。 index.js中的代码很好。我不断收到RefrenceError:消息ID未定义。这是代码。预先感谢
module.exports = {
name: 'help',
description: "this is help command",
execute(mesage, args){
if (args[1] === 'staff'){
const embed = new Discord.MessageEmbed()
.setTitle ("Staff Commands:")
.addField ("**g!mute <user> <time>**", "Will mute the user for the specified amount of time. **PLEASE REPORT WHY YOU MUTED PERSON IN** #?mute-people")
.setColor(0xfc8e08)
message.channel.send(embed);
}else
if (args[1] === 'krunker'){
const embed = new Discord.MessageEmbed()
.setTitle ("Krunker::")
.addField ("**g!profile**", "Will give you a link to my Krunker.io profile")
.addField ("**g!trade**", "Will Display the t&c for trading")
.addField ("**g!clan**", "will give the link to my Clan [G3O]")
.addField ("**g!scope**", "will give the scope I made/use")
.addField ("**g!overlay**", "will give overlay I made/use")
.addField ("**g!hitmarker**", "will give the hitmarker I made/use")
.addField ("**g!mod**", "will give the mod I made")
.addField ("**g!settings**", "will give the settings I use")
.setColor(0xfce808)
message.channel.send(embed);
}else
if (args[1] === 'socials'){
const embed = new Discord.MessageEmbed()
.setTitle ("Socials:")
.addField ("**g!twitch**", "Will give you a link to my Twitch")
.addField ("**g!yt**", "Will give the link to my Youtube Channel")
.addField ("**g!twitter**", "will give the link to my Twitter")
.addField ("**g!instagram**", "will give the link to my Instagram")
.addField ("**g!tiktok**", "will give the link to my TikTok")
.addField ("**g!socials**", "will give the link where you can find all of my socials")
.setColor(0xfc0808)
message.channel.send(embed);
}else{
const embed = new Discord.MessageEmbed()
.setTitle ("Commands List:")
.addField ("**g!help socials**", "Will give you a list of commands for my socials")
.addField ("**g!help staff**", "Will give a list of commands for STAFF ONLY")
.addField ("**g!help krunker**", "Will give a list of commands all realted to Krunker")
.setColor(0x01B8FF)
message.channel.send(embed)
}
}
}
答案 0 :(得分:1)
由于message
函数的execute
拼写错误,导致您收到错误消息。
您拼写为mesage
而不是message
。
module.exports = {
name: 'help',
description: "this is help command",
execute(message, args){
if (args[1] === 'staff'){
const embed = new Discord.MessageEmbed()
.setTitle ("Staff Commands:")
.addField ("**g!mute <user> <time>**", "Will mute the user for the specified amount of time. **PLEASE REPORT WHY YOU MUTED PERSON IN** #?mute-people")
.setColor(0xfc8e08)
message.channel.send(embed);
}else
if (args[1] === 'krunker'){
const embed = new Discord.MessageEmbed()
.setTitle ("Krunker::")
.addField ("**g!profile**", "Will give you a link to my Krunker.io profile")
.addField ("**g!trade**", "Will Display the t&c for trading")
.addField ("**g!clan**", "will give the link to my Clan [G3O]")
.addField ("**g!scope**", "will give the scope I made/use")
.addField ("**g!overlay**", "will give overlay I made/use")
.addField ("**g!hitmarker**", "will give the hitmarker I made/use")
.addField ("**g!mod**", "will give the mod I made")
.addField ("**g!settings**", "will give the settings I use")
.setColor(0xfce808)
message.channel.send(embed);
}else
if (args[1] === 'socials'){
const embed = new Discord.MessageEmbed()
.setTitle ("Socials:")
.addField ("**g!twitch**", "Will give you a link to my Twitch")
.addField ("**g!yt**", "Will give the link to my Youtube Channel")
.addField ("**g!twitter**", "will give the link to my Twitter")
.addField ("**g!instagram**", "will give the link to my Instagram")
.addField ("**g!tiktok**", "will give the link to my TikTok")
.addField ("**g!socials**", "will give the link where you can find all of my socials")
.setColor(0xfc0808)
message.channel.send(embed);
}else{
const embed = new Discord.MessageEmbed()
.setTitle ("Commands List:")
.addField ("**g!help socials**", "Will give you a list of commands for my socials")
.addField ("**g!help staff**", "Will give a list of commands for STAFF ONLY")
.addField ("**g!help krunker**", "Will give a list of commands all realted to Krunker")
.setColor(0x01B8FF)
message.channel.send(embed)
}
}
}