Javascript discord.js以及我是否需要2个bot.login?

Javascript discord.js以及我是否需要2个bot.login?,javascript,node.js,discord,discord.js,Javascript,Node.js,Discord,Discord.js,我一直在开发一个discord bot,我需要一个来自index.js的脚本,但我想知道我是否也应该在cmdFunctions.js的底部执行bot.login index.js const Discord = require('discord.js'); const bot = new Discord.Client(); const cmdFunctions = require('./cmdFunctions.js'); const config = require("./conf

我一直在开发一个discord bot,我需要一个来自
index.js
的脚本,但我想知道我是否也应该在
cmdFunctions.js
的底部执行
bot.login

index.js

const Discord = require('discord.js');
const bot = new Discord.Client();
const cmdFunctions = require('./cmdFunctions.js');
const config = require("./config.json");

var prefix = '>';
bot.on('ready', msg=>{
    console.log('This bot is online');
})
bot.on('message', msg =>{
    if (!msg.content.slice(0,1) == " "){
        var content = msg.content;
        msgArray = content.split(" ");
        msgPrefix = msgArray[0].slice(0,1);
        msgCMD = msgArray[0].slice(1);
        if (msg.author.bot === false && msgPrefix == config.prefix && cmdFunctions[msgCMD]) {
            cmdFunctions[msgCMD](content.substring(content.indexOf(' ')+1), msg);
        }
    }
})
bot.login(config.token);
cmdFunctions.js

const Discord = require('discord.js');
const bot = new Discord.Client();
const cmdFunctions = require('./cmdFunctions.js');
const config = require("./config.json");
module.exports = {
    reactionRoleGroups: function(vars, msg) {
        bot.on("messageReactionAdd", (messageReaction, user) =>{
            console.log(":L");
            if (true){
                RRGM.edit("Thanks!")
            }
        })
        varsSplit = vars.split(config.variableSeperator);
        var Emojis = varsSplit[0];
        if (Emojis) {
            var EmojisSeperated = Emojis.split(",");
            var RRGM = msg.channel.send("You are setting up a RR Group") //.send("hello /n :)")
        }
    }
}

这是我的帖子,如果我还需要什么,请告诉我。:)

不,不需要。您只需要在主脚本末尾登录,除非您使用与第二个脚本不同的令牌初始化完全不同的应用程序