Beginning work on configuration management, updates to UI to prevent unresponsive behavior, bug fixes..
This commit is contained in:
22
app/assets/js/discordwrapper.js
Normal file
22
app/assets/js/discordwrapper.js
Normal file
@@ -0,0 +1,22 @@
|
||||
// Work in progress
|
||||
const Client = require('discord-rpc')
|
||||
const {DEFAULT_CONFIG} = require('./constants')
|
||||
|
||||
let rpc
|
||||
|
||||
function initRPC(){
|
||||
rpc = new Client({ transport: 'ipc' });
|
||||
|
||||
rpc.login(DEFAULT_CONFIG.getDiscordClientID()).catch(error => {
|
||||
if(error.message.includes('ENOENT')) {
|
||||
console.log('Unable to initialize Discord Rich Presence, no client detected.')
|
||||
} else {
|
||||
console.log('Unable to initialize Discord Rich Presence: ' + error.message)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function shutdownRPC(){
|
||||
rpc.destroy()
|
||||
rpc = null
|
||||
}
|
||||
Reference in New Issue
Block a user