Connect bot to new channel via function?

I don’t use twitch.js, but it seems you have to do :

chat.join(channel1).then(channelState => { }) 
chat.join(channel2).then(channelState => { }) 
chat.join(channel3).then(channelState => { }) 

With pureJS and Websocket (=> Like the chatbot.js example) you have to do :

webIRC.prototype.onOpen = function onOpen() {
    const socket = this.webSocket;
    if (socket !== null && socket.readyState === 1) {
        socket.send('CAP REQ :twitch.tv/tags twitch.tv/commands twitch.tv/membership');

        socket.send('PASS ' + this.password);
        socket.send('NICK ' + this.username);
        socket.send('JOIN ' + this.channel);

        [
            "dakotaz", "csgomc_ru", "csgomaincast", "Thijs", "IWillDominate",
            "fextralife", "GSL", "Greekgodx", "CDNThe3rd", "SilverName", "Gosu",
            "stylishnoob4", "ALOHADANCETV", "Solary", "JakenbakeLIVE", "JoshOG",
            "LexVeldhuis", "gammaray_tv", "KingRichard", "Trymacs", "jovirone",
            "BurkeBlack", "Loeya", "just_ns", "GodHunt", "singsing", "fps_shaka",
            "uzra", "Sacriel", "DreadzTV", "DreamLeague", "SovietWomble", "Sick_Nerd",
            "UCCleague", "BreaK", "C_a_k_e", "mandiocaa1", "TidesofTime"
        ].forEach((v) => socket.send(`:{this.username}!{this.username}@{this.username}.tmi.twitch.tv JOIN #${v}`));