简体   繁体   中英

Discord.js - ReferenceError: message is not defined

So I was watching a tutorial on how to make a command handler for discord.js. I typed the same thing as in the video ( https://youtu.be/aqJydd30xmE?t=713 ) but somehow I get the error message "ReferenceError: message is not defined"

This is my Code:

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"]
}

You type mssage and your trying to use as message

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

And here you trying to use message

.setThumbnail(message.guild.iconURL)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM