aboutsummaryrefslogtreecommitdiff
path: root/src/index.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/index.ts')
-rw-r--r--src/index.ts13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/index.ts b/src/index.ts
index 7332805..6ac23cd 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -1,5 +1,5 @@
import { createSession, fetchAccountFromDiscord, fetchAllLeaderboardsCategorized, fetchLeaderboard, fetchMemberLeaderboardSpots, fetchSession, finishedCachingRawLeaderboards, leaderboardUpdateMemberQueue, leaderboardUpdateProfileQueue, updateAccount, fetchServerStatus } from './database.js'
-import { fetchMemberProfile, fetchUser } from './hypixel.js'
+import { fetchElection, fetchMemberProfile, fetchUser } from './hypixel.js'
import rateLimit from 'express-rate-limit'
import * as constants from './constants.js'
import * as discord from './discord.js'
@@ -141,6 +141,17 @@ app.get('/constants', async (req, res) => {
}
})
+app.get('/election', async (req, res) => {
+ try {
+ res.json(
+ await fetchElection()
+ )
+ } catch (err) {
+ console.error(err)
+ res.json({ ok: false })
+ }
+})
+
app.post('/accounts/createsession', async (req, res) => {
try {
const { code } = req.body