【发布时间】:2021-03-30 21:07:24
【问题描述】:
我有问题。机器人不想从消息中的作者对象获取dmChannel。 dmChannel 始终为null。这是我的代码:
if (command === "suggest") {
message.channel.send("**Please, revise the DM that I sent you.**");
let msg = message.author.send("Please, state a valid suggestion. Max time: 3 mins. If you want to cancel, say `cancel`.");
let filter = m => m.content.includes('');
msg.channel.awaitMessages(filter, { max: 1, time: 180000, errors: ['time'] })
.then(collected => {
if (collected.content.toLowerCase() === "cancel") {return;}
client.channels.cache.get('790403704171659274').send(new MessageEmbed().setTitle("New Suggestion!").setColor("c0ed8c").setDescription(package.description).setFooter("Made by " + message.author.toString(), client.user.avatarURL()).setTimestamp().addField("Suggestion", collected.content));
})
.catch(collected => {
if(collected.size === 0) {message.author.send("Prompt cancelled."); return;}
message.author.send("Thanks for making your suggestions! They are all apreciated.")
});
}
谢谢!!!
【问题讨论】:
-
它告诉你错误发生在哪一行?
标签: javascript discord discord.js