Configure Discord RPC

This commit is contained in:
Maroxy 2021-12-11 13:28:10 +01:00
parent d8a112e14c
commit ecf1db1130
No known key found for this signature in database
GPG key ID: F4B27EADB21E3021
3 changed files with 14 additions and 12 deletions

View file

@ -203,10 +203,11 @@ $(() => {
if (DiscordRPC.isActive())
{
DiscordRPC.setActivity({
details: 'In-Game',
details: LauncherLib.getConfig('rpcsettings.ingame.details'),
state: LauncherLib.getConfig('rpcsettings.ingame.state') ? LauncherLib.getConfig('rpcsettings.ingame.state') : undefined,
largeImageKey: 'game',
largeImageText: 'An Anime Game',
startTimestamp: Date.now()
startTimestamp: LauncherLib.getConfig('rpcsettings.ingame.elapsed') ? Date.now() : undefined
});
}

View file

@ -1,4 +1,5 @@
import discordRpc, { Client, Presence } from 'discord-rpc';
import LauncherLib from './LauncherLib';
export default class DiscordRPC
{
@ -14,7 +15,7 @@ export default class DiscordRPC
this.rpc.on('ready', () => {
this.rpc.setActivity({
details: 'Preparing to launch',
details: LauncherLib.getConfig('rpcsettings.launcher'),
largeImageKey: 'launcher',
largeImageText: 'An Anime Game'
});

View file

@ -230,24 +230,24 @@ $(() => {
});
$('#rpc-launch-details').on('change', () => {
if ($('#rpc-launch-details').val() == "")
if ($('#rpc-launch-details').val() == " ")
LauncherLib.updateConfig('rpcsettings.launcher', 'Preparing to launch');
LauncherLib.updateConfig('rpcsettings.launcher', $('#rpc-launch-details').val() as string);
else
LauncherLib.updateConfig('rpcsettings.launcher', $('#rpc-launch-details').val() as string);
});
$('#rpc-game-details').on('change', () => {
if ($('#rpc-game-details').val() == "")
if ($('#rpc-game-details').val() == " ")
LauncherLib.updateConfig('rpcsettings.ingame.details', 'In-Game');
LauncherLib.updateConfig('rpcsettings.ingame.details', $('#rpc-game-details').val() as string);
else
LauncherLib.updateConfig('rpcsettings.ingame.details', $('#rpc-game-details').val() as string);
});
$('#rpc-game-state').on('change', () => {
if ($('#rpc-game-state').val() == "")
if ($('#rpc-game-state').val() == " ")
LauncherLib.updateConfig('rpcsettings.ingame.state', null);
LauncherLib.updateConfig('rpcsettings.ingame.state', $('#rpc-game-state').val() as string);
else
LauncherLib.updateConfig('rpcsettings.ingame.state', $('#rpc-game-state').val() as string);
});
$('#rpc-game-elapsed').on('classChange', () => {