【问题标题】:Is there any code to do that my Discordbot (discord.js) only work at one Server?是否有任何代码可以让我的 Discordbot (discord.js) 仅在一台服务器上工作?
【发布时间】:2019-12-03 01:25:35
【问题描述】:

我现在正在使用 node / discord.js 进行编码 是否有任何代码可以使机器人仅在一台服务器上工作? 如果是,请发给我!谢谢

【问题讨论】:

    标签: node.js discord discord.js


    【解决方案1】:

    好吧,如果您不希望将机器人添加到其他人的服务器,只需确保在不和谐开发门户中将其设置为私人机器人。您还可以对消息进行简单检查

    const myServer = (put your discord server id here);
    
    bot.on('message', msg => {
       if(msg.guild.id != myServer){
          return;
       }
    });
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-02-24
      • 1970-01-01
      • 1970-01-01
      • 2011-04-11
      • 2011-12-29
      • 2010-12-06
      相关资源
      最近更新 更多