最新消息: 电脑我帮您提供丰富的电脑知识,编程学习,软件下载,win7系统下载。

UnhandledPromiseRejectionWarning,discord.js javascrpt

IT培训 admin 13浏览 0评论

UnhandledPromiseRejectionWarning,discord.js javascrpt

我目前正在制作一个记录先前消息的不和谐的机器人,然后将其删除/编辑后发送给我,我完成了所有代码,但现在我的终端都充满了错误,说]]

    at Function.normalizeField (C:\NewCrackHeadsBot\node_modules\discord.js\src\structures\MessageEmbed.js:425:23)
    at C:\NewCrackHeadsBot\node_modules\discord.js\src\structures\MessageEmbed.js:445:14
    at Array.map (<anonymous>)
    at Function.normalizeFields (C:\NewCrackHeadsBot\node_modules\discord.js\src\structures\MessageEmbed.js:444:8)
    at MessageEmbed.addFields (C:\NewCrackHeadsBot\node_modules\discord.js\src\structures\MessageEmbed.js:259:42)
    at MessageEmbed.addField (C:\NewCrackHeadsBot\node_modules\discord.js\src\structures\MessageEmbed.js:250:17)
    at module.exports (C:\NewCrackHeadsBot\Events\messageUpdate.js:8:2)
    at Client.<anonymous> (C:\NewCrackHeadsBot\index.js:26:38)
    at Client.emit (events.js:315:20)
    at Object.module.exports [as MESSAGE_UPDATE] (C:\NewCrackHeadsBot\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_UPDATE.js:14:12)
(node:18992) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see .html#cli_unhandled_rejections_mode). (rejection id: 5)
(node:18992) UnhandledPromiseRejectionWarning: RangeError [EMBED_FIELD_VALUE]: MessageEmbed field values may not be empty.
    at Function.normalizeField (C:\NewCrackHeadsBot\node_modules\discord.js\src\structures\MessageEmbed.js:425:23)
PS C:\NewCrackHeadsBot> node .
this bot is online
RangeError [EMBED_FIELD_VALUE]: MessageEmbed field values may not be empty.
    at Function.normalizeField (C:\NewCrackHeadsBot\node_modules\discord.js\src\structures\MessageEmbed.js:425:23)
    at C:\NewCrackHeadsBot\node_modules\discord.js\src\structures\MessageEmbed.js:445:14
    at Array.map (<anonymous>)
    at Function.normalizeFields (C:\NewCrackHeadsBot\node_modules\discord.js\src\structures\MessageEmbed.js:444:8)
    at MessageEmbed.addFields (C:\NewCrackHeadsBot\node_modules\discord.js\src\structures\MessageEmbed.js:259:42) 
    at MessageEmbed.addField (C:\NewCrackHeadsBot\node_modules\discord.js\src\structures\MessageEmbed.js:250:17)  
    at module.exports (C:\NewCrackHeadsBot\Events\messageUpdate.js:8:2)
    at Client.<anonymous> (C:\NewCrackHeadsBot\index.js:26:38)
    at Client.emit (events.js:315:20)
    at Object.module.exports [as MESSAGE_UPDATE] (C:\NewCrackHeadsBot\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_UPDATE.js:14:12) {
  [Symbol(code)]: 'EMBED_FIELD_VALUE'
}

此错误淹没了我的终端,我不确定如何解决此问题

这是我认为错误来自的代码,但我是一个初学者,所以我不确定是否可以显示其他代码

bot.on('messageUpdate', async(oldMessage,newMessage) => {

    require('./Events/messageUpdate')(oldMessage,newMessage)

})
bot.on('messageDelete', async(message) =>{

    require('./Events/messageDelete')(message)

})

我目前正在制作一个记录先前消息的不和谐机器人,然后将它们删除/编辑后发送给我,我完成了所有代码,但是现在我的终端都装满了错误,提示...

回答如下:

不太确定,但我认为您需要等待,因为您已异步。

UnhandledPromiseRejectionWarning,discord.js javascrpt

我目前正在制作一个记录先前消息的不和谐的机器人,然后将其删除/编辑后发送给我,我完成了所有代码,但现在我的终端都充满了错误,说]]

    at Function.normalizeField (C:\NewCrackHeadsBot\node_modules\discord.js\src\structures\MessageEmbed.js:425:23)
    at C:\NewCrackHeadsBot\node_modules\discord.js\src\structures\MessageEmbed.js:445:14
    at Array.map (<anonymous>)
    at Function.normalizeFields (C:\NewCrackHeadsBot\node_modules\discord.js\src\structures\MessageEmbed.js:444:8)
    at MessageEmbed.addFields (C:\NewCrackHeadsBot\node_modules\discord.js\src\structures\MessageEmbed.js:259:42)
    at MessageEmbed.addField (C:\NewCrackHeadsBot\node_modules\discord.js\src\structures\MessageEmbed.js:250:17)
    at module.exports (C:\NewCrackHeadsBot\Events\messageUpdate.js:8:2)
    at Client.<anonymous> (C:\NewCrackHeadsBot\index.js:26:38)
    at Client.emit (events.js:315:20)
    at Object.module.exports [as MESSAGE_UPDATE] (C:\NewCrackHeadsBot\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_UPDATE.js:14:12)
(node:18992) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see .html#cli_unhandled_rejections_mode). (rejection id: 5)
(node:18992) UnhandledPromiseRejectionWarning: RangeError [EMBED_FIELD_VALUE]: MessageEmbed field values may not be empty.
    at Function.normalizeField (C:\NewCrackHeadsBot\node_modules\discord.js\src\structures\MessageEmbed.js:425:23)
PS C:\NewCrackHeadsBot> node .
this bot is online
RangeError [EMBED_FIELD_VALUE]: MessageEmbed field values may not be empty.
    at Function.normalizeField (C:\NewCrackHeadsBot\node_modules\discord.js\src\structures\MessageEmbed.js:425:23)
    at C:\NewCrackHeadsBot\node_modules\discord.js\src\structures\MessageEmbed.js:445:14
    at Array.map (<anonymous>)
    at Function.normalizeFields (C:\NewCrackHeadsBot\node_modules\discord.js\src\structures\MessageEmbed.js:444:8)
    at MessageEmbed.addFields (C:\NewCrackHeadsBot\node_modules\discord.js\src\structures\MessageEmbed.js:259:42) 
    at MessageEmbed.addField (C:\NewCrackHeadsBot\node_modules\discord.js\src\structures\MessageEmbed.js:250:17)  
    at module.exports (C:\NewCrackHeadsBot\Events\messageUpdate.js:8:2)
    at Client.<anonymous> (C:\NewCrackHeadsBot\index.js:26:38)
    at Client.emit (events.js:315:20)
    at Object.module.exports [as MESSAGE_UPDATE] (C:\NewCrackHeadsBot\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_UPDATE.js:14:12) {
  [Symbol(code)]: 'EMBED_FIELD_VALUE'
}

此错误淹没了我的终端,我不确定如何解决此问题

这是我认为错误来自的代码,但我是一个初学者,所以我不确定是否可以显示其他代码

bot.on('messageUpdate', async(oldMessage,newMessage) => {

    require('./Events/messageUpdate')(oldMessage,newMessage)

})
bot.on('messageDelete', async(message) =>{

    require('./Events/messageDelete')(message)

})

我目前正在制作一个记录先前消息的不和谐机器人,然后将它们删除/编辑后发送给我,我完成了所有代码,但是现在我的终端都装满了错误,提示...

回答如下:

不太确定,但我认为您需要等待,因为您已异步。

发布评论

评论列表 (0)

  1. 暂无评论