diff options
author | Minteck <nekostarfan@gmail.com> | 2021-06-05 19:27:48 +0200 |
---|---|---|
committer | Minteck <nekostarfan@gmail.com> | 2021-06-05 19:27:48 +0200 |
commit | 8cf5cefe6e91a5a1ed6eeaae4d94760d84c304a6 (patch) | |
tree | 7096b67b189c0220826123c7d5b121752545d140 /discord/client.js | |
download | kartik-client-8cf5cefe6e91a5a1ed6eeaae4d94760d84c304a6.tar.gz kartik-client-8cf5cefe6e91a5a1ed6eeaae4d94760d84c304a6.tar.bz2 kartik-client-8cf5cefe6e91a5a1ed6eeaae4d94760d84c304a6.zip |
Presque sortie du jeu
Diffstat (limited to 'discord/client.js')
-rw-r--r-- | discord/client.js | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/discord/client.js b/discord/client.js new file mode 100644 index 0000000..1e98faf --- /dev/null +++ b/discord/client.js @@ -0,0 +1,40 @@ +const DiscordRPC = require('discord-rpc'); + +// Set this to your Client ID. +const clientId = '821064368535633920'; + +// Only needed if you want to use spectate, join, or ask to join +DiscordRPC.register(clientId); + +const rpc = new DiscordRPC.Client({ transport: 'ipc' }); +const startTimestamp = new Date(); + +async function setActivity() { + if (!rpc) { + return; + } + + //const boops = await mainWindow.webContents.executeJavaScript('window.boops'); + + // You'll need to have snek_large and snek_small assets uploaded to + // https://discord.com/developers/applications/<application_id>/rich-presence/assets + rpc.setActivity({ + details: win.ddetails, + state: win.dstate, + startTimestamp, + largeImageKey: 'kartik', + largeImageText: 'Kartik, ' + lang.game.credits.by + ' Minteck Projects', + smallImageKey: dimg, + smallImageText: dchan, + instance: false, + }); +} + +rpc.on('ready', () => { + // activity can only be set every 15 seconds + setInterval(() => { + setActivity(); + }, 15e3); +}); + +rpc.login({ clientId }).catch(console.error);
\ No newline at end of file |