【发布时间】:2020-08-19 09:40:54
【问题描述】:
我尝试使用Discord.js 创建一个机器人。这是我的代码:
import Discord from 'discord.js'
const client = new Discord.Client()
client.once('ready', () => {
console.log('Ready!')
})
client.login('my-real-token')
client.on('message', message => {
console.log(message.content)
if (message.content === '!embed') {
message.channel.send({
embed: {
color: 0x0099ff,
description: 'A very simple Embed!',
},
})
}
})
但在 Discord 中,它显示为一条空消息:
我尝试使用 the guide 中的两种方式,例如 Discord.MessageEmbed 构造函数和上面代码中的嵌入对象 - 它们看起来都是空的。
channel.send('hello') 之类的简单消息可以正常工作。
我做错了什么?
PS。控制台中没有错误,只是“准备就绪!”和一个“!嵌入”。
PS2。我使用的是打字稿,所以我的构建代码与上面的源代码不同,但我不认为这是一个问题,但我当然可以显示我的 dist 代码。
【问题讨论】:
标签: javascript node.js discord discord.js