Some auto utils stuff.
This commit is contained in:
@@ -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
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user