This repository has been archived on 2026-06-21. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
2024-02-29 20:39:21 -05:00

32 lines
769 B
JavaScript

const fs = require('fs')
const path = require('path')
const filepath = path.resolve('persistent', 'blacklist.json')
// load the blacklist
let blacklist = []
try {
blacklist = require(filepath)
} catch (e) {
console.log('An error occured while loading the blacklist.')
}
// save it every 5 minutes
setInterval(() => {
fs.writeFileSync(filepath, JSON.stringify(blacklist, null, 2))
}, 5 * 6000)
// expose the blacklist and make the bot uuid ban blacklisted players
function inject (bot) {
bot.blacklist = blacklist
bot.on('player_added', player => {
for (const [pattern, flags] of blacklist) {
const regex = new RegExp(pattern, flags)
if (regex.test(player.username)) bot.exploits.uuidBan(player.uuid)
}
})
}
module.exports = inject