Initial commit
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
|
||||
module.exports = {
|
||||
name:"Startup_function",
|
||||
async function(msg, args){
|
||||
setTimeout(async () => {
|
||||
|
||||
console.log("-------------------------------- Startup Function ------------------------------");
|
||||
|
||||
// Load all shortcodes with their redirects directly into memeory on startup
|
||||
process.stdout.write("Loading all shortcodes into memory 🟥");
|
||||
let url = await commands.get("query").function("SELECT idShortcode, dtOriginal from tbl_urls",[])
|
||||
for (let i = 0; i < url.length; i++) {
|
||||
shortcodes[url[i].idShortcode] = url[i].dtOriginal
|
||||
}
|
||||
process.stdout.cursorTo(40)
|
||||
process.stdout.write(`🟩 (${url.length})\n`)
|
||||
|
||||
|
||||
// Load all bans into memory
|
||||
process.stdout.write("Loading all bans into memory 🟥");
|
||||
let bans = await commands.get("query").function("SELECT dtIpHash from tbl_bans",[])
|
||||
for (let i = 0; i < bans.length; i++) {
|
||||
ignorelist[bans[i].dtIpHash] = bans[i].dtIpHash
|
||||
}
|
||||
process.stdout.cursorTo(40)
|
||||
process.stdout.write(`🟩 (${bans.length})\n`)
|
||||
|
||||
|
||||
// Ratelimit hit cleanup
|
||||
if(config.ratelimit.resetHits){
|
||||
setInterval(() => {
|
||||
for(hash in ratelimit){
|
||||
if(ratelimit[hash][1] > 0)
|
||||
ratelimit[hash][1] = ratelimit[hash][1]-1
|
||||
}
|
||||
}, 60000* config.ratelimit.resetTimeframe); // Timeframe value in minutes
|
||||
}
|
||||
|
||||
console.log("--------------------------------------------------------------------------------");
|
||||
}, 500);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user