最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

错误“ const Discord = require(discord.js)^ ReferenceError:未定义discord”

网站源码admin19浏览0评论

错误“ const Discord = require(discord.js)^ ReferenceError:未定义discord”

错误“ const Discord = require(discord.js)^ ReferenceError:未定义discord”

你好,所以我收到一个奇怪的错误,说这“ const Discord = require(discord.js) ^ReferenceError:未定义不和谐”这是我编写的代码,我是否在那里输入错误?

    const Discord = require(discord.js)
const Client = new Discord.Client
const prefix = "/";
Client.on('ready', ()=>{
        console.log('Bot is online.');
})
Client.on('message', (Message)=>{
    if(!Message.content.startsWith(prefix)) return;
    if(Message.content.startsWith(prefix + "hello")){
        Message.channel.send("Hello.")
    }
})
Client.login("<Token Here>");
回答如下:[导入/要求任何内容时,您必须将其作为字符串传递。您基本上试图将其作为变量传递。

const Discord = require('discord.js')

发布评论

评论列表(0)

  1. 暂无评论