Skip to content

Commit

Permalink
add room list
Browse files Browse the repository at this point in the history
  • Loading branch information
transkarpation committed Mar 13, 2024
1 parent 8b912c0 commit 5c46dca
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions bots/translateBot/config/connect.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,25 @@ export const connectingToNewRoom = (xmpp, roomJID, connectData) => {
})
}

export const connectToRooms = (xmpp, jid, connectData) => {
export const connectToRooms = async (xmpp, jid, connectData) => {
if (process.env.DEFAULT_ROOM) {
let statusSendWelcomeMessage = false;
if (messages.general.welcomeMessage) {
statusSendWelcomeMessage = true;
}

console.log('=> Connecting to the default room');
connectRoom(xmpp, jid, process.env.DEFAULT_ROOM, connectData, statusSendWelcomeMessage);
if (process.env.DEFAULT_ROOM.split(",").length > 1) {
const rooms = process.env.DEFAULT_ROOM.split(",")
console.log('rooms list ', rooms)

for (const room of rooms) {
connectRoom(xmpp, jid, process.env.DEFAULT_ROOM, connectData, statusSendWelcomeMessage);
}
} else {
connectRoom(xmpp, jid, process.env.DEFAULT_ROOM, connectData, statusSendWelcomeMessage);
}


} else {
console.log('=> Default room not found');
Expand Down

0 comments on commit 5c46dca

Please sign in to comment.