【发布时间】:2020-10-01 21:47:36
【问题描述】:
如果我遇到此错误,它将发送一条消息嵌入,并显示有关如何打开直接消息的图片。
但我不知道如何截取代码并发送此消息
if (error.code === 50007){
message.channel.send(Embedcantchat);
}
错误来源
reason: DiscordAPIError: Cannot send messages to this user
at C:\Users\nawap\OneDrive\Desktop\Discord\bot all\nirtogiven\node_modules\discord.js\src\client\rest\RequestHandlers\Sequential.js:79:15
at C:\Users\nawap\OneDrive\Desktop\Discord\bot all\nirtogiven\node_modules\snekfetch\src\index.js:215:21
at processTicksAndRejections (internal/process/task_queues.js:97:5) {
name: 'DiscordAPIError',
message: 'Cannot send messages to this user',
path: '/api/v7/channels/720870400808190013/messages',
code: 50007,
method: 'POST'
}
【问题讨论】:
-
该用户禁用了来自朋友以外的任何人的 DM。 “新手”没有错。
标签: javascript discord.js