This commit is contained in:
Christopher Cookman 2025-01-02 13:09:34 -07:00
parent c9660d82af
commit 11cb1c5260
3 changed files with 37 additions and 0 deletions

30
discordJoins.js Normal file
View file

@ -0,0 +1,30 @@
const pool = global.db_pool
const client = global.discord_client
module.exports = async (member) => {
const conn = await pool.getConnection()
console.log('Member joined:', member.displayName);
// Check database, if discordId is banned and the ban isn't expired, kick the user for the short reason
conn.query(
'SELECT * FROM bans WHERE discordId = ?',
[member.id.toString()],
(error, results) => {
console.log("Start results")
if (error) {
console.error('Error checking ban:', error);
return;
}
if (results.length === 0) {
return console.log('No ban found');
}
const ban = results[0];
if (ban.expiresTimestamp && new Date(ban.expiresTimestamp) < new Date()) {
return console.log;
}
console.log('Banned:', ban);
member.kick(`Banned: ${ban.reason}`).catch(console.error);
}
).finally(() => conn.release());
}

View file

@ -0,0 +1,3 @@
CREATE TABLE IF NOT EXISTS gameAnalytics (
gameID INT PRIMARY KEY NOT NULL
);

View file

@ -0,0 +1,4 @@
CREATE TABLE IF NOT EXISTS globalAnalytics (
tag VARCHAR(255) PRIMARY KEY NOT NULL,
value INT NOT NULL DEFAULT 0
);