From ab9b4f6942972c0ffd0d707ecef1e094392fa68a Mon Sep 17 00:00:00 2001 From: General Wrex Date: Mon, 10 Feb 2020 21:02:04 -0800 Subject: [PATCH 01/32] added which tab they are working on --- src/dbm-rich-presence.js | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/src/dbm-rich-presence.js b/src/dbm-rich-presence.js index feb1c86..f72864b 100644 --- a/src/dbm-rich-presence.js +++ b/src/dbm-rich-presence.js @@ -62,6 +62,7 @@ function setModal() { }, 1000); } +let options; function setRichPresence() { if (!enableRPC) return; @@ -70,13 +71,16 @@ function setRichPresence() { const stateVal = `Project: ${require(resolve('settings.json'))['current-project'].replace(/\\/g, '/').split('/').slice(-1).toString()}`; + options = { + state: stateVal, + largeImageKey: 'dbm', + largeImageText: 'DBM Rich Presence v1.0.1', + startTimestamp: Date.now() + }; + + function setActivity() { - rpc.setActivity({ - state: stateVal, - largeImageKey: 'dbm', - largeImageText: 'DBM Rich Presence v1.0.0', - startTimestamp: Date.now() - }); + rpc.setActivity(options); } rpc.on('ready', () => { @@ -84,7 +88,7 @@ function setRichPresence() { setTimeout(() => setActivity(), 1000); }); - rpc.login({ clientId: '675588061140353025' }).catch(() => alert('Some error ocurred on set your RPC.')); + rpc.login({ clientId: '675588061140353025' }).catch(() => alert('Some error ocurred on setting Rich Presence Config!')); } function stopRichPresence() { @@ -96,6 +100,17 @@ function stopRichPresence() { }); } + const shiftTabs = DBM.shiftTabs; + DBM.shiftTabs = function(event, section, index) { + try { + options.details = 'Editing: ' + section; + rpc.setActivity(options); + } catch (err) { + alert(err); + } + shiftTabs.apply(this, arguments); +} + setMenu(); setModal(); setRichPresence(); From 62cab1130dda57459a1bfe143e46f91df2a208b8 Mon Sep 17 00:00:00 2001 From: General Wrex Date: Mon, 10 Feb 2020 22:33:42 -0800 Subject: [PATCH 02/32] Added Which tab and Command or Event was being worked on Added Option to show or hide command and event names --- src/dbm-rich-presence.js | 98 ++++++++++++++++++++++++++++++++-------- src/rpcSettings.json | 2 +- 2 files changed, 79 insertions(+), 21 deletions(-) diff --git a/src/dbm-rich-presence.js b/src/dbm-rich-presence.js index f72864b..487d18f 100644 --- a/src/dbm-rich-presence.js +++ b/src/dbm-rich-presence.js @@ -1,13 +1,14 @@ + const version = '1.0.9'; /*======================================================* * * - * # DBM Rich Presence - v1.0.0 * - * Created by Cap * + * # DBM Rich Presence - v1.0.9 * + * Created by Cap & General Wrex * * https://github.com/CapOliveiraBr/DBM-Rich-Presence * * * *======================================================*/ const { writeFileSync } = require('fs'); -const { resolve } = require('path'); +const { resolve, join } = require('path'); let modal; let Menu; @@ -15,6 +16,10 @@ let rpc; const settings = require(resolve('rpcSettings.json')); let enableRPC; +let enableCmdNames; + +let currentProject; +let options; function setMenu() { Menu = nw.Window.get().menu; @@ -36,25 +41,32 @@ function setModal() { modal.id = 'discordRichPresence'; modal.classList.add('ui'); modal.classList.add('modal'); - modal.setAttribute('style', 'padding: 20px; height: 220px; border-radius: 10px; background-color: #36393e; border: 2px solid #000;'); + modal.setAttribute('style', 'padding: 20px; height: 320px; border-radius: 10px; background-color: #36393e; border: 2px solid #000;'); modal.innerHTML = ` -

DBM Rich Presence - v1.0.0

- Created by Cap - Repository +

DBM Rich Presence - v${version}

+ Created by Cap & General Wrex - Repository

Settings

Enable RPC:



+ Show Command/Event Names:

+ `; document.body.appendChild(modal); document.getElementById('enableRPC').value = settings.enableRPC; + document.getElementById('enableCmdNames').value = settings.enableCmdNames; setInterval(() => { enableRPC = document.getElementById('enableRPC').value === 'true' ? true : false; + enableCmdNames = document.getElementById('enableCmdNames').value === 'true' ? true : false; - writeFileSync(resolve('rpcSettings.json'), JSON.stringify({ enableRPC })); + writeFileSync(resolve('rpcSettings.json'), JSON.stringify({ enableRPC, enableCmdNames })); if (enableRPC) { if (!rpc) setRichPresence(); @@ -62,19 +74,20 @@ function setModal() { }, 1000); } -let options; function setRichPresence() { if (!enableRPC) return; const { Client } = require('discord-rpc'); rpc = new Client({ transport: 'ipc' }); - const stateVal = `Project: ${require(resolve('settings.json'))['current-project'].replace(/\\/g, '/').split('/').slice(-1).toString()}`; + currentProject = require(resolve('settings.json'))['current-project']; + const stateVal = `Project: ${currentProject.replace(/\\/g, '/').split('/').slice(-1).toString()}`; options = { state: stateVal, + details: 'Editing Commands', largeImageKey: 'dbm', - largeImageText: 'DBM Rich Presence v1.0.1', + largeImageText: 'DBM Rich Presence v'+version, startTimestamp: Date.now() }; @@ -88,7 +101,7 @@ function setRichPresence() { setTimeout(() => setActivity(), 1000); }); - rpc.login({ clientId: '675588061140353025' }).catch(() => alert('Some error ocurred on setting Rich Presence Config!')); + rpc.login({ clientId: '675588061140353025' }).catch(() => alert('Some error ocurred on setting the Rich Presence!')); } function stopRichPresence() { @@ -100,16 +113,61 @@ function stopRichPresence() { }); } - const shiftTabs = DBM.shiftTabs; - DBM.shiftTabs = function(event, section, index) { - try { - options.details = 'Editing: ' + section; - rpc.setActivity(options); - } catch (err) { - alert(err); - } - shiftTabs.apply(this, arguments); +function getName(type, index){ + return require(join(currentProject, 'data', `${type.toLowerCase()}.json`))[index].name +} + +function overrideFunctions(){ + + const cache = { + Commands: enableCmdNames ? `Command: ${getName('Commands', 1)} ` : `Editing Commands` , + Events: enableCmdNames ? `Event ${getName('Events', 1)} ` : `Editing Events` , + Settings: 'Editing Bot Settings' + }; + + // when the tab is changed + let section = "Commands"; + const shiftTabs = DBM.shiftTabs; + DBM.shiftTabs = function(event, sect, index) { + try { + section = sect; + options.details = cache[sect]; + rpc.setActivity(options); + }catch (err) { + alert(err); + } + shiftTabs.apply(this, arguments); + } + + // when a command name is clicked + const onCommandClick = DBM.onCommandClick; + DBM.onCommandClick = function(index) { + try { + const details = enableCmdNames ? `${section.slice(0, -1)}: ${getName(section, index)} ` : `Editing ${section}` + cache['Commands'] = details; + options.details = details; + rpc.setActivity(options); + } catch (err) { + alert(err); + } + onCommandClick.apply(this, arguments); + } + + // when an event name is clicked + const eonCommandClick = DBM.eonCommandClick; + DBM.eonCommandClick = function(index) { + try { + const details = enableCmdNames ? `${section.slice(0, -1)}: ${getName(section, index)} ` : `Editing ${section}` + cache['Events'] = details; + options.details = details; + rpc.setActivity(options); + } catch (err) { + alert(err); + } + eonCommandClick.apply(this, arguments); + } } +setTimeout(() => overrideFunctions(), 1000); setMenu(); setModal(); diff --git a/src/rpcSettings.json b/src/rpcSettings.json index 1c36972..4674d06 100644 --- a/src/rpcSettings.json +++ b/src/rpcSettings.json @@ -1 +1 @@ -{"enableRPC":true} \ No newline at end of file +{"enableRPC":true,"enableCmdNames":true} \ No newline at end of file From 95637da67e9638c49bf1cfcbc610ecad2c970ef2 Mon Sep 17 00:00:00 2001 From: General Wrex <1731139+generalwrex@users.noreply.github.com> Date: Mon, 10 Feb 2020 22:38:17 -0800 Subject: [PATCH 03/32] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 63416f7..faf247b 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,7 @@ Download the latest release of the RPC [here](https://github.com/CapOliveiraBr/D When you install the RPC, a new menu tab is added to DBM, called "**Integrations**", inside it you can go to **DBM Rich Presence** where you can see some settings. ![](https://i.imgur.com/Mz1xPcz.png) -![](https://i.imgur.com/jVgGIJ0.png) +![](https://i.imgur.com/OUuFjjy.png) --- From 228014eba1c7fe7b2816442b01b951322e2d542d Mon Sep 17 00:00:00 2001 From: General Wrex Date: Mon, 10 Feb 2020 23:09:54 -0800 Subject: [PATCH 04/32] Code Refactoring --- src/dbm-rich-presence.js | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/src/dbm-rich-presence.js b/src/dbm-rich-presence.js index 487d18f..ec8df38 100644 --- a/src/dbm-rich-presence.js +++ b/src/dbm-rich-presence.js @@ -1,8 +1,9 @@ - const version = '1.0.9'; + const rpcVersion = '1.0.9'; + /*======================================================* * * * # DBM Rich Presence - v1.0.9 * - * Created by Cap & General Wrex * + * Created by Cap & General Wrex * * https://github.com/CapOliveiraBr/DBM-Rich-Presence * * * *======================================================*/ @@ -14,13 +15,13 @@ let modal; let Menu; let rpc; +let currentProject; +let options; + const settings = require(resolve('rpcSettings.json')); let enableRPC; let enableCmdNames; -let currentProject; -let options; - function setMenu() { Menu = nw.Window.get().menu; @@ -43,7 +44,7 @@ function setModal() { modal.classList.add('modal'); modal.setAttribute('style', 'padding: 20px; height: 320px; border-radius: 10px; background-color: #36393e; border: 2px solid #000;'); modal.innerHTML = ` -

DBM Rich Presence - v${version}

+

DBM Rich Presence - v${rpcVersion}

Created by Cap & General Wrex - Repository

Settings

Enable RPC:

@@ -87,11 +88,10 @@ function setRichPresence() { state: stateVal, details: 'Editing Commands', largeImageKey: 'dbm', - largeImageText: 'DBM Rich Presence v'+version, + largeImageText: `DBM Rich Presence v${rpcVersion}`, startTimestamp: Date.now() }; - function setActivity() { rpc.setActivity(options); } @@ -113,11 +113,11 @@ function stopRichPresence() { }); } -function getName(type, index){ +function getName(type, index) { return require(join(currentProject, 'data', `${type.toLowerCase()}.json`))[index].name } -function overrideFunctions(){ +function overrideFunctions() { const cache = { Commands: enableCmdNames ? `Command: ${getName('Commands', 1)} ` : `Editing Commands` , @@ -128,7 +128,7 @@ function overrideFunctions(){ // when the tab is changed let section = "Commands"; const shiftTabs = DBM.shiftTabs; - DBM.shiftTabs = function(event, sect, index) { + DBM.shiftTabs = (event, sect, index) => { try { section = sect; options.details = cache[sect]; @@ -141,7 +141,7 @@ function overrideFunctions(){ // when a command name is clicked const onCommandClick = DBM.onCommandClick; - DBM.onCommandClick = function(index) { + DBM.onCommandClick = (index) => { try { const details = enableCmdNames ? `${section.slice(0, -1)}: ${getName(section, index)} ` : `Editing ${section}` cache['Commands'] = details; @@ -155,7 +155,7 @@ function overrideFunctions(){ // when an event name is clicked const eonCommandClick = DBM.eonCommandClick; - DBM.eonCommandClick = function(index) { + DBM.eonCommandClick = (index) => { try { const details = enableCmdNames ? `${section.slice(0, -1)}: ${getName(section, index)} ` : `Editing ${section}` cache['Events'] = details; @@ -167,8 +167,9 @@ function overrideFunctions(){ eonCommandClick.apply(this, arguments); } } -setTimeout(() => overrideFunctions(), 1000); setMenu(); setModal(); setRichPresence(); + +setTimeout(() => overrideFunctions(), 1000); From 93bb7fcf58505293c20e256447b767425196ddef Mon Sep 17 00:00:00 2001 From: General Wrex Date: Tue, 11 Feb 2020 00:03:54 -0800 Subject: [PATCH 05/32] Code Refactoring #2 --- src/dbm-rich-presence.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/dbm-rich-presence.js b/src/dbm-rich-presence.js index ec8df38..9d4d5ee 100644 --- a/src/dbm-rich-presence.js +++ b/src/dbm-rich-presence.js @@ -120,13 +120,13 @@ function getName(type, index) { function overrideFunctions() { const cache = { - Commands: enableCmdNames ? `Command: ${getName('Commands', 1)} ` : `Editing Commands` , - Events: enableCmdNames ? `Event ${getName('Events', 1)} ` : `Editing Events` , + Commands: enableCmdNames ? `Command: ${getName('Commands', 1)} ` : 'Editing Commands' , + Events: enableCmdNames ? `Event ${getName('Events', 1)} ` : 'Editing Events' , Settings: 'Editing Bot Settings' }; // when the tab is changed - let section = "Commands"; + let section = 'Commands'; const shiftTabs = DBM.shiftTabs; DBM.shiftTabs = (event, sect, index) => { try { @@ -136,6 +136,7 @@ function overrideFunctions() { }catch (err) { alert(err); } + shiftTabs.apply(this, arguments); } @@ -143,13 +144,14 @@ function overrideFunctions() { const onCommandClick = DBM.onCommandClick; DBM.onCommandClick = (index) => { try { - const details = enableCmdNames ? `${section.slice(0, -1)}: ${getName(section, index)} ` : `Editing ${section}` + const details = enableCmdNames ? `${section.slice(0, -1)}: ${getName(section, index)}` : `Editing ${section}` cache['Commands'] = details; options.details = details; rpc.setActivity(options); } catch (err) { alert(err); } + onCommandClick.apply(this, arguments); } @@ -157,13 +159,14 @@ function overrideFunctions() { const eonCommandClick = DBM.eonCommandClick; DBM.eonCommandClick = (index) => { try { - const details = enableCmdNames ? `${section.slice(0, -1)}: ${getName(section, index)} ` : `Editing ${section}` + const details = enableCmdNames ? `${section.slice(0, -1)}: ${getName(section, index)}` : `Editing ${section}` cache['Events'] = details; options.details = details; rpc.setActivity(options); } catch (err) { alert(err); } + eonCommandClick.apply(this, arguments); } } From d65123b7ee810326e3235726dfe3d478878a02d0 Mon Sep 17 00:00:00 2001 From: General Wrex Date: Tue, 11 Feb 2020 00:22:48 -0800 Subject: [PATCH 06/32] Code Refactoring #3 --- src/dbm-rich-presence.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/dbm-rich-presence.js b/src/dbm-rich-presence.js index 9d4d5ee..a6e590a 100644 --- a/src/dbm-rich-presence.js +++ b/src/dbm-rich-presence.js @@ -133,7 +133,7 @@ function overrideFunctions() { section = sect; options.details = cache[sect]; rpc.setActivity(options); - }catch (err) { + }catch(err) { alert(err); } @@ -148,7 +148,7 @@ function overrideFunctions() { cache['Commands'] = details; options.details = details; rpc.setActivity(options); - } catch (err) { + } catch(alert) { alert(err); } @@ -163,8 +163,8 @@ function overrideFunctions() { cache['Events'] = details; options.details = details; rpc.setActivity(options); - } catch (err) { - alert(err); + } catch(err) { + alert(err); } eonCommandClick.apply(this, arguments); From 1066771fade3884f6ea6e883cbb25bdc78ed1427 Mon Sep 17 00:00:00 2001 From: Cap <48036034+CapOliveiraBr@users.noreply.github.com> Date: Tue, 11 Feb 2020 06:11:20 -0300 Subject: [PATCH 07/32] Update dbm-rich-presence.js --- src/dbm-rich-presence.js | 38 +++++++++++++++----------------------- 1 file changed, 15 insertions(+), 23 deletions(-) diff --git a/src/dbm-rich-presence.js b/src/dbm-rich-presence.js index a6e590a..ace2604 100644 --- a/src/dbm-rich-presence.js +++ b/src/dbm-rich-presence.js @@ -13,15 +13,15 @@ const { resolve, join } = require('path'); let modal; let Menu; -let rpc; -let currentProject; +let rpc; let options; - const settings = require(resolve('rpcSettings.json')); let enableRPC; let enableCmdNames; +let currentProject; + function setMenu() { Menu = nw.Window.get().menu; @@ -92,13 +92,9 @@ function setRichPresence() { startTimestamp: Date.now() }; - function setActivity() { - rpc.setActivity(options); - } - rpc.on('ready', () => { - setActivity(); - setTimeout(() => setActivity(), 1000); + rpc.setActivity(options); + setTimeout(() => rpc.setActivity(options), 1000); }); rpc.login({ clientId: '675588061140353025' }).catch(() => alert('Some error ocurred on setting the Rich Presence!')); @@ -118,14 +114,12 @@ function getName(type, index) { } function overrideFunctions() { - const cache = { - Commands: enableCmdNames ? `Command: ${getName('Commands', 1)} ` : 'Editing Commands' , - Events: enableCmdNames ? `Event ${getName('Events', 1)} ` : 'Editing Events' , + Commands: enableCmdNames ? `Command: ${getName('Commands', 1)} ` : 'Editing Commands', + Events: enableCmdNames ? `Event ${getName('Events', 1)} ` : 'Editing Events', Settings: 'Editing Bot Settings' }; - // when the tab is changed let section = 'Commands'; const shiftTabs = DBM.shiftTabs; DBM.shiftTabs = (event, sect, index) => { @@ -133,33 +127,31 @@ function overrideFunctions() { section = sect; options.details = cache[sect]; rpc.setActivity(options); - }catch(err) { + } catch(err) { alert(err); } shiftTabs.apply(this, arguments); } - // when a command name is clicked const onCommandClick = DBM.onCommandClick; DBM.onCommandClick = (index) => { try { - const details = enableCmdNames ? `${section.slice(0, -1)}: ${getName(section, index)}` : `Editing ${section}` - cache['Commands'] = details; - options.details = details; - rpc.setActivity(options); - } catch(alert) { + const details = enableCmdNames ? `${section.slice(0, -1)}: ${getName(section, index)}` : `Editing ${section}`; + cache['Commands'] = details; + options.details = details; + rpc.setActivity(options); + } catch(err) { alert(err); } onCommandClick.apply(this, arguments); } - // when an event name is clicked const eonCommandClick = DBM.eonCommandClick; DBM.eonCommandClick = (index) => { try { - const details = enableCmdNames ? `${section.slice(0, -1)}: ${getName(section, index)}` : `Editing ${section}` + const details = enableCmdNames ? `${section.slice(0, -1)}: ${getName(section, index)}` : `Editing ${section}`; cache['Events'] = details; options.details = details; rpc.setActivity(options); @@ -173,6 +165,6 @@ function overrideFunctions() { setMenu(); setModal(); -setRichPresence(); +setRichPresence(); setTimeout(() => overrideFunctions(), 1000); From 5fb9067e31352a47b758427b18174c5ac22c847f Mon Sep 17 00:00:00 2001 From: Cap <48036034+CapOliveiraBr@users.noreply.github.com> Date: Tue, 11 Feb 2020 06:13:38 -0300 Subject: [PATCH 08/32] Update dbm-rich-presence.js --- src/dbm-rich-presence.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/dbm-rich-presence.js b/src/dbm-rich-presence.js index ace2604..b229de7 100644 --- a/src/dbm-rich-presence.js +++ b/src/dbm-rich-presence.js @@ -16,6 +16,7 @@ let Menu; let rpc; let options; + const settings = require(resolve('rpcSettings.json')); let enableRPC; let enableCmdNames; @@ -28,7 +29,7 @@ function setMenu() { const dbmRichPresenceMenu = new nw.Menu(); dbmRichPresenceMenu.append(new nw.MenuItem({ label: 'DBM Rich Presence', - click: () => jQuery('#discordRichPresence').modal('show') + click: () => jQuery('#dbmRichPresence').modal('show') })) Menu.append(new nw.MenuItem({ @@ -39,7 +40,7 @@ function setMenu() { function setModal() { modal = document.createElement('div'); - modal.id = 'discordRichPresence'; + modal.id = 'dbmRichPresence'; modal.classList.add('ui'); modal.classList.add('modal'); modal.setAttribute('style', 'padding: 20px; height: 320px; border-radius: 10px; background-color: #36393e; border: 2px solid #000;'); From a598606ffe51d6b78b46beff358883fe5b027912 Mon Sep 17 00:00:00 2001 From: Cap <48036034+CapOliveiraBr@users.noreply.github.com> Date: Tue, 11 Feb 2020 06:15:20 -0300 Subject: [PATCH 09/32] Update dbm-rich-presence.js --- src/dbm-rich-presence.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dbm-rich-presence.js b/src/dbm-rich-presence.js index b229de7..d9e28fd 100644 --- a/src/dbm-rich-presence.js +++ b/src/dbm-rich-presence.js @@ -55,7 +55,7 @@ function setModal() {

Show Command/Event Names:

`; From b8b4ce4c6d4e4cd14d31a935386ce03c2c8d1e46 Mon Sep 17 00:00:00 2001 From: Cap <48036034+CapOliveiraBr@users.noreply.github.com> Date: Tue, 11 Feb 2020 06:15:32 -0300 Subject: [PATCH 10/32] Update dbm-rich-presence.js From 04e93bc983d8ecbb8095eafd6d42f4be5d544ab6 Mon Sep 17 00:00:00 2001 From: Cap <48036034+CapOliveiraBr@users.noreply.github.com> Date: Tue, 11 Feb 2020 06:18:14 -0300 Subject: [PATCH 11/32] Update dbm-rich-presence.js --- src/dbm-rich-presence.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dbm-rich-presence.js b/src/dbm-rich-presence.js index d9e28fd..c81c3ad 100644 --- a/src/dbm-rich-presence.js +++ b/src/dbm-rich-presence.js @@ -111,7 +111,7 @@ function stopRichPresence() { } function getName(type, index) { - return require(join(currentProject, 'data', `${type.toLowerCase()}.json`))[index].name + return require(join(currentProject, 'data', `${type.toLowerCase()}.json`))[index].name; } function overrideFunctions() { From ab6067afd89c440ce6464eb9c27b70f3f6585151 Mon Sep 17 00:00:00 2001 From: Cap <48036034+CapOliveiraBr@users.noreply.github.com> Date: Tue, 11 Feb 2020 06:28:00 -0300 Subject: [PATCH 12/32] Update dbm-rich-presence.js --- src/dbm-rich-presence.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/dbm-rich-presence.js b/src/dbm-rich-presence.js index c81c3ad..7d30bf7 100644 --- a/src/dbm-rich-presence.js +++ b/src/dbm-rich-presence.js @@ -8,6 +8,7 @@ * * *======================================================*/ +const { Window, Menu, MenuItem, Shell } = nw; const { writeFileSync } = require('fs'); const { resolve, join } = require('path'); @@ -24,15 +25,15 @@ let enableCmdNames; let currentProject; function setMenu() { - Menu = nw.Window.get().menu; + Menu = Window.get().menu; - const dbmRichPresenceMenu = new nw.Menu(); - dbmRichPresenceMenu.append(new nw.MenuItem({ + const dbmRichPresenceMenu = new Menu(); + dbmRichPresenceMenu.append(new MenuItem({ label: 'DBM Rich Presence', click: () => jQuery('#dbmRichPresence').modal('show') })) - Menu.append(new nw.MenuItem({ + Menu.append(new MenuItem({ label: 'Integrations', submenu: dbmRichPresenceMenu })); @@ -46,7 +47,7 @@ function setModal() { modal.setAttribute('style', 'padding: 20px; height: 320px; border-radius: 10px; background-color: #36393e; border: 2px solid #000;'); modal.innerHTML = `

DBM Rich Presence - v${rpcVersion}

- Created by Cap & General Wrex - Repository + Created by Cap & General Wrex - Repository

Settings

Enable RPC:

@@ -60,16 +60,16 @@ function setModal() { `; - + document.body.appendChild(modal); - + document.getElementById('enableRPC').value = settings.enableRPC; document.getElementById('enableCmdNames').value = settings.enableCmdNames; - + setInterval(() => { enableRPC = document.getElementById('enableRPC').value === 'true' ? true : false; enableCmdNames = document.getElementById('enableCmdNames').value === 'true' ? true : false; - + writeFileSync(resolve('rpcSettings.json'), JSON.stringify({ enableRPC, enableCmdNames })); if (enableRPC) { @@ -96,8 +96,12 @@ function setRichPresence() { }; rpc.on('ready', () => { - rpc.setActivity(options); - setTimeout(() => rpc.setActivity(options), 1000); + try { + rpc.setActivity(options); + setTimeout(() => rpc.setActivity(options), 1000); + } catch(err) { + alert(err); + } }); rpc.login({ clientId: '675588061140353025' }).catch(() => alert('Some error ocurred on setting the Rich Presence!')); @@ -105,7 +109,7 @@ function setRichPresence() { function stopRichPresence() { if (!rpc) return; - + rpc.clearActivity().then(() => { rpc.destroy(); rpc = null; @@ -122,8 +126,9 @@ function overrideFunctions() { Events: enableCmdNames ? `Event ${getName('Events', 1)} ` : 'Editing Events', Settings: 'Editing Bot Settings' }; - + let section = 'Commands'; + const shiftTabs = DBM.shiftTabs; DBM.shiftTabs = (event, sect, index) => { try { @@ -133,7 +138,7 @@ function overrideFunctions() { } catch(err) { alert(err); } - + shiftTabs.apply(this, arguments); } @@ -147,7 +152,7 @@ function overrideFunctions() { } catch(err) { alert(err); } - + onCommandClick.apply(this, arguments); } @@ -161,9 +166,9 @@ function overrideFunctions() { } catch(err) { alert(err); } - + eonCommandClick.apply(this, arguments); - } + } } setMenu(); From e885876a86afcd89278608d8580193edc7d10309 Mon Sep 17 00:00:00 2001 From: Cap <48036034+CapOliveiraBr@users.noreply.github.com> Date: Tue, 11 Feb 2020 11:46:16 -0300 Subject: [PATCH 17/32] Update dbm-rich-presence.js --- src/dbm-rich-presence.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/dbm-rich-presence.js b/src/dbm-rich-presence.js index 66d8e9e..adcee3c 100644 --- a/src/dbm-rich-presence.js +++ b/src/dbm-rich-presence.js @@ -60,18 +60,18 @@ function setModal() { `; - + document.body.appendChild(modal); - + document.getElementById('enableRPC').value = settings.enableRPC; document.getElementById('enableCmdNames').value = settings.enableCmdNames; - + setInterval(() => { enableRPC = document.getElementById('enableRPC').value === 'true' ? true : false; enableCmdNames = document.getElementById('enableCmdNames').value === 'true' ? true : false; - + writeFileSync(resolve('rpcSettings.json'), JSON.stringify({ enableRPC, enableCmdNames })); - + if (enableRPC) { if (!rpc) setRichPresence(); } else stopRichPresence(); @@ -88,8 +88,8 @@ function setRichPresence() { const stateVal = `Project: ${currentProject.replace(/\\/g, '/').split('/').slice(-1).toString()}`; options = { - state: stateVal, details: 'Editing Commands', + state: stateVal, largeImageKey: 'dbm', largeImageText: `DBM Rich Presence v${rpcVersion}`, startTimestamp: Date.now() From d690f94e2528b33b4bde6f3b339910943cd153f2 Mon Sep 17 00:00:00 2001 From: Cap <48036034+CapOliveiraBr@users.noreply.github.com> Date: Tue, 11 Feb 2020 13:13:28 -0300 Subject: [PATCH 18/32] Update dbm-rich-presence.js --- src/dbm-rich-presence.js | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/dbm-rich-presence.js b/src/dbm-rich-presence.js index adcee3c..3de8394 100644 --- a/src/dbm-rich-presence.js +++ b/src/dbm-rich-presence.js @@ -16,13 +16,13 @@ let modal; let menu; let rpc; -let options; +let rpcOptions; const settings = require(resolve('rpcSettings.json')); let enableRPC; let enableCmdNames; -let currentProject; +let currentProject = require(resolve('settings.json'))['current-project']; function setMenu() { menu = Window.get().menu; @@ -87,7 +87,7 @@ function setRichPresence() { currentProject = require(resolve('settings.json'))['current-project']; const stateVal = `Project: ${currentProject.replace(/\\/g, '/').split('/').slice(-1).toString()}`; - options = { + rpcOptions = { details: 'Editing Commands', state: stateVal, largeImageKey: 'dbm', @@ -97,8 +97,8 @@ function setRichPresence() { rpc.on('ready', () => { try { - rpc.setActivity(options); - setTimeout(() => rpc.setActivity(options), 1000); + rpc.setActivity(rpcOptions); + setTimeout(() => rpc.setActivity(rpcOptions), 1000); } catch(err) { alert(err); } @@ -130,11 +130,11 @@ function overrideFunctions() { let section = 'Commands'; const shiftTabs = DBM.shiftTabs; - DBM.shiftTabs = (event, sect, index) => { + DBM.shiftTabs = (event, sect, index) => { try { section = sect; - options.details = cache[sect]; - rpc.setActivity(options); + rpcOptions.details = cache[sect]; + rpc.setActivity(rpcOptions); } catch(err) { alert(err); } @@ -147,8 +147,8 @@ function overrideFunctions() { try { const details = enableCmdNames ? `${section.slice(0, -1)}: ${getName(section, index)}` : `Editing ${section}`; cache['Commands'] = details; - options.details = details; - rpc.setActivity(options); + rpcOptions.details = details; + rpc.setActivity(rpcOptions); } catch(err) { alert(err); } @@ -161,14 +161,14 @@ function overrideFunctions() { try { const details = enableCmdNames ? `${section.slice(0, -1)}: ${getName(section, index)}` : `Editing ${section}`; cache['Events'] = details; - options.details = details; - rpc.setActivity(options); + rpcOptions.details = details; + rpc.setActivity(rpcOptions); } catch(err) { alert(err); } eonCommandClick.apply(this, arguments); - } + } } setMenu(); From b72f743cda00a1226452dbd89dfb35cbd383e37f Mon Sep 17 00:00:00 2001 From: Cap <48036034+CapOliveiraBr@users.noreply.github.com> Date: Tue, 11 Feb 2020 13:21:22 -0300 Subject: [PATCH 19/32] Update dbm-rich-presence.js --- src/dbm-rich-presence.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/dbm-rich-presence.js b/src/dbm-rich-presence.js index 3de8394..b882120 100644 --- a/src/dbm-rich-presence.js +++ b/src/dbm-rich-presence.js @@ -18,7 +18,7 @@ let menu; let rpc; let rpcOptions; -const settings = require(resolve('rpcSettings.json')); +const rpcSettings = require(resolve('rpcSettings.json')); let enableRPC; let enableCmdNames; @@ -63,8 +63,8 @@ function setModal() { document.body.appendChild(modal); - document.getElementById('enableRPC').value = settings.enableRPC; - document.getElementById('enableCmdNames').value = settings.enableCmdNames; + document.getElementById('enableRPC').value = rpcSettings.enableRPC; + document.getElementById('enableCmdNames').value = rpcSettings.enableCmdNames; setInterval(() => { enableRPC = document.getElementById('enableRPC').value === 'true' ? true : false; @@ -104,7 +104,7 @@ function setRichPresence() { } }); - rpc.login({ clientId: '675588061140353025' }).catch(() => alert('Some error ocurred on setting the Rich Presence!')); + rpc.login({ clientId: '675588061140353025' }).catch(err => alert('Some error ocurred on setting the Rich Presence!\n\nError: ' + err)); } function stopRichPresence() { From 7e97c3400faa68727908b4a8bc6dab051f54e500 Mon Sep 17 00:00:00 2001 From: Cap <48036034+CapOliveiraBr@users.noreply.github.com> Date: Tue, 11 Feb 2020 13:24:49 -0300 Subject: [PATCH 20/32] Update dbm-rich-presence.js --- src/dbm-rich-presence.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dbm-rich-presence.js b/src/dbm-rich-presence.js index b882120..d8d8eb7 100644 --- a/src/dbm-rich-presence.js +++ b/src/dbm-rich-presence.js @@ -104,7 +104,7 @@ function setRichPresence() { } }); - rpc.login({ clientId: '675588061140353025' }).catch(err => alert('Some error ocurred on setting the Rich Presence!\n\nError: ' + err)); + rpc.login({ clientId: '675588061140353025' }).catch(err => alert(err)); } function stopRichPresence() { From 46f1e8ed173b3234142a6462b1433b0acc32709f Mon Sep 17 00:00:00 2001 From: Cap <48036034+CapOliveiraBr@users.noreply.github.com> Date: Tue, 11 Feb 2020 13:32:24 -0300 Subject: [PATCH 21/32] Update dbm-rich-presence.js --- src/dbm-rich-presence.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/dbm-rich-presence.js b/src/dbm-rich-presence.js index d8d8eb7..1c4a384 100644 --- a/src/dbm-rich-presence.js +++ b/src/dbm-rich-presence.js @@ -122,8 +122,8 @@ function getName(type, index) { function overrideFunctions() { const cache = { - Commands: enableCmdNames ? `Command: ${getName('Commands', 1)} ` : 'Editing Commands', - Events: enableCmdNames ? `Event ${getName('Events', 1)} ` : 'Editing Events', + Commands: enableCmdNames ? `Command: ${getName('Commands', 1)}` : 'Editing Commands', + Events: enableCmdNames ? `Event ${getName('Events', 1)}` : 'Editing Events', Settings: 'Editing Bot Settings' }; From e5a0938debf695894936ddc5b84d59ad9c3f2d5b Mon Sep 17 00:00:00 2001 From: General Wrex Date: Tue, 11 Feb 2020 11:05:01 -0800 Subject: [PATCH 22/32] Updated to version 1.1.0. Fixed .name error message when new command/event was pressed. Code Refactoring #5. --- src/dbm-rich-presence.js | 108 +++++++++++++++++++-------------------- 1 file changed, 54 insertions(+), 54 deletions(-) diff --git a/src/dbm-rich-presence.js b/src/dbm-rich-presence.js index a6e590a..56c1791 100644 --- a/src/dbm-rich-presence.js +++ b/src/dbm-rich-presence.js @@ -1,37 +1,37 @@ - const rpcVersion = '1.0.9'; + const rpcVersion = '1.1.0'; /*======================================================* * * - * # DBM Rich Presence - v1.0.9 * - * Created by Cap & General Wrex * + * # DBM Rich Presence - v1.1.0 * + * Created by Cap & General Wrex * * https://github.com/CapOliveiraBr/DBM-Rich-Presence * * * *======================================================*/ +const { Window, Menu, MenuItem } = nw; const { writeFileSync } = require('fs'); const { resolve, join } = require('path'); let modal; -let Menu; -let rpc; +let menu; -let currentProject; -let options; +let rpc; +let rpcOptions; -const settings = require(resolve('rpcSettings.json')); +const rpcSettings = require(resolve('rpcSettings.json')); let enableRPC; let enableCmdNames; function setMenu() { - Menu = nw.Window.get().menu; + menu = Window.get().menu; - const dbmRichPresenceMenu = new nw.Menu(); - dbmRichPresenceMenu.append(new nw.MenuItem({ + const dbmRichPresenceMenu = new Menu(); + dbmRichPresenceMenu.append(new MenuItem({ label: 'DBM Rich Presence', - click: () => jQuery('#discordRichPresence').modal('show') + click: () => jQuery('#dbmRichPresence').modal('show') })) - Menu.append(new nw.MenuItem({ + menu.append(new MenuItem({ label: 'Integrations', submenu: dbmRichPresenceMenu })); @@ -39,7 +39,7 @@ function setMenu() { function setModal() { modal = document.createElement('div'); - modal.id = 'discordRichPresence'; + modal.id = 'dbmRichPresence'; modal.classList.add('ui'); modal.classList.add('modal'); modal.setAttribute('style', 'padding: 20px; height: 320px; border-radius: 10px; background-color: #36393e; border: 2px solid #000;'); @@ -60,8 +60,9 @@ function setModal() { `; document.body.appendChild(modal); - document.getElementById('enableRPC').value = settings.enableRPC; - document.getElementById('enableCmdNames').value = settings.enableCmdNames; + + document.getElementById('enableRPC').value = rpcSettings.enableRPC; + document.getElementById('enableCmdNames').value = rpcSettings.enableCmdNames; setInterval(() => { enableRPC = document.getElementById('enableRPC').value === 'true' ? true : false; @@ -80,28 +81,25 @@ function setRichPresence() { const { Client } = require('discord-rpc'); rpc = new Client({ transport: 'ipc' }); - - currentProject = require(resolve('settings.json'))['current-project']; - const stateVal = `Project: ${currentProject.replace(/\\/g, '/').split('/').slice(-1).toString()}`; + const stateVal = `Project: ${require(resolve('settings.json'))['current-project'].replace(/\\/g, '/').split('/').slice(-1).toString()}`; - options = { - state: stateVal, + rpcOptions = { details: 'Editing Commands', + state: stateVal, largeImageKey: 'dbm', largeImageText: `DBM Rich Presence v${rpcVersion}`, startTimestamp: Date.now() }; - function setActivity() { - rpc.setActivity(options); - } - rpc.on('ready', () => { - setActivity(); - setTimeout(() => setActivity(), 1000); + try { + rpc.setActivity(rpcOptions); + } catch(err) { + alert(err); + } }); - rpc.login({ clientId: '675588061140353025' }).catch(() => alert('Some error ocurred on setting the Rich Presence!')); + rpc.login({ clientId: '675588061140353025' }).catch(() => alert(err)); } function stopRichPresence() { @@ -113,56 +111,58 @@ function stopRichPresence() { }); } -function getName(type, index) { - return require(join(currentProject, 'data', `${type.toLowerCase()}.json`))[index].name -} +function getName(type, index) { + switch (type) { + case 'Commands': + return DBM.$cmds[index] && DBM.$cmds[index].name ? DBM.$cmds[index].name : false; + case 'Events': + return DBM.$evts[index] && DBM.$evts[index].name ? DBM.$evts[index].name : false; + } +} function overrideFunctions() { - const cache = { - Commands: enableCmdNames ? `Command: ${getName('Commands', 1)} ` : 'Editing Commands' , - Events: enableCmdNames ? `Event ${getName('Events', 1)} ` : 'Editing Events' , + Commands: enableCmdNames ? `Command: ${getName('Commands', 1)}` : `Editing Commands`, + Events: enableCmdNames ? `Event ${getName('Events', 1)}` : `Editing Events`, Settings: 'Editing Bot Settings' - }; + }; - // when the tab is changed let section = 'Commands'; + const shiftTabs = DBM.shiftTabs; - DBM.shiftTabs = (event, sect, index) => { + DBM.shiftTabs = function(event, sect, index) { try { section = sect; - options.details = cache[sect]; - rpc.setActivity(options); - }catch(err) { + rpcOptions.details = cache[sect]; + rpc.setActivity(rpcOptions); + } catch(err) { alert(err); } shiftTabs.apply(this, arguments); } - // when a command name is clicked const onCommandClick = DBM.onCommandClick; - DBM.onCommandClick = (index) => { + DBM.onCommandClick = function(index) { try { - const details = enableCmdNames ? `${section.slice(0, -1)}: ${getName(section, index)}` : `Editing ${section}` - cache['Commands'] = details; - options.details = details; - rpc.setActivity(options); - } catch(alert) { + const details = enableCmdNames ? `${section.slice(0, -1)}: ${getName(section, index) || `New ${section.slice(0, -1)}`}` : `Editing ${section}`; + cache['Commands'] = details; + rpcOptions.details = details; + rpc.setActivity(rpcOptions); + } catch(err) { alert(err); } - + onCommandClick.apply(this, arguments); } - // when an event name is clicked const eonCommandClick = DBM.eonCommandClick; - DBM.eonCommandClick = (index) => { + DBM.eonCommandClick = function(index) { try { - const details = enableCmdNames ? `${section.slice(0, -1)}: ${getName(section, index)}` : `Editing ${section}` + const details = enableCmdNames ? `${section.slice(0, -1)}: ${getName(section, index) || `New ${section.slice(0, -1)}`}` : `Editing ${section}`; cache['Events'] = details; - options.details = details; - rpc.setActivity(options); + rpcOptions.details = details; + rpc.setActivity(rpcOptions); } catch(err) { alert(err); } @@ -173,6 +173,6 @@ function overrideFunctions() { setMenu(); setModal(); -setRichPresence(); +setRichPresence(); setTimeout(() => overrideFunctions(), 1000); From 1390a807316966874cdcdc260debbf74116cf698 Mon Sep 17 00:00:00 2001 From: General Wrex Date: Tue, 11 Feb 2020 11:14:36 -0800 Subject: [PATCH 23/32] Adding back the file git deleted, gg git. --- src/dbm-rich-presence.js | 178 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 178 insertions(+) create mode 100644 src/dbm-rich-presence.js diff --git a/src/dbm-rich-presence.js b/src/dbm-rich-presence.js new file mode 100644 index 0000000..56c1791 --- /dev/null +++ b/src/dbm-rich-presence.js @@ -0,0 +1,178 @@ + const rpcVersion = '1.1.0'; + + /*======================================================* + * * + * # DBM Rich Presence - v1.1.0 * + * Created by Cap & General Wrex * + * https://github.com/CapOliveiraBr/DBM-Rich-Presence * + * * + *======================================================*/ + +const { Window, Menu, MenuItem } = nw; +const { writeFileSync } = require('fs'); +const { resolve, join } = require('path'); + +let modal; +let menu; + +let rpc; +let rpcOptions; + +const rpcSettings = require(resolve('rpcSettings.json')); +let enableRPC; +let enableCmdNames; + +function setMenu() { + menu = Window.get().menu; + + const dbmRichPresenceMenu = new Menu(); + dbmRichPresenceMenu.append(new MenuItem({ + label: 'DBM Rich Presence', + click: () => jQuery('#dbmRichPresence').modal('show') + })) + + menu.append(new MenuItem({ + label: 'Integrations', + submenu: dbmRichPresenceMenu + })); +} + +function setModal() { + modal = document.createElement('div'); + modal.id = 'dbmRichPresence'; + modal.classList.add('ui'); + modal.classList.add('modal'); + modal.setAttribute('style', 'padding: 20px; height: 320px; border-radius: 10px; background-color: #36393e; border: 2px solid #000;'); + modal.innerHTML = ` +

DBM Rich Presence - v${rpcVersion}

+ Created by Cap & General Wrex - Repository +

Settings

+ Enable RPC:

+

+ Show Command/Event Names:

+ + `; + + document.body.appendChild(modal); + + document.getElementById('enableRPC').value = rpcSettings.enableRPC; + document.getElementById('enableCmdNames').value = rpcSettings.enableCmdNames; + + setInterval(() => { + enableRPC = document.getElementById('enableRPC').value === 'true' ? true : false; + enableCmdNames = document.getElementById('enableCmdNames').value === 'true' ? true : false; + + writeFileSync(resolve('rpcSettings.json'), JSON.stringify({ enableRPC, enableCmdNames })); + + if (enableRPC) { + if (!rpc) setRichPresence(); + } else stopRichPresence(); + }, 1000); +} + +function setRichPresence() { + if (!enableRPC) return; + + const { Client } = require('discord-rpc'); + rpc = new Client({ transport: 'ipc' }); + const stateVal = `Project: ${require(resolve('settings.json'))['current-project'].replace(/\\/g, '/').split('/').slice(-1).toString()}`; + + rpcOptions = { + details: 'Editing Commands', + state: stateVal, + largeImageKey: 'dbm', + largeImageText: `DBM Rich Presence v${rpcVersion}`, + startTimestamp: Date.now() + }; + + rpc.on('ready', () => { + try { + rpc.setActivity(rpcOptions); + } catch(err) { + alert(err); + } + }); + + rpc.login({ clientId: '675588061140353025' }).catch(() => alert(err)); +} + +function stopRichPresence() { + if (!rpc) return; + + rpc.clearActivity().then(() => { + rpc.destroy(); + rpc = null; + }); +} + +function getName(type, index) { + switch (type) { + case 'Commands': + return DBM.$cmds[index] && DBM.$cmds[index].name ? DBM.$cmds[index].name : false; + case 'Events': + return DBM.$evts[index] && DBM.$evts[index].name ? DBM.$evts[index].name : false; + } +} + +function overrideFunctions() { + const cache = { + Commands: enableCmdNames ? `Command: ${getName('Commands', 1)}` : `Editing Commands`, + Events: enableCmdNames ? `Event ${getName('Events', 1)}` : `Editing Events`, + Settings: 'Editing Bot Settings' + }; + + let section = 'Commands'; + + const shiftTabs = DBM.shiftTabs; + DBM.shiftTabs = function(event, sect, index) { + try { + section = sect; + rpcOptions.details = cache[sect]; + rpc.setActivity(rpcOptions); + } catch(err) { + alert(err); + } + + shiftTabs.apply(this, arguments); + } + + const onCommandClick = DBM.onCommandClick; + DBM.onCommandClick = function(index) { + try { + const details = enableCmdNames ? `${section.slice(0, -1)}: ${getName(section, index) || `New ${section.slice(0, -1)}`}` : `Editing ${section}`; + cache['Commands'] = details; + rpcOptions.details = details; + rpc.setActivity(rpcOptions); + } catch(err) { + alert(err); + } + + onCommandClick.apply(this, arguments); + } + + const eonCommandClick = DBM.eonCommandClick; + DBM.eonCommandClick = function(index) { + try { + const details = enableCmdNames ? `${section.slice(0, -1)}: ${getName(section, index) || `New ${section.slice(0, -1)}`}` : `Editing ${section}`; + cache['Events'] = details; + rpcOptions.details = details; + rpc.setActivity(rpcOptions); + } catch(err) { + alert(err); + } + + eonCommandClick.apply(this, arguments); + } +} + +setMenu(); +setModal(); + +setRichPresence(); +setTimeout(() => overrideFunctions(), 1000); From 6096faea7c6c16f7edd34cbb7e8f7f82a102dcab Mon Sep 17 00:00:00 2001 From: General Wrex Date: Tue, 11 Feb 2020 11:17:32 -0800 Subject: [PATCH 24/32] Added a space where a space should have been spaced but I spaced out on the space that had the space --- src/dbm-rich-presence.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dbm-rich-presence.js b/src/dbm-rich-presence.js index 56c1791..108596b 100644 --- a/src/dbm-rich-presence.js +++ b/src/dbm-rich-presence.js @@ -3,7 +3,7 @@ /*======================================================* * * * # DBM Rich Presence - v1.1.0 * - * Created by Cap & General Wrex * + * Created by Cap & General Wrex * * https://github.com/CapOliveiraBr/DBM-Rich-Presence * * * *======================================================*/ From 70ebf418a310041d93825db0d4971e5b5ba7b40c Mon Sep 17 00:00:00 2001 From: General Wrex Date: Tue, 11 Feb 2020 14:22:59 -0800 Subject: [PATCH 25/32] Refactoring and Improvements --- src/dbm-rich-presence.js | 311 +++++++++++++++++++++++---------------- 1 file changed, 184 insertions(+), 127 deletions(-) diff --git a/src/dbm-rich-presence.js b/src/dbm-rich-presence.js index 108596b..6b0a96d 100644 --- a/src/dbm-rich-presence.js +++ b/src/dbm-rich-presence.js @@ -1,173 +1,231 @@ - const rpcVersion = '1.1.0'; +const rpcVersion = '1.1.0'; - /*======================================================* - * * - * # DBM Rich Presence - v1.1.0 * - * Created by Cap & General Wrex * - * https://github.com/CapOliveiraBr/DBM-Rich-Presence * - * * - *======================================================*/ +/*======================================================* + * * + * # DBM Rich Presence - v1.1.0 * + * Created by Cap & General Wrex * + * https://github.com/CapOliveiraBr/DBM-Rich-Presence * + * * + *======================================================*/ const { Window, Menu, MenuItem } = nw; const { writeFileSync } = require('fs'); -const { resolve, join } = require('path'); +const { resolve } = require('path'); let modal; let menu; let rpc; -let rpcOptions; +let rpcOptions = { + details: 'Idling', + state: 'No Project Opened', + largeImageKey: 'dbm', + largeImageText: `DBM Rich Presence v${rpcVersion}`, + startTimestamp: Date.now() +}; const rpcSettings = require(resolve('rpcSettings.json')); let enableRPC; let enableCmdNames; function setMenu() { - menu = Window.get().menu; - - const dbmRichPresenceMenu = new Menu(); - dbmRichPresenceMenu.append(new MenuItem({ - label: 'DBM Rich Presence', - click: () => jQuery('#dbmRichPresence').modal('show') - })) - - menu.append(new MenuItem({ - label: 'Integrations', - submenu: dbmRichPresenceMenu - })); + menu = Window.get().menu; + + const dbmRichPresenceMenu = new Menu(); + dbmRichPresenceMenu.append(new MenuItem({ + label: 'DBM Rich Presence', + click: () => jQuery('#dbmRichPresence').modal('show') + })) + + menu.append(new MenuItem({ + label: 'Integrations', + submenu: dbmRichPresenceMenu + })); } function setModal() { - modal = document.createElement('div'); - modal.id = 'dbmRichPresence'; - modal.classList.add('ui'); - modal.classList.add('modal'); - modal.setAttribute('style', 'padding: 20px; height: 320px; border-radius: 10px; background-color: #36393e; border: 2px solid #000;'); - modal.innerHTML = ` -

DBM Rich Presence - v${rpcVersion}

- Created by Cap & General Wrex - Repository -

Settings

- Enable RPC:

-

- Show Command/Event Names:

- - `; - - document.body.appendChild(modal); - - document.getElementById('enableRPC').value = rpcSettings.enableRPC; - document.getElementById('enableCmdNames').value = rpcSettings.enableCmdNames; - - setInterval(() => { - enableRPC = document.getElementById('enableRPC').value === 'true' ? true : false; - enableCmdNames = document.getElementById('enableCmdNames').value === 'true' ? true : false; - - writeFileSync(resolve('rpcSettings.json'), JSON.stringify({ enableRPC, enableCmdNames })); - - if (enableRPC) { - if (!rpc) setRichPresence(); - } else stopRichPresence(); - }, 1000); + modal = document.createElement('div'); + modal.id = 'dbmRichPresence'; + modal.classList.add('ui'); + modal.classList.add('modal'); + modal.setAttribute('style', 'padding: 20px; height: 320px; border-radius: 10px; background-color: #36393e; border: 2px solid #000;'); + modal.innerHTML = ` +

DBM Rich Presence - v${rpcVersion}

+ Created by Cap & General Wrex - Repository +

Settings

+ Enable RPC:

+

+ Show Command/Event Names:

+ + `; + + document.body.appendChild(modal); + + document.getElementById('enableRPC').value = rpcSettings.enableRPC; + document.getElementById('enableCmdNames').value = rpcSettings.enableCmdNames; + + setInterval(() => { + enableRPC = document.getElementById('enableRPC').value === 'true' ? true : false; + enableCmdNames = document.getElementById('enableCmdNames').value === 'true' ? true : false; + + writeFileSync(resolve('rpcSettings.json'), JSON.stringify({ enableRPC, enableCmdNames })); + + if (enableRPC) { + if (!rpc) setRichPresence(); + } else stopRichPresence(); + }, 1000); } function setRichPresence() { - if (!enableRPC) return; - - const { Client } = require('discord-rpc'); - rpc = new Client({ transport: 'ipc' }); - const stateVal = `Project: ${require(resolve('settings.json'))['current-project'].replace(/\\/g, '/').split('/').slice(-1).toString()}`; - - rpcOptions = { - details: 'Editing Commands', - state: stateVal, - largeImageKey: 'dbm', - largeImageText: `DBM Rich Presence v${rpcVersion}`, - startTimestamp: Date.now() - }; - - rpc.on('ready', () => { - try { - rpc.setActivity(rpcOptions); - } catch(err) { - alert(err); - } - }); + if (!enableRPC) return; + + const { Client } = require('discord-rpc'); + rpc = new Client({ transport: 'ipc' }); + + rpcOptions.state = `Project: ${DBM._currentProject.replace(/\\/g, '/').split('/').slice(-1).toString()}`; - rpc.login({ clientId: '675588061140353025' }).catch(() => alert(err)); + rpc.on('ready', () => { + try { + overrideFunctions(); + rpc.setActivity(rpcOptions); + } catch(err) { + alert(err); + } + }); + + rpc.login({ clientId: '675588061140353025' }).catch(alert); } function stopRichPresence() { - if (!rpc) return; + if (!rpc) return; - rpc.clearActivity().then(() => { - rpc.destroy(); - rpc = null; - }); + rpc.clearActivity().then(() => { + rpc.destroy(); + rpc = null; + }); } function getName(type, index) { - switch (type) { - case 'Commands': - return DBM.$cmds[index] && DBM.$cmds[index].name ? DBM.$cmds[index].name : false; - case 'Events': - return DBM.$evts[index] && DBM.$evts[index].name ? DBM.$evts[index].name : false; - } + switch (type) { + case 'Commands': + return DBM.$cmds[index] && DBM.$cmds[index].name ? DBM.$cmds[index].name : false; + case 'Events': + return DBM.$evts[index] && DBM.$evts[index].name ? DBM.$evts[index].name : false; + } } function overrideFunctions() { - const cache = { - Commands: enableCmdNames ? `Command: ${getName('Commands', 1)}` : `Editing Commands`, - Events: enableCmdNames ? `Event ${getName('Events', 1)}` : `Editing Events`, - Settings: 'Editing Bot Settings' - }; - - let section = 'Commands'; - - const shiftTabs = DBM.shiftTabs; - DBM.shiftTabs = function(event, sect, index) { - try { - section = sect; - rpcOptions.details = cache[sect]; - rpc.setActivity(rpcOptions); + const cache = { + Commands: enableCmdNames ? `Command: ${getName('Commands', 1) || `None`}` : `Editing Commands`, + Events: enableCmdNames ? `Event: ${getName('Events', 1) || `None`}` : `Editing Events`, + Settings: 'Editing Bot Settings' + }; + + let section = 'Commands'; + + const shiftTabs = DBM.shiftTabs; + DBM.shiftTabs = function(event, sect, index) { + try { + section = sect; + rpcOptions.details = cache[sect]; + rpc.setActivity(rpcOptions); + } catch(err) { + alert(err); + } + + shiftTabs.apply(this, arguments); + } + + const onCommandClick = DBM.onCommandClick; + DBM.onCommandClick = function(index) { + try { + const type = section.slice(0, -1); + const details = enableCmdNames ? `${index ? `${type}: ` : ' '}${index ? (getName(section, index) || `New ${type}`) : `No Selection`}` : `Editing ${section}`; + + cache['Commands'] = details; + rpcOptions.details = details; + rpcOptions.state = `Project: ${DBM._currentProject.replace(/\\/g, '/').split('/').slice(-1).toString()}`; + rpc.setActivity(rpcOptions); + } catch(err) { + alert(err); + } + + onCommandClick.apply(this, arguments); + } + + const eonCommandClick = DBM.eonCommandClick; + DBM.eonCommandClick = function(index) { + try { + const type = section.slice(0, -1); + const details = enableCmdNames ? `${index ? `${type}: ` : ' '}${index ? (getName(section, index) || `New ${type}`) : `No Selection`}` : `Editing ${section}`; + + cache['Events'] = details; + rpcOptions.details = details; + rpcOptions.state = `Project: ${DBM._currentProject.replace(/\\/g, '/').split('/').slice(-1).toString()}`; + + rpc.setActivity(rpcOptions); + } catch(err) { + alert(err); + } + + eonCommandClick.apply(this, arguments); + } + + const createNewProject = DBM.createNewProject; + DBM.createNewProject = function() { + try { + rpcOptions.state = `Creating Project...`; + rpcOptions.startTimestamp = Date.now() + rpc.setActivity(rpcOptions); } catch(err) { alert(err); } - shiftTabs.apply(this, arguments); - } + createNewProject.apply(this, arguments); + } - const onCommandClick = DBM.onCommandClick; - DBM.onCommandClick = function(index) { - try { - const details = enableCmdNames ? `${section.slice(0, -1)}: ${getName(section, index) || `New ${section.slice(0, -1)}`}` : `Editing ${section}`; - cache['Commands'] = details; - rpcOptions.details = details; - rpc.setActivity(rpcOptions); + const openProject = DBM.openProject; + DBM.openProject = function() { + try { + rpcOptions.state = 'Opening Project...'; + rpcOptions.startTimestamp = Date.now() + rpc.setActivity(rpcOptions); } catch(err) { alert(err); } - onCommandClick.apply(this, arguments); + openProject.apply(this, arguments); } - const eonCommandClick = DBM.eonCommandClick; - DBM.eonCommandClick = function(index) { - try { - const details = enableCmdNames ? `${section.slice(0, -1)}: ${getName(section, index) || `New ${section.slice(0, -1)}`}` : `Editing ${section}`; - cache['Events'] = details; - rpcOptions.details = details; - rpc.setActivity(rpcOptions); - } catch(err) { - alert(err); + const saveAndClose = DBM.saveAndClose; + DBM.saveAndClose = function() { + try { + rpcOptions.state = `No Project Opened`; + rpc.setActivity(rpcOptions); + } catch(err) { + alert(err); + } + + saveAndClose.apply(this, arguments); + } + + const noSaveAndClose = DBM.noSaveAndClose; + DBM.noSaveAndClose = function() { + alert('before') + try { + rpcOptions.state = `No Project Opened`; + rpc.setActivity(rpcOptions); + } catch(err) { + alert(err); } - - eonCommandClick.apply(this, arguments); + alert('after') + noSaveAndClose.apply(this, arguments); } } @@ -175,4 +233,3 @@ setMenu(); setModal(); setRichPresence(); -setTimeout(() => overrideFunctions(), 1000); From 8271e4eb8ce06ab6126ec38458dbd5cafbc766d5 Mon Sep 17 00:00:00 2001 From: Cap <48036034+CapOliveiraBr@users.noreply.github.com> Date: Tue, 11 Feb 2020 21:16:37 -0300 Subject: [PATCH 26/32] Refactoring --- src/dbm-rich-presence.js | 290 +++++++++++++++++++-------------------- 1 file changed, 140 insertions(+), 150 deletions(-) diff --git a/src/dbm-rich-presence.js b/src/dbm-rich-presence.js index 6b0a96d..a82db3b 100644 --- a/src/dbm-rich-presence.js +++ b/src/dbm-rich-presence.js @@ -17,39 +17,39 @@ let menu; let rpc; let rpcOptions = { - details: 'Idling', + details: 'Not Working', state: 'No Project Opened', largeImageKey: 'dbm', largeImageText: `DBM Rich Presence v${rpcVersion}`, startTimestamp: Date.now() -}; +}; const rpcSettings = require(resolve('rpcSettings.json')); let enableRPC; let enableCmdNames; function setMenu() { - menu = Window.get().menu; - - const dbmRichPresenceMenu = new Menu(); - dbmRichPresenceMenu.append(new MenuItem({ - label: 'DBM Rich Presence', - click: () => jQuery('#dbmRichPresence').modal('show') - })) - - menu.append(new MenuItem({ - label: 'Integrations', - submenu: dbmRichPresenceMenu - })); + menu = Window.get().menu; + + const dbmRichPresenceMenu = new Menu(); + dbmRichPresenceMenu.append(new MenuItem({ + label: 'DBM Rich Presence', + click: () => jQuery('#dbmRichPresence').modal('show') + })) + + menu.append(new MenuItem({ + label: 'Integrations', + submenu: dbmRichPresenceMenu + })); } function setModal() { - modal = document.createElement('div'); - modal.id = 'dbmRichPresence'; - modal.classList.add('ui'); - modal.classList.add('modal'); - modal.setAttribute('style', 'padding: 20px; height: 320px; border-radius: 10px; background-color: #36393e; border: 2px solid #000;'); - modal.innerHTML = ` + modal = document.createElement('div'); + modal.id = 'dbmRichPresence'; + modal.classList.add('ui'); + modal.classList.add('modal'); + modal.setAttribute('style', 'padding: 20px; height: 320px; border-radius: 10px; background-color: #36393e; border: 2px solid #000;'); + modal.innerHTML = `

DBM Rich Presence - v${rpcVersion}

Created by Cap & General Wrex - Repository

Settings

@@ -65,167 +65,157 @@ function setModal() { `; - document.body.appendChild(modal); + document.body.appendChild(modal); - document.getElementById('enableRPC').value = rpcSettings.enableRPC; - document.getElementById('enableCmdNames').value = rpcSettings.enableCmdNames; + document.getElementById('enableRPC').value = rpcSettings.enableRPC; + document.getElementById('enableCmdNames').value = rpcSettings.enableCmdNames; - setInterval(() => { - enableRPC = document.getElementById('enableRPC').value === 'true' ? true : false; - enableCmdNames = document.getElementById('enableCmdNames').value === 'true' ? true : false; + setInterval(() => { + enableRPC = document.getElementById('enableRPC').value === 'true' ? true : false; + enableCmdNames = document.getElementById('enableCmdNames').value === 'true' ? true : false; - writeFileSync(resolve('rpcSettings.json'), JSON.stringify({ enableRPC, enableCmdNames })); - - if (enableRPC) { - if (!rpc) setRichPresence(); - } else stopRichPresence(); - }, 1000); + writeFileSync(resolve('rpcSettings.json'), JSON.stringify({ + enableRPC, + enableCmdNames + })); + + if (enableRPC) { + if (!rpc) setRichPresence(); + } else stopRichPresence(); + }, 1000); } function setRichPresence() { - if (!enableRPC) return; + if (!enableRPC) return; - const { Client } = require('discord-rpc'); - rpc = new Client({ transport: 'ipc' }); + const { Client } = require('discord-rpc'); + rpc = new Client({ transport: 'ipc' }); - rpcOptions.state = `Project: ${DBM._currentProject.replace(/\\/g, '/').split('/').slice(-1).toString()}`; + rpcOptions.state = `Project: ${DBM._currentProject.replace(/\\/g, '/').split('/').slice(-1).toString()}`; - rpc.on('ready', () => { - try { - overrideFunctions(); - rpc.setActivity(rpcOptions); - } catch(err) { - alert(err); - } - }); + rpc.on('ready', () => { + try { + overrideFunctions(); + rpc.setActivity(rpcOptions); + } catch (err) { + alert(err); + } + }); - rpc.login({ clientId: '675588061140353025' }).catch(alert); + rpc.login({ clientId: '675588061140353025' }).catch(alert); } function stopRichPresence() { - if (!rpc) return; + if (!rpc) return; - rpc.clearActivity().then(() => { - rpc.destroy(); - rpc = null; - }); + rpc.clearActivity().then(() => { + rpc.destroy(); + rpc = null; + }); } function getName(type, index) { - switch (type) { - case 'Commands': - return DBM.$cmds[index] && DBM.$cmds[index].name ? DBM.$cmds[index].name : false; - case 'Events': - return DBM.$evts[index] && DBM.$evts[index].name ? DBM.$evts[index].name : false; - } -} + switch (type) { + case 'Commands': + return DBM.$cmds[index] && DBM.$cmds[index].name ? DBM.$cmds[index].name : false; + case 'Events': + return DBM.$evts[index] && DBM.$evts[index].name ? DBM.$evts[index].name : false; + } +} function overrideFunctions() { - const cache = { - Commands: enableCmdNames ? `Command: ${getName('Commands', 1) || `None`}` : `Editing Commands`, - Events: enableCmdNames ? `Event: ${getName('Events', 1) || `None`}` : `Editing Events`, - Settings: 'Editing Bot Settings' - }; - - let section = 'Commands'; - - const shiftTabs = DBM.shiftTabs; - DBM.shiftTabs = function(event, sect, index) { - try { - section = sect; - rpcOptions.details = cache[sect]; - rpc.setActivity(rpcOptions); - } catch(err) { - alert(err); - } - - shiftTabs.apply(this, arguments); - } - - const onCommandClick = DBM.onCommandClick; - DBM.onCommandClick = function(index) { - try { - const type = section.slice(0, -1); - const details = enableCmdNames ? `${index ? `${type}: ` : ' '}${index ? (getName(section, index) || `New ${type}`) : `No Selection`}` : `Editing ${section}`; - - cache['Commands'] = details; - rpcOptions.details = details; - rpcOptions.state = `Project: ${DBM._currentProject.replace(/\\/g, '/').split('/').slice(-1).toString()}`; - rpc.setActivity(rpcOptions); - } catch(err) { - alert(err); - } - - onCommandClick.apply(this, arguments); - } - - const eonCommandClick = DBM.eonCommandClick; - DBM.eonCommandClick = function(index) { - try { - const type = section.slice(0, -1); - const details = enableCmdNames ? `${index ? `${type}: ` : ' '}${index ? (getName(section, index) || `New ${type}`) : `No Selection`}` : `Editing ${section}`; - - cache['Events'] = details; - rpcOptions.details = details; - rpcOptions.state = `Project: ${DBM._currentProject.replace(/\\/g, '/').split('/').slice(-1).toString()}`; - - rpc.setActivity(rpcOptions); - } catch(err) { - alert(err); - } - - eonCommandClick.apply(this, arguments); - } - - const createNewProject = DBM.createNewProject; - DBM.createNewProject = function() { - try { - rpcOptions.state = `Creating Project...`; - rpcOptions.startTimestamp = Date.now() - rpc.setActivity(rpcOptions); - } catch(err) { + const cache = { + Commands: enableCmdNames ? `Command: ${getName('Commands', 1) || `None`}` : `Editing Commands`, + Events: enableCmdNames ? `Event: ${getName('Events', 1) || `None`}` : `Editing Events`, + Settings: 'Editing Bot Settings' + }; + + let section = 'Commands'; + + const shiftTabs = DBM.shiftTabs; + DBM.shiftTabs = function(event, sect, index) { + try { + section = sect; + rpcOptions.details = cache[sect]; + rpc.setActivity(rpcOptions); + } catch (err) { + alert(err); + } + + shiftTabs.apply(this, arguments); + } + + const onCommandClick = DBM.onCommandClick; + DBM.onCommandClick = function(index) { + try { + const type = section.slice(0, -1); + const details = enableCmdNames ? `${index ? `${type}: ` : ' '}${index ? (getName(section, index) || `New ${type}`) : 'Not Working'}` : `Editing ${section}`; + + cache['Commands'] = details; + rpcOptions.details = details; + rpcOptions.state = `Project: ${DBM._currentProject.replace(/\\/g, '/').split('/').slice(-1).toString()}`; + rpc.setActivity(rpcOptions); + } catch (err) { + alert(err); + } + + onCommandClick.apply(this, arguments); + } + + const eonCommandClick = DBM.eonCommandClick; + DBM.eonCommandClick = function(index) { + try { + const type = section.slice(0, -1); + const details = enableCmdNames ? `${index ? `${type}: ` : ' '}${index ? (getName(section, index) || `New ${type}`) : 'Not Working'}` : `Editing ${section}`; + + cache['Events'] = details; + rpcOptions.details = details; + rpcOptions.state = `Project: ${DBM._currentProject.replace(/\\/g, '/').split('/').slice(-1).toString()}`; + + rpc.setActivity(rpcOptions); + } catch (err) { + alert(err); + } + + eonCommandClick.apply(this, arguments); + } + + const createNewProject = DBM.createNewProject; + DBM.createNewProject = function() { + try { + rpcOptions.state = `Creating Project...`; + rpcOptions.startTimestamp = Date.now() + rpc.setActivity(rpcOptions); + } catch (err) { alert(err); } createNewProject.apply(this, arguments); } - const openProject = DBM.openProject; - DBM.openProject = function() { - try { - rpcOptions.state = 'Opening Project...'; - rpcOptions.startTimestamp = Date.now() - rpc.setActivity(rpcOptions); - } catch(err) { + const openProject = DBM.openProject; + DBM.openProject = function() { + try { + rpcOptions.state = 'Opening Project...'; + rpcOptions.startTimestamp = Date.now() + rpc.setActivity(rpcOptions); + } catch (err) { alert(err); } - + openProject.apply(this, arguments); } - const saveAndClose = DBM.saveAndClose; - DBM.saveAndClose = function() { - try { - rpcOptions.state = `No Project Opened`; - rpc.setActivity(rpcOptions); - } catch(err) { - alert(err); - } - - saveAndClose.apply(this, arguments); - } - - const noSaveAndClose = DBM.noSaveAndClose; - DBM.noSaveAndClose = function() { - alert('before') - try { - rpcOptions.state = `No Project Opened`; - rpc.setActivity(rpcOptions); - } catch(err) { - alert(err); + const saveAndClose = DBM.saveAndClose; + DBM.saveAndClose = function() { + try { + rpcOptions.state = `No Project Opened`; + rpc.setActivity(rpcOptions); + } catch (err) { + alert(err); } - alert('after') - noSaveAndClose.apply(this, arguments); + + saveAndClose.apply(this, arguments); } } From 3f7ed076a88e07dc6d3ef3c9d7fdb95a073929b4 Mon Sep 17 00:00:00 2001 From: Cap <48036034+CapOliveiraBr@users.noreply.github.com> Date: Tue, 11 Feb 2020 21:20:00 -0300 Subject: [PATCH 27/32] Changes --- src/dbm-rich-presence.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/dbm-rich-presence.js b/src/dbm-rich-presence.js index a82db3b..e5782b4 100644 --- a/src/dbm-rich-presence.js +++ b/src/dbm-rich-presence.js @@ -17,7 +17,7 @@ let menu; let rpc; let rpcOptions = { - details: 'Not Working', + details: 'Idling', state: 'No Project Opened', largeImageKey: 'dbm', largeImageText: `DBM Rich Presence v${rpcVersion}`, @@ -149,7 +149,7 @@ function overrideFunctions() { DBM.onCommandClick = function(index) { try { const type = section.slice(0, -1); - const details = enableCmdNames ? `${index ? `${type}: ` : ' '}${index ? (getName(section, index) || `New ${type}`) : 'Not Working'}` : `Editing ${section}`; + const details = enableCmdNames ? `${index ? `${type}: ` : ' '}${index ? (getName(section, index) || `New ${type}`) : 'None Selection'}` : `Editing ${section}`; cache['Commands'] = details; rpcOptions.details = details; @@ -166,7 +166,7 @@ function overrideFunctions() { DBM.eonCommandClick = function(index) { try { const type = section.slice(0, -1); - const details = enableCmdNames ? `${index ? `${type}: ` : ' '}${index ? (getName(section, index) || `New ${type}`) : 'Not Working'}` : `Editing ${section}`; + const details = enableCmdNames ? `${index ? `${type}: ` : ' '}${index ? (getName(section, index) || `New ${type}`) : 'None Selection'}` : `Editing ${section}`; cache['Events'] = details; rpcOptions.details = details; From 799965099d1c3e59c764a53e09684c067577d118 Mon Sep 17 00:00:00 2001 From: General Wrex <1731139+generalwrex@users.noreply.github.com> Date: Tue, 11 Feb 2020 20:03:33 -0800 Subject: [PATCH 28/32] Update dbm-rich-presence.js --- src/dbm-rich-presence.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/dbm-rich-presence.js b/src/dbm-rich-presence.js index e5782b4..6891b01 100644 --- a/src/dbm-rich-presence.js +++ b/src/dbm-rich-presence.js @@ -149,7 +149,7 @@ function overrideFunctions() { DBM.onCommandClick = function(index) { try { const type = section.slice(0, -1); - const details = enableCmdNames ? `${index ? `${type}: ` : ' '}${index ? (getName(section, index) || `New ${type}`) : 'None Selection'}` : `Editing ${section}`; + const details = enableCmdNames ? `${index ? `${type}: ` : ' '}${index ? (getName(section, index) || `New ${type}`) : 'None Selected'}` : `Editing ${section}`; cache['Commands'] = details; rpcOptions.details = details; @@ -166,7 +166,7 @@ function overrideFunctions() { DBM.eonCommandClick = function(index) { try { const type = section.slice(0, -1); - const details = enableCmdNames ? `${index ? `${type}: ` : ' '}${index ? (getName(section, index) || `New ${type}`) : 'None Selection'}` : `Editing ${section}`; + const details = enableCmdNames ? `${index ? `${type}: ` : ' '}${index ? (getName(section, index) || `New ${type}`) : 'None Selected'}` : `Editing ${section}`; cache['Events'] = details; rpcOptions.details = details; From b32699a13177daccd4ec066192ddccac0b323817 Mon Sep 17 00:00:00 2001 From: Cap <48036034+CapOliveiraBr@users.noreply.github.com> Date: Thu, 12 Mar 2020 18:49:22 -0300 Subject: [PATCH 29/32] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index faf247b..90e41f8 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ ![](https://i.imgur.com/4IPNq8U.png) -![](https://img.shields.io/github/v/release/CapOliveiraBr/DBM-Rich-Presence?style=for-the-badge) ![](https://img.shields.io/github/downloads/CapOliveiraBr/DBM-Rich-Presence/total?style=for-the-badge) ![](https://img.shields.io/github/license/CapOliveiraBr/DBM-Rich-Presence?logo=https%3A%2F%2Fimg.shields.io%2Fgithub%2Flicense%2FCapOliveiraBr%2FDBM-Rich-Presence%3Fstyle%3Dsocial&style=for-the-badge) +![](https://img.shields.io/github/v/release/CapOliveiraBr/DBM-Rich-Presence?style=for-the-badge)) ![](https://img.shields.io/github/license/CapOliveiraBr/DBM-Rich-Presence?logo=https%3A%2F%2Fimg.shields.io%2Fgithub%2Flicense%2FCapOliveiraBr%2FDBM-Rich-Presence%3Fstyle%3Dsocial&style=for-the-badge) --- From bb62d5794639ad48f212e678e59633b418a1836d Mon Sep 17 00:00:00 2001 From: Cap <48036034+CapOliveiraBr@users.noreply.github.com> Date: Thu, 12 Mar 2020 18:49:43 -0300 Subject: [PATCH 30/32] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 90e41f8..b59a2e9 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ ![](https://i.imgur.com/4IPNq8U.png) -![](https://img.shields.io/github/v/release/CapOliveiraBr/DBM-Rich-Presence?style=for-the-badge)) ![](https://img.shields.io/github/license/CapOliveiraBr/DBM-Rich-Presence?logo=https%3A%2F%2Fimg.shields.io%2Fgithub%2Flicense%2FCapOliveiraBr%2FDBM-Rich-Presence%3Fstyle%3Dsocial&style=for-the-badge) +![](https://img.shields.io/github/v/release/CapOliveiraBr/DBM-Rich-Presence?style=for-the-badge) ![](https://img.shields.io/github/license/CapOliveiraBr/DBM-Rich-Presence?logo=https%3A%2F%2Fimg.shields.io%2Fgithub%2Flicense%2FCapOliveiraBr%2FDBM-Rich-Presence%3Fstyle%3Dsocial&style=for-the-badge) --- From 28c4057e221716779f9b7e00df17032706a9fc27 Mon Sep 17 00:00:00 2001 From: Cap <48036034+CapOliveiraBr@users.noreply.github.com> Date: Sun, 12 Apr 2020 02:50:11 -0300 Subject: [PATCH 31/32] space fix --- src/dbm-rich-presence.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dbm-rich-presence.js b/src/dbm-rich-presence.js index 6891b01..f40810e 100644 --- a/src/dbm-rich-presence.js +++ b/src/dbm-rich-presence.js @@ -60,7 +60,7 @@ function setModal() {

Show Command/Event Names:

`; From dd20b942e6872d396d5d3122eeb8f3024dc2feb9 Mon Sep 17 00:00:00 2001 From: CapOliveiraBr Date: Sun, 19 Apr 2020 16:35:58 -0300 Subject: [PATCH 32/32] update of images and modules --- README.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index b59a2e9..67e2086 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,7 @@ 📖 A Rich Presence of Discord that shows your DBM information. -> **Note:** This is just a first version, soon it will be super cool! - -![](https://i.imgur.com/4IPNq8U.png) +![](https://i.imgur.com/KSAR1JE.png) ![](https://img.shields.io/github/v/release/CapOliveiraBr/DBM-Rich-Presence?style=for-the-badge) ![](https://img.shields.io/github/license/CapOliveiraBr/DBM-Rich-Presence?logo=https%3A%2F%2Fimg.shields.io%2Fgithub%2Flicense%2FCapOliveiraBr%2FDBM-Rich-Presence%3Fstyle%3Dsocial&style=for-the-badge) @@ -46,7 +44,7 @@ Download the latest release of the RPC [here](https://github.com/CapOliveiraBr/D When you install the RPC, a new menu tab is added to DBM, called "**Integrations**", inside it you can go to **DBM Rich Presence** where you can see some settings. ![](https://i.imgur.com/Mz1xPcz.png) -![](https://i.imgur.com/OUuFjjy.png) +![](https://i.imgur.com/926LZKv.png) ---