Added bam + some other code fixes

This commit is contained in:
Lucas Gabriel 2024-06-02 14:24:03 +00:00
parent c419a4e653
commit 4b9ed6d2c0
4 changed files with 45 additions and 39 deletions

View file

@ -6,21 +6,21 @@ const blocklistPath = path.join(__dirname, '../blocklist.txt');
let blocklist = [];
const readBlocklist = () => {
try {
const data = fs.readFileSync(blocklistPath, 'utf8');
blocklist = data.split('\n').map(id => id.trim()).filter(id => id !== '');
} catch (error) {
if (error.code === 'ENOENT') {
console.log('WARN: Blocklist file not found. Creating a new one.');
fs.writeFileSync(blocklistPath, '');
} else {
console.error('WARN: Error reading blocklist:', error);
}
try {
const data = fs.readFileSync(blocklistPath, 'utf8');
blocklist = data.split('\n').map(id => id.trim()).filter(id => id !== '');
} catch (error) {
if (error.code === 'ENOENT') {
console.log('WARN: Blocklist file not found. Creating a new one.');
fs.writeFileSync(blocklistPath, '');
} else {
console.error('WARN: Error reading blocklist:', error);
}
}
};
const isBlocked = (userId) => {
return blocklist.includes(String(userId));
return blocklist.includes(String(userId));
};
readBlocklist();