【发布时间】:2019-08-27 23:53:22
【问题描述】:
我有一个建议命令,我想发送到我服务器中的特定频道。
if (!args) return message.channel.send("Please input a suggestion"); {
client.channels.get("563804889268879390").send({embed: {
color: 0x333333,
author: {
name: "New suggestion!",
},
fields: [{
name: "User",
value: ${message.author.user}
},
{
name: "Suggestion",
value: args
},
]}})}
我将消息定义为client.on("message", async message => {。
即使我键入没有任何参数的命令,它也不会响应错误消息。当我尝试使用它时,它输出的只是(node:17876) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'send' of undefined。这些参数在我的其他命令上工作正常,所以我不知道问题可能是什么。
【问题讨论】:
-
能否告诉我们您如何定义消息?
-
我已将帖子更改为适合,谢谢
-
在第一行的末尾有一个不适合的左括号。这是为什么呢?也许这导致了错误
标签: javascript node.js bots discord discord.js