diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/constants.ts | 3 | ||||
-rw-r--r-- | src/database.ts | 2 | ||||
-rw-r--r-- | src/index.ts | 4 |
3 files changed, 5 insertions, 4 deletions
diff --git a/src/constants.ts b/src/constants.ts index c78b7ea..1792b94 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -66,11 +66,12 @@ async function fetchFile(path: string): Promise<GithubFile> { }, ) const data = await r.json() - return { + const file = { path: data.path, content: Buffer.from(data.content, data.encoding).toString(), sha: data.sha } + fileCache.set(path, file) } /** diff --git a/src/database.ts b/src/database.ts index e1fec7e..d3e2291 100644 --- a/src/database.ts +++ b/src/database.ts @@ -78,7 +78,7 @@ function getMemberLeaderboardAttributes(member: CleanMember) { } -export async function fetchAllLeaderboardsCategoriezed(): Promise<{ [ category: string ]: string[] }> { +export async function fetchAllLeaderboardsCategorized(): Promise<{ [ category: string ]: string[] }> { const memberLeaderboardAttributes = await fetchAllMemberLeaderboardAttributes() const categorizedLeaderboards: { [ category: string ]: string[] } = {} for (const leaderboard of memberLeaderboardAttributes) { diff --git a/src/index.ts b/src/index.ts index f35363a..fa3b75f 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,6 +1,6 @@ import { fetchMemberProfile, fetchUser } from './hypixel' import express from 'express' -import { fetchAllLeaderboardsCategoriezed, fetchMemberLeaderboard } from './database' +import { fetchAllLeaderboardsCategorized, fetchMemberLeaderboard } from './database' const app = express() @@ -42,7 +42,7 @@ app.get('/leaderboard/:name', async(req, res) => { app.get('/leaderboards', async(req, res) => { res.json( - await fetchAllLeaderboardsCategoriezed() + await fetchAllLeaderboardsCategorized() ) }) |