aboutsummaryrefslogtreecommitdiff
path: root/build/constants.js
diff options
context:
space:
mode:
Diffstat (limited to 'build/constants.js')
-rw-r--r--build/constants.js10
1 files changed, 8 insertions, 2 deletions
diff --git a/build/constants.js b/build/constants.js
index 5e09240..961e998 100644
--- a/build/constants.js
+++ b/build/constants.js
@@ -57,6 +57,7 @@ async function fetchFile(path) {
sha: data.sha
};
fileCache.set(path, file);
+ return file;
}
/**
* Edit a file on skyblock-constants
@@ -65,13 +66,18 @@ async function fetchFile(path) {
* @param newContent The new content in the file
*/
async function editFile(file, message, newContent) {
- fileCache.set(file.path, newContent);
- await fetchGithubApi('PUT', `/repos/${owner}/${repo}/contents/${file.path}`, { 'Content-Type': 'application/json' }, {
+ const r = await fetchGithubApi('PUT', `/repos/${owner}/${repo}/contents/${file.path}`, { 'Content-Type': 'application/json' }, {
message: message,
content: Buffer.from(newContent).toString('base64'),
sha: file.sha,
branch: 'main'
});
+ const data = await r.json();
+ fileCache.set(file.path, {
+ path: data.content.path,
+ content: newContent,
+ sha: data.content.sha
+ });
}
/** Fetch all the known SkyBlock stats as an array of strings */
async function fetchStats() {