From 2892913caa55dbdeb22b7a755aa6af706fedee2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christer=20War=C3=A9n?= Date: Tue, 14 Sep 2021 17:12:47 +0300 Subject: [PATCH] Update maintenance command --- src/client/commands/maintenance.js | 44 ++++++++++++++++++++---------- 1 file changed, 30 insertions(+), 14 deletions(-) diff --git a/src/client/commands/maintenance.js b/src/client/commands/maintenance.js index b9c5793..d161b61 100644 --- a/src/client/commands/maintenance.js +++ b/src/client/commands/maintenance.js @@ -158,35 +158,51 @@ module.exports = { client.config.maintenanceMode = false; break; case "10": + client.config.streamerMode = "manual"; client.config.maintenanceMode = true; + client.user.setStatus('idle'); client.funcs.saveRadios(client); - client.streamer.leave(client); + setInterval(() => { + if(client.radio.size == 0 && client.config.streamerMode == "manual" && client.config.maintenanceMode){ + client.streamer.leave(client); + client.streamer = new Streamer(); + client.streamer.init(client); - client.config.streamerMode = "manual"; - client.streamer = new Streamer(); - client.streamer.init(client); + client.funcs.restoreRadios(client, guilds); + client.user.setStatus('online'); + client.config.maintenanceMode = false; + } - client.funcs.restoreRadios(client, guilds); - client.user.setStatus('online'); - client.config.maintenanceMode = false; + if(!client.config.maintenanceMode){ + clearInterval(); + } + }, 500); break; case "11": + client.config.streamerMode = "auto"; client.config.maintenanceMode = true; + client.user.setStatus('idle'); client.funcs.saveRadios(client); - client.streamer.leave(client); + setInterval(() => { + if(client.radio.size == 0 && client.config.streamerMode == "auto" && client.config.maintenanceMode){ + client.streamer.leave(client); + client.streamer = new Streamer(); + client.streamer.init(client); - client.config.streamerMode = "auto"; - client.streamer = new Streamer(); - client.streamer.init(client); + client.funcs.restoreRadios(client, guilds); + client.user.setStatus('online'); + client.config.maintenanceMode = false; + } - client.funcs.restoreRadios(client, guilds); - client.user.setStatus('online'); - client.config.maintenanceMode = false; + if(!client.config.maintenanceMode){ + clearInterval(); + } + }, 500); break; default: