不能 dm 提到用户 javascript

时间:2021-07-20 08:16:09

标签: javascript send

我正在尝试发出禁止命令,但它一直说提到的User.send 不是函数?[控制台图像][1]

我不确定在这里做什么。我读了一点,看到了一些关于“缓存”系统的信息,但我完全不知道如何使用它。

有人可以帮忙吗?

我的代码:

const { multiGetLatestMessages } = require("noblox.js");
const Discord = require('discord.js');

module.exports = {
    name: 'ban',
    description: 'ban user',
    cooldown: 5,
    permissions: 'BAN_MEMBERS',
    aliases: ['banlands', "getbannednoob"],

    async execute(message, args) {
        let reason = args.slice(1).join(" ");
        let mentionedMember = message.mentions.members.first

        if (!reason) reason = "No reason given";
        if (!args[0]) return message.channel.send("at least tell me who to ban noob");
        if (!mentionedMember) return message.channel.send("couldn't find that noob");
        //if (!mentionedMember.bannable) return message.channel.send("i can't ban that user you noob");

        const banEmbed = new Discord.MessageEmbed()
            .setTitle(`you got banned from ${message.guild.name}`)
            .setDescription(`reason for ur disposal: ${reason}`)
            .setColor("#FF0000")
            .setTimestamp()

        await mentionedMember.send(banEmbed).catch(err => message.channel.send(err));
        await mentionedMember.ban({
            reason: reason
        }).catch(err => message.channel.send(err)).then(() => message.channel.send("u banned " + mentionedMember.user.tag))
    }
}```


  [1]: https://i.stack.imgur.com/HEaRz.png

1 个答案:

答案 0 :(得分:0)

我想通了,我忘记了在“first”之后的 () let seenMember = message.mentions.members.first,傻我