From 6c708ea706e93f123b80eeec5606ec1c063003af Mon Sep 17 00:00:00 2001 From: Filip Dunder Date: Tue, 16 Apr 2024 00:06:02 +0200 Subject: [PATCH] fix: snipe list --- cache/snipe-list.cache.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cache/snipe-list.cache.ts b/cache/snipe-list.cache.ts index ea3a2b3..ed20430 100644 --- a/cache/snipe-list.cache.ts +++ b/cache/snipe-list.cache.ts @@ -4,9 +4,10 @@ import { logger, SNIPE_LIST_REFRESH_INTERVAL } from '../helpers'; export class SnipeListCache { private snipeList: string[] = []; + private fileLocation = path.join(__dirname, '../snipe-list.txt'); constructor() { - setInterval(this.loadSnipeList, SNIPE_LIST_REFRESH_INTERVAL); + setInterval(() => this.loadSnipeList(), SNIPE_LIST_REFRESH_INTERVAL); } public init() { @@ -18,10 +19,10 @@ export class SnipeListCache { } private loadSnipeList() { - logger.trace('Refreshing snipe list...'); + logger.trace(`Refreshing snipe list...`); const count = this.snipeList.length; - const data = fs.readFileSync(path.join(__dirname, 'snipe-list.txt'), 'utf-8'); + const data = fs.readFileSync(this.fileLocation, 'utf-8'); this.snipeList = data .split('\n') .map((a) => a.trim())