statut discord

This commit is contained in:
luki39 2022-02-23 17:33:27 +01:00
parent 62b6ca702c
commit e93bff1ff0
2 changed files with 7 additions and 15 deletions

View File

@ -82,11 +82,3 @@ client.login({clientId: "946067255295369248"}).catch(error => {
logger.log('Unable to initialize Discord Rich Presence: ' + error.message, error) logger.log('Unable to initialize Discord Rich Presence: ' + error.message, error)
} }
}) })
exports.shutdownRPC = function(){
if(!client) return
client.clearActivity()
client.destroy()
client = null
activity = null
}

View File

@ -465,7 +465,7 @@ function asyncSystemScan(mcVersion, launchAfter = true){
// Keep reference to Minecraft Process // Keep reference to Minecraft Process
let proc let proc
// Is DiscordRPC enabled // Is DiscordRPC enabled
let hasRPC = false //let hasRPC = false
// Joined server regex // Joined server regex
// Change this if your server uses something different. // Change this if your server uses something different.
const GAME_JOINED_REGEX = /\[.+\]: Sound engine started/ const GAME_JOINED_REGEX = /\[.+\]: Sound engine started/
@ -655,9 +655,9 @@ function dlAsync(login = true){
const onLoadComplete = () => { const onLoadComplete = () => {
toggleLaunchArea(false) toggleLaunchArea(false)
if(hasRPC){ /*if(hasRPC){
DiscordWrapper.updateDetails('Loading game..') DiscordWrapper.updateDetails('Loading game..')
} }*/
proc.stdout.on('data', gameStateChange) proc.stdout.on('data', gameStateChange)
proc.stdout.removeListener('data', tempListener) proc.stdout.removeListener('data', tempListener)
proc.stderr.removeListener('data', gameErrorListener) proc.stderr.removeListener('data', gameErrorListener)
@ -707,10 +707,10 @@ function dlAsync(login = true){
setLaunchDetails('Done. Enjoy the server!') setLaunchDetails('Done. Enjoy the server!')
// Init Discord Hook /*// Init Discord Hook
const distro = DistroManager.getDistribution() const distro = DistroManager.getDistribution()
if(distro.discord != null && serv.discord != null){ if(distro.discord != null && serv.discord != null){
DiscordWrapper.initRPC(distro.discord, serv.discord) //DiscordWrapper.initRPC(distro.discord, serv.discord)
hasRPC = true hasRPC = true
proc.on('close', (code, signal) => { proc.on('close', (code, signal) => {
loggerLaunchSuite.log('Shutting down Discord Rich Presence..') loggerLaunchSuite.log('Shutting down Discord Rich Presence..')
@ -718,7 +718,7 @@ function dlAsync(login = true){
hasRPC = false hasRPC = false
proc = null proc = null
}) })
} }*/
} catch(err) { } catch(err) {