Some auto utils stuff.

This commit is contained in:
Kwafuri
2024-02-14 22:41:58 +00:00
parent b098b55928
commit 2fc692a5a0
+22
View File
@@ -0,0 +1,22 @@
const client = require('..');
async function newUserKicker(member) {
const guildId = member.guild.id;
const db = await client.db.get(`settings-${guildId}`) || {};
const threshold = db.newUserKickerThreshold;
const accountAge = (Date.now() - member.user.createdAt) / (1000 * 60 * 60 * 24);
console.log(`Account age of ${member.user.tag}: ${accountAge} days.`);
if (accountAge <= threshold) {
member.kick('Account age is less than the threshold.');
console.log(`Account age of ${member.user.tag} is less than the threshold. Kicked.`);
} else {
console.log(`Account age of ${member.user.tag} is greater than the threshold. Not kicked.`);
}
return;
}
module.exports = {
newUserKicker
}