mirror of
https://github.com/an-anime-team/an-anime-game-launcher.git
synced 2024-12-19 16:33:04 +03:00
Configure Discord RPC
This commit is contained in:
parent
d8a112e14c
commit
ecf1db1130
3 changed files with 14 additions and 12 deletions
|
@ -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
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -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'
|
||||
});
|
||||
|
|
|
@ -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', () => {
|
||||
|
|
Loading…
Reference in a new issue