【发布时间】:2021-05-12 12:26:59
【问题描述】:
我希望我的机器人将嵌入的 webhook 发送到不和谐频道,这是我的代码,但我不知道如何解决此错误
TypeError: args.join is not a function
const { Command } = require('discord.js-commando');
const { WebhookClient, MessageEmbed } = require('discord.js')
module.exports = class reportCommand extends Command {
constructor(client) {
super(client, {
name: 'report',
group: 'help',
memberName: 'report',
description: 'Report some bug about me.',
});
}
async run (client, message, args) {
const wc = new WebhookClient('0000000000000', '000000000000')
const embed = new MessageEmbed()
.setTitle("this is an embed")
.setColor('GREEN')
.setTimestamp()
.setDescription(args.join(" "))
wc.send({
username : message.author.tag,
avatarURL : message.author.displayAvatarURL({ dynamic : true }),
embeds : [embed]
})
}
}
顺便说一句,我已经试过了
args: [
{
key: 'reason',
prompt:
'Whats your problem?',
type: 'string'
},
]
Embed
.setDescription(reason)
但它仍然不起作用,我在嵌入消息的描述中得到另一个undefined,如果不是那个可能是displayAvatarURL,所以我真的不知道该怎么办或者如何修复它,因为如果我删除 displayAvatarURL,消息仍将是 indefinied。
【问题讨论】:
标签: node.js command discord.js embed webhooks