Skip to content

Commit

Permalink
Merge pull request #440 from cpiber/discord-clean
Browse files Browse the repository at this point in the history
Discord plugin: Clean Up Export (follow-up #380)
  • Loading branch information
th-ch authored Oct 24, 2021
2 parents 005c930 + 4d4dacb commit 58c6a12
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
5 changes: 1 addition & 4 deletions plugins/discord/back.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
6 changes: 3 additions & 3 deletions plugins/discord/menu.js
Original file line number Diff line number Diff line change
@@ -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;

Expand All @@ -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,
},
{
Expand Down

0 comments on commit 58c6a12

Please sign in to comment.