首页 > 解决方案 > 为什么这个 Dm 命令不适用于某些 id ?不和谐的js

问题描述

    const devs = [
        'user1ID',
        'user2ID',
        'user3ID',
        'user4ID'
    ]

    if (devs.includes(message.author.id)) {
        const target = client.users.cache.get(args[0]);

        let payload = message.content.slice(8)

        if (!target) return message.channel.send("User not found");

        client.users.cache.get(target.id).send(payload)
        message.channel.send("DM has been Sent :tick:")
        .catch(() => message.lineReply("User has DMs closed or has no mutual servers with the bot"));
    }
    else {
        message.channel.send("You don't have permission to use this command")
    }

它说用户未找到某些 id 和其他它成功发送 dm 并且当它发送它时也发送 id。请帮我。

标签: javascriptdiscordbots

解决方案


推荐阅读