From ec804709073893d25655ab56f0b40a651ad1dfbe Mon Sep 17 00:00:00 2001 From: Astra Date: Sun, 22 Apr 2018 00:41:03 -0400 Subject: [PATCH] h --- shared.js | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/shared.js b/shared.js index 11a9032..a47a2a4 100644 --- a/shared.js +++ b/shared.js @@ -34,16 +34,21 @@ // fetch the changelog fetch('https://endpwn.github.io/changelog.md?_=' + Date.now()).then(r => r.text()).then(l => { - // get the changelog object - var log = $api.util.findFuncExports('changeLog'); - var data = l.split(';;'); + // we're racing discord's initialization procedures; try and hit a timing sweetspot + setTimeout(() => { - // set the date - if (log.changeLog.date <= data[0]) - log.changeLog.date = data[0]; + // get the changelog object + var log = $api.util.findFuncExports('changeLog'); + var data = l.split(';;'); - // prepend to the changelog body - log.changeLog.body = data[1] + '\n\n' + log.changeLog.body; + // set the date + if (log.changeLog.date <= data[0]) + log.changeLog.date = data[0]; + + // prepend to the changelog body + log.changeLog.body = data[1] + '\n\n' + log.changeLog.body; + + }, 100); });