fix: snipe list

This commit is contained in:
Filip Dunder
2024-04-16 00:06:02 +02:00
parent 83f4bf9a4b
commit 6c708ea706

View File

@ -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())