diff options
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/manaplus/manaApp/manaApp.interface.ts | 6 | ||||
-rw-r--r-- | src/main/manaplus/update/updater.interface.ts | 6 | ||||
-rw-r--r-- | src/main/richpresence.ts | 45 |
3 files changed, 57 insertions, 0 deletions
diff --git a/src/main/manaplus/manaApp/manaApp.interface.ts b/src/main/manaplus/manaApp/manaApp.interface.ts new file mode 100644 index 0000000..81368e6 --- /dev/null +++ b/src/main/manaplus/manaApp/manaApp.interface.ts @@ -0,0 +1,6 @@ +export default interface ManaPlusApplication { + constructor():void, + run(parameters:string[]):void, + getGameDir():string, + getVersion():Promise<string> +} diff --git a/src/main/manaplus/update/updater.interface.ts b/src/main/manaplus/update/updater.interface.ts new file mode 100644 index 0000000..1524649 --- /dev/null +++ b/src/main/manaplus/update/updater.interface.ts @@ -0,0 +1,6 @@ +export default interface ManaUpdater { + constructor():void, + updateAvailible():Promise<{isNewVersion:boolean, newestVersion:string}>, + update():Promise<any>, + reinstall():Promise<any> +} diff --git a/src/main/richpresence.ts b/src/main/richpresence.ts new file mode 100644 index 0000000..f39341b --- /dev/null +++ b/src/main/richpresence.ts @@ -0,0 +1,45 @@ +// Only for testing as of right now +const DiscordRPC = require('discord-rpc'); + +const ClientId = '447258715586822154'; + +DiscordRPC.register(ClientId); + +const rpc = new DiscordRPC.Client({ transport: 'ipc' }); +const startTimestamp = new Date(); + +async function setActivity() { + if (!rpc) + return false; + + rpc.setActivity({ + details: `booped times`, + startTimestamp, + largeImageKey: 'connect', + largeImageText: 'Currently on map xy', + // smallImageKey: 'snek_small', + // smallImageText: 'i am my own pillows', + partySize:2, //TODO get online players + partyMax:100, + partyId:"ae488379-351d-4a4f-ad32-2b9b01c91657", + joinSecret:"MTI4NzM0OjFpMmhuZToxMjMxMjM=" + }); +} + +rpc.on('ready', () => { + setActivity(); + + // activity can only be set every 15 seconds + setInterval(() => { + setActivity(); + }, 15e3); +}); + +rpc.login(ClientId).catch(console.error); + +rpc.subscribe("",console.log); + +export function quit(){ + rpc.destroy(); + console.log("Shutting down Discord RPC integration"); +} |