uhhhhhhh
This commit is contained in:
parent
c9660d82af
commit
11cb1c5260
30
discordJoins.js
Normal file
30
discordJoins.js
Normal 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());
|
||||||
|
}
|
3
migrations/010_init_gameAnalytics_table.sql
Normal file
3
migrations/010_init_gameAnalytics_table.sql
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
CREATE TABLE IF NOT EXISTS gameAnalytics (
|
||||||
|
gameID INT PRIMARY KEY NOT NULL
|
||||||
|
);
|
4
migrations/011_init_globalAnalytics_table.sql
Normal file
4
migrations/011_init_globalAnalytics_table.sql
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
CREATE TABLE IF NOT EXISTS globalAnalytics (
|
||||||
|
tag VARCHAR(255) PRIMARY KEY NOT NULL,
|
||||||
|
value INT NOT NULL DEFAULT 0
|
||||||
|
);
|
Loading…
Reference in a new issue