From 4d4dacbc711fe9b784681dee63bc128da5683a98 Mon Sep 17 00:00:00 2001 From: Constantin Piber Date: Tue, 19 Oct 2021 18:40:27 +0200 Subject: [PATCH] discord: clean up export (follow-up #380) --- plugins/discord/back.js | 5 +---- plugins/discord/menu.js | 6 +++--- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/plugins/discord/back.js b/plugins/discord/back.js index 3c3ab5fdda..9dc6f9feaf 100644 --- a/plugins/discord/back.js +++ b/plugins/discord/back.js @@ -145,7 +145,4 @@ module.exports.clear = () => { }; module.exports.connect = connect; module.exports.registerRefresh = (cb) => refreshCallbacks.push(cb); -/** - * @type {Info} - */ -module.exports.info = Object.defineProperties({}, Object.keys(info).reduce((o, k) => ({ ...o, [k]: { enumerable: true, get: () => info[k] } }), {})); +module.exports.isConnected = () => info.rpc !== null; diff --git a/plugins/discord/menu.js b/plugins/discord/menu.js index 9750dabe65..49a087d61d 100644 --- a/plugins/discord/menu.js +++ b/plugins/discord/menu.js @@ -1,6 +1,6 @@ const { setOptions } = require("../../config/plugins"); const { edit } = require("../../config"); -const { clear, info, connect, registerRefresh } = require("./back"); +const { clear, connect, registerRefresh, isConnected } = require("./back"); let hasRegisterred = false; @@ -12,8 +12,8 @@ module.exports = (win, options, refreshMenu) => { return [ { - label: info.rpc !== null ? "Connected" : "Reconnect", - enabled: info.rpc === null, + label: isConnected() ? "Connected" : "Reconnect", + enabled: !isConnected(), click: connect, }, {