Move banchunk array away from global scope

This commit is contained in:
Leppunen 2021-03-30 13:25:24 +03:00
parent 039cab7b00
commit 3fe35a435a

View file

@ -5,7 +5,6 @@ const WS = require('ws');
const Config = require('./config.json'); const Config = require('./config.json');
const clients = []; const clients = [];
const banChunks = [];
const pingInterval = 120e3; const pingInterval = 120e3;
let lastIndex = 0; let lastIndex = 0;
const uuidRegex = /[0-9A-F]{8}-[0-9A-F]{4}-[4][0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}/i; const uuidRegex = /[0-9A-F]{8}-[0-9A-F]{4}-[4][0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}/i;
@ -63,6 +62,7 @@ const runList = async (listData, listID, channel) => {
const banArr = listData.split('\n'); const banArr = listData.split('\n');
if (banArr.length > Config.MaxChunkSize) { if (banArr.length > Config.MaxChunkSize) {
const banChunks = [];
while (banArr.length > 0) { while (banArr.length > 0) {
banChunks.push(banArr.splice(0, Config.MaxChunkSize)); banChunks.push(banArr.splice(0, Config.MaxChunkSize));
} }