ReferenceError:未定义响应
Posted
技术标签:
【中文标题】ReferenceError:未定义响应【英文标题】:ReferenceError:reponse is not defined 【发布时间】:2021-06-21 14:27:51 【问题描述】:我对响应我的研究有疑问,但仍然没有任何问题请帮助我
代码:
const Client, RichEmbed = require('discord.js') const Discord = require('discord.js')
const bot = new Client() const ping = require('minecraft-server-util') const token = 'NzcwNjg3ODMzNzQ3ODgyMDA0.X5hM-g.YrcSbdZ9VZDBTrKZ6Qj3Cdpu7Z4' const PREFIX = '!' bot.on('ready', () => console.log('Bot has come online.') ) bot.on('message', message => let args = message.content.substring(PREFIX.length).split(' ') switch(args[0]) case 'mc': if(!args[1]) return message.channel.send('You must type a minecraft server ip') if(!args[2]) return message.channel.send('You must type a minecraft server port') const Embed = new Discord.MessageEmbed() .setTitle('Server Status') .addField('Server IP', reponse.host) .addField('Server Version', reponse.version) .addField('Online Players', reponse.onlinePlayers) .addField('Max Players', reponse.maxPlayers) message.channel.send(Embed) ) Console: ReferenceError: reponse is not defined at Client.<anonymous> (C:\Users\Administrator\Desktop\status mc\mcserverbot.js:28:40) at Client.emit (events.js:315:20) at MessageCreateAction.handle (C:\Users\Administrator\Desktop\status
mc\node_modules\discord.js\src\client\actions\MessageCreate.js:31:14) 在 Object.module.exports [as MESSAGE_CREATE] (C:\Users\Administrator\Desktop\status mc\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32) 在 WebSocketManager.handlePacket (C:\Users\Administrator\Desktop\status mc\node_modules\discord.js\src\client\websocket\WebSocketManager.js:384:31) 在 WebSocketShard.onPacket (C:\Users\Administrator\Desktop\status mc\node_modules\discord.js\src\client\websocket\WebSocketShard.js:444:22) 在 WebSocketShard.onMessage (C:\Users\Administrator\Desktop\status mc\node_modules\discord.js\src\client\websocket\WebSocketShard.js:301:10) 在 WebSocket.onMessage (C:\Users\Administrator\Desktop\status mc\node_modules\ws\lib\event-target.js:132:16) 在 WebSocket.emit (events.js:315:20) 在 Receiver.receiverOnMessage (C:\Users\Administrator\Desktop\status mc\node_modules\ws\lib\websocket.js:825:20) PS C:\Users\Administrator\Desktop\status mc>
【问题讨论】:
reponse
是什么?看起来像是 response
的拼写错误,但也没有在任何地方定义。
【参考方案1】:
reponse
未定义,因为您没有在任何地方定义它
【讨论】:
以上是关于ReferenceError:未定义响应的主要内容,如果未能解决你的问题,请参考以下文章
app.js:81010 [Vue 警告]:挂载钩子错误:“ReferenceError: $store 未定义”
UnhandledPromiseRejectionWarning:ReferenceError:未定义提取[重复]
未捕获的 ReferenceError:未定义角度 - AngularJS 不工作