DISCORD.JS如何对@user进行dm验证

DISCORD.JS如何对@user进行dm验证,discord.js,Discord.js,我尝试了其他人提供的所有代码,但都无效。您可以使用msg.author.send向另一个用户发送DM。请查看您可以执行的所有操作 client.on('message', msg => { if(msg.content.startsWith('^approvedpr')) (What do I put here)? }); 编辑:如果您试图DM一个提到的用户,您可以使用msg.indications.users() client.on('message', msg =&

我尝试了其他人提供的所有代码,但都无效。

您可以使用
msg.author.send向另一个用户发送DM。请查看您可以执行的所有操作

client.on('message', msg => {
    if(msg.content.startsWith('^approvedpr'))
    (What do I put here)? 
});
编辑:如果您试图DM一个提到的用户,您可以使用
msg.indications.users
()

client.on('message', msg => {
    if (msg.content.startsWith('^approvedpr') {
        msg.author.send("Whatever");
    };
};
client.on('message', msg => {
    if (msg.content.startsWith('^approvedpr') {
        //Get the first user that was mentioned
        const mention = msg.mentions.users.first();

        //Send them a DM
        mention.send("Whatever");
    };
};