mirror of
https://github.com/an-anime-team/an-anime-game-launcher.git
synced 2024-12-24 18:48:14 +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())
|
if (DiscordRPC.isActive())
|
||||||
{
|
{
|
||||||
DiscordRPC.setActivity({
|
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',
|
largeImageKey: 'game',
|
||||||
largeImageText: 'An Anime 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 discordRpc, { Client, Presence } from 'discord-rpc';
|
||||||
|
import LauncherLib from './LauncherLib';
|
||||||
|
|
||||||
export default class DiscordRPC
|
export default class DiscordRPC
|
||||||
{
|
{
|
||||||
|
@ -14,7 +15,7 @@ export default class DiscordRPC
|
||||||
|
|
||||||
this.rpc.on('ready', () => {
|
this.rpc.on('ready', () => {
|
||||||
this.rpc.setActivity({
|
this.rpc.setActivity({
|
||||||
details: 'Preparing to launch',
|
details: LauncherLib.getConfig('rpcsettings.launcher'),
|
||||||
largeImageKey: 'launcher',
|
largeImageKey: 'launcher',
|
||||||
largeImageText: 'An Anime Game'
|
largeImageText: 'An Anime Game'
|
||||||
});
|
});
|
||||||
|
|
|
@ -230,23 +230,23 @@ $(() => {
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#rpc-launch-details').on('change', () => {
|
$('#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', 'Preparing to launch');
|
||||||
|
else
|
||||||
LauncherLib.updateConfig('rpcsettings.launcher', $('#rpc-launch-details').val() as string);
|
LauncherLib.updateConfig('rpcsettings.launcher', $('#rpc-launch-details').val() as string);
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#rpc-game-details').on('change', () => {
|
$('#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', 'In-Game');
|
||||||
|
else
|
||||||
LauncherLib.updateConfig('rpcsettings.ingame.details', $('#rpc-game-details').val() as string);
|
LauncherLib.updateConfig('rpcsettings.ingame.details', $('#rpc-game-details').val() as string);
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#rpc-game-state').on('change', () => {
|
$('#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', null);
|
||||||
|
else
|
||||||
LauncherLib.updateConfig('rpcsettings.ingame.state', $('#rpc-game-state').val() as string);
|
LauncherLib.updateConfig('rpcsettings.ingame.state', $('#rpc-game-state').val() as string);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue