Skip to content
This repository has been archived by the owner on Sep 7, 2022. It is now read-only.

Commit

Permalink
discord rpc is optional, v1.2.1
Browse files Browse the repository at this point in the history
- also fix large image bug where sometimes it would not display
- remove un-needed `async` from `setActivity` function
  • Loading branch information
Fuwn committed Jun 25, 2020
1 parent 9961479 commit 080f662
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ module.exports = new Store({
debugEnable: false,
menuEnable: true,
configCookieOverwrite: '',
discordRPCEnable: true,
discordRPC: {
clientId: '722389325483999243',
RPC: {
Expand Down
7 changes: 4 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

'use strict';
const path = require('path');
const { app, BrowserWindow, Menu, session } = require('electron');
const { app, BrowserWindow, Menu, session, globalShortcut } = require('electron');
const { autoUpdater } = require('electron-updater');
const { is } = require('electron-util');
const unhandled = require('electron-unhandled');
Expand Down Expand Up @@ -94,7 +94,7 @@ const clientId = config.get('discordRPC').clientId;
const rpc = new DiscordRPC.Client({ transport: 'ipc' });
const startTimestamp = new Date();

async function setActivity() {
function setActivity() {
if (!rpc || !mainWindow) {
return;
}
Expand Down Expand Up @@ -122,7 +122,8 @@ rpc.on('ready', () => {
}, 15e3);
});

rpc.login({ clientId }).catch(console.error);
if (config.get('discordRPCEnable'))
rpc.login({ clientId }).catch(console.error);

(async () => {
await app.whenReady();
Expand Down

0 comments on commit 080f662

Please sign in to comment.