所以我制造了一个不和谐的机器人,可以读取嵌入的其他机器人并对其进行回复
这是我的代码:
client.on("message", (message) => {
let embed = message.embeds[0];
if (
message.author.id == "555955826880413696" &&
embed &&
embed.fields &&
embed.fields[0].value.includes(
"Type **CATCH** (once) to collect some coins! The reward depend on how much players join\n"
)
) {
message.channel
.send(
"<@&742328576237633546> " +
"<a:coins:744946097558126662> " +
"**CATCH** " +
"<a:coins:744946097558126662>"
)
.catch(console.error);
} else console.log(embed);
});
答案 0 :(得分:0)
将embed.fields
要求从if
语句更改为embed.fields[0]
由于embed.fields
为空(尽管仍然定义),因此触发了错误。