From b7d3158acdc32aab38209a1aae6f1389937faef6 Mon Sep 17 00:00:00 2001 From: mat <27899617+mat-1@users.noreply.github.com> Date: Sun, 28 Feb 2021 01:51:03 -0600 Subject: update package-lock.json and remove weird code --- src/database.ts | 26 ++++++++++++++------------ src/hypixelCached.ts | 2 +- 2 files changed, 15 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/database.ts b/src/database.ts index a1178bc..a7f8f0d 100644 --- a/src/database.ts +++ b/src/database.ts @@ -4,7 +4,7 @@ import * as constants from './constants' import * as cached from './hypixelCached' -import { Collection, Db, FilterQuery, MongoClient } from 'mongodb' +import { Collection, Db, MongoClient } from 'mongodb' import NodeCache from 'node-cache' import { CleanMember } from './cleaners/skyblock/member' @@ -26,7 +26,7 @@ const cachedLeaderboards: Map = new Map() let client: MongoClient let database: Db -let memberLeaderboardsCollection: Collection +let memberLeaderboardsCollection: Collection async function connect() { if (!process.env.db_uri) @@ -84,7 +84,7 @@ export async function fetchMemberLeaderboard(name: string) { if (cachedLeaderboards.has(name)) return cachedLeaderboards.get(name) // typescript forces us to make a new variable and set it this way because it gives an error otherwise - const query: FilterQuery = {} + const query = {} query[`stats.${name}`] = { '$exists': true } const sortQuery: any = {} @@ -130,16 +130,18 @@ export async function updateDatabaseMember(member: CleanMember) { const leaderboardAttributes = getMemberLeaderboardAttributes(member) - await memberLeaderboardsCollection.updateOne({ - uuid: member.uuid - }, { - '$set': { - 'stats': leaderboardAttributes, - 'last_updated': new Date() + await memberLeaderboardsCollection.updateOne( + { + uuid: member.uuid + }, { + '$set': { + 'stats': leaderboardAttributes, + 'last_updated': new Date() + } + }, { + upsert: true } - }, { - upsert: true - }) + ) } diff --git a/src/hypixelCached.ts b/src/hypixelCached.ts index 8852a74..8e630df 100644 --- a/src/hypixelCached.ts +++ b/src/hypixelCached.ts @@ -2,7 +2,7 @@ * Fetch the clean and cached Hypixel API */ -import NodeCache, { EventEmitter, Key } from 'node-cache' +import NodeCache from 'node-cache' import * as mojang from './mojang' import * as hypixel from './hypixel' import { CleanPlayer } from './cleaners/player' -- cgit