Add anonymous analytics
This commit is contained in:
parent
74f4d916c5
commit
efe4ba607f
55
analytics.js
55
analytics.js
|
@ -13,4 +13,59 @@ module.exports = (req, res, next) => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
if (path.includes('/v1/ban/roblox/')) {
|
||||||
|
pool.query(
|
||||||
|
'INSERT INTO globalAnalytics (tag, value) VALUES ("ROBLOX_CHECKS", 1) ON DUPLICATE KEY UPDATE value = value + 1;',
|
||||||
|
(error) => {
|
||||||
|
if (error) {
|
||||||
|
console.error('Error logging global analytics:', error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (path.includes('/v1/ban/discord/')) {
|
||||||
|
pool.query(
|
||||||
|
'INSERT INTO globalAnalytics (tag, value) VALUES ("DISCORD_CHECKS", 1) ON DUPLICATE KEY UPDATE value = value + 1;',
|
||||||
|
(error) => {
|
||||||
|
if (error) {
|
||||||
|
console.error('Error logging global analytics:', error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (path.includes('/v1/ban/')) {
|
||||||
|
pool.query(
|
||||||
|
'INSERT INTO globalAnalytics (tag, value) VALUES ("TOTAL_CHECKS", 1) ON DUPLICATE KEY UPDATE value = value + 1;',
|
||||||
|
(error) => {
|
||||||
|
if (error) {
|
||||||
|
console.error('Error logging global analytics:', error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (req.headers['roblox-id']) { // Roblox game ID. Insert if not exists into gameAnalytics table, if /v1/ban/roblox/:id is called incirment globalAnalytics key=TOTAL_CHECKS
|
||||||
|
pool.query(
|
||||||
|
'INSERT INTO gameAnalytics (gameID) VALUES (?) ON DUPLICATE KEY UPDATE gameID = gameID;',
|
||||||
|
[req.headers['roblox-id']],
|
||||||
|
(error) => {
|
||||||
|
if (error) {
|
||||||
|
console.error('Error logging game analytics:', error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
if (path.includes('/v1/ban/roblox/')) {
|
||||||
|
pool.query(
|
||||||
|
'INSERT INTO globalAnalytics (tag, value) VALUES ("ROBLOX_CHECKS_FROM_SERVERS", 1) ON DUPLICATE KEY UPDATE value = value + 1;',
|
||||||
|
(error) => {
|
||||||
|
if (error) {
|
||||||
|
console.error('Error logging global analytics:', error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
4
index.js
4
index.js
|
@ -134,7 +134,7 @@ console.log(process.env.REASON_FLAGS)
|
||||||
// Discord stuff
|
// Discord stuff
|
||||||
const Discord = require("discord.js");
|
const Discord = require("discord.js");
|
||||||
const client = new Discord.Client({ intents: ["Guilds", "GuildBans", "GuildMembers"] })
|
const client = new Discord.Client({ intents: ["Guilds", "GuildBans", "GuildMembers"] })
|
||||||
|
global.discord_client = client
|
||||||
client.on("ready", async () => {
|
client.on("ready", async () => {
|
||||||
log.info(`Logged into Discord as ${client.user.displayName}`);
|
log.info(`Logged into Discord as ${client.user.displayName}`);
|
||||||
const commands = require("./commands")
|
const commands = require("./commands")
|
||||||
|
@ -179,6 +179,8 @@ client.on("interactionCreate", async (interaction) => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
client.on('guildMemberAdd', require("./discordJoins.js"))
|
||||||
|
|
||||||
// Startup
|
// Startup
|
||||||
log.info("Starting up...")
|
log.info("Starting up...")
|
||||||
const bcrypt = require("bcrypt")
|
const bcrypt = require("bcrypt")
|
||||||
|
|
Loading…
Reference in a new issue