rf: js -> ts

This commit is contained in:
Aidan 2025-04-24 18:50:00 -04:00
parent 2f532fdd0d
commit 3ecd084d44
2 changed files with 7 additions and 7 deletions

View file

@ -1,28 +0,0 @@
const fs = require('fs');
const path = require('path');
const blocklistPath = path.join(__dirname, 'sw_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: SpamWatch blocklist file not found. Creating a new, blank one.\nUse your own SpamWatch API key and our generator to push the blocklist to the file.');
fs.writeFileSync(blocklistPath, '');
} else {
console.error('WARN: Error reading SpamWatch blocklist:', error);
}
}
};
const isOnSpamWatch = (userId) => {
return blocklist.includes(String(userId));
};
readBlocklist();
module.exports = { isOnSpamWatch };