mirror of
https://github.com/an-anime-team/an-anime-game-launcher.git
synced 2024-12-24 02:28:15 +03:00
Merge branch 'main' of Maroxy/an-ordinary-launcher into main
This commit is contained in:
commit
399e04ea2c
3 changed files with 17 additions and 15 deletions
|
@ -38,6 +38,7 @@
|
|||
}
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/discord-rpc": "^4.0.0",
|
||||
"electron": "^14.0.0",
|
||||
"electron-builder": "^22.13.1",
|
||||
"sass": "^1.41.0",
|
||||
|
|
|
@ -40,8 +40,8 @@ $(() => {
|
|||
|
||||
ipcRenderer.on('rpc-toggle', () => {
|
||||
DiscordRPC.isActive() ?
|
||||
DiscordRPC.init() :
|
||||
DiscordRPC.close();
|
||||
DiscordRPC.close() :
|
||||
DiscordRPC.init();
|
||||
});
|
||||
|
||||
// FIXME
|
||||
|
@ -208,7 +208,8 @@ $(() => {
|
|||
DiscordRPC.setActivity({
|
||||
details: 'In-Game',
|
||||
largeImageKey: 'game',
|
||||
largeImageText: 'An Anime Game Launcher'
|
||||
largeImageText: 'An Anime Game Launcher',
|
||||
startTimestamp: new Date().setDate(new Date().getDate())
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
const discordRpc = require('discord-rpc');
|
||||
import discordRpc, { Client, Presence } from 'discord-rpc';
|
||||
|
||||
export class DiscordRPC
|
||||
{
|
||||
|
@ -8,7 +8,7 @@ export class DiscordRPC
|
|||
|
||||
public static init ()
|
||||
{
|
||||
this.rpc = new discordRpc.Client({ transport: 'ipc' });
|
||||
this.rpc = new discordRpc.Client({ transport: 'ipc' }) as Client;
|
||||
|
||||
this.rpc.login({ clientId: this.clientId }).catch(console.error);
|
||||
|
||||
|
@ -16,18 +16,18 @@ export class DiscordRPC
|
|||
this.rpc.setActivity({
|
||||
details: 'Preparing to launch',
|
||||
largeImageKey: 'launcher',
|
||||
largeImageText: 'An Anime Game Launcher',
|
||||
instance: false
|
||||
largeImageText: 'An Anime Game Launcher'
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
public static setActivity (activity: any): void
|
||||
public static setActivity (activity: Presence): void
|
||||
{
|
||||
this.rpc?.setActivity({
|
||||
startTimestamp: parseInt(new Date().setDate(new Date().getDate()).toString()),
|
||||
instance: false,
|
||||
...activity
|
||||
this.rpc.setActivity({
|
||||
...activity,
|
||||
...{
|
||||
instance: false
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -38,9 +38,9 @@ export class DiscordRPC
|
|||
|
||||
public static close (): void
|
||||
{
|
||||
this.rpc?.clearActivity();
|
||||
this.rpc?.destroy();
|
||||
this.rpc.clearActivity();
|
||||
this.rpc.destroy();
|
||||
|
||||
this.rpc = null;
|
||||
this.rpc = null as any;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue