Discord.js-ReferenceError:消息未定义

时间:2019-07-16 17:06:45

标签: javascript node.js discord discord.js

因此,我正在观看有关如何为discord.js制作命令处理程序的教程。我输入了与视频(https://youtu.be/aqJydd30xmE?t=713)中相同的内容,但是却以某种方式收到错误消息“ ReferenceError:消息未定义”

这是我的代码:

const Discord = require("discord.js");
const botconfig = require("../botconfig.json");
const colors = require("../colors.json")

module.exports.run = async (bot, mssage, args) => {
    let sEmbed = new Discord.RichEmbed()
        .setColor(colors.green)
        .setTitle("Server Info")
        .setThumbnail(message.guild.iconURL)
        .setAuthor(`${message.guild.name} Info`, message.guild.iconURL)
        .addField("**Server Name:**", `${message.guild.name}`, true)
        .addField("**Server Owner:**", `${message.guild.owner}`, true)
        .addField("**Mitglieder:**", `${message.guild.memberCount}`, true)
        .addField("**Rollen:**", `${message.guild.roles.size}`, true)
        .setFooter(`CrafterBot`, bot.user.displayAvatarURL);
        message.channel.send({embed: sEmbed});
}

module.exports.config = {
    name: "serverinfo",
    aliases: ["si", "ServerInfo", "ServerDesc", "serverdesc"]
}

1 个答案:

答案 0 :(得分:2)

您键入mssage,然后尝试用作message

module.exports.run = async (bot, mssage, args) => {

在这里,您尝试使用message

.setThumbnail(message.guild.iconURL)