【问题标题】:Discord.js : How to make a bot DM all members in a server?Discord.js:如何让机器人 DM 成为服务器中的所有成员?
【发布时间】:2020-10-29 20:12:24
【问题描述】:

我希望我的机器人 DM 我服务器中的所有成员,但我不知道如何去做。如果您能提供帮助,我将不胜感激!

Discord.js v12

【问题讨论】:

    标签: node.js discord discord.js


    【解决方案1】:
    message.guild.members.cache.forEach(member => { // Looping through each member of the guild.
        // Trying to send a message to the member.
        // This method might fail because of the member's privacy settings, so we're using .catch
        member.send("Hello, this is my message!").catch(e => console.error(`Couldn't DM member ${member.user.tag}`));
    });
    

    【讨论】:

      猜你喜欢
      • 2021-12-02
      • 2019-10-11
      • 2022-01-18
      • 1970-01-01
      • 1970-01-01
      • 2022-01-27
      • 2021-04-13
      • 1970-01-01
      • 2021-04-30
      相关资源
      最近更新 更多