userDialog time spent together

This commit is contained in:
Natsumi
2021-10-03 13:30:40 +13:00
parent af2a469f00
commit 304a8274e5
3 changed files with 53 additions and 1 deletions

View File

@@ -790,6 +790,21 @@ class Database {
}, `SELECT COUNT(*) FROM gamelog_join_leave WHERE (type = 'OnPlayerJoined') AND (user_id = '${userId}' OR display_name = '${displayName}')`);
return ref;
}
async getTimeSpent(input) {
var userId = input.id.replaceAll("'", '');
var displayName = input.displayName.replaceAll("'", "''");
var ref = {
timeSpent: 0,
userId
};
await sqliteService.execute((row) => {
if (typeof row[0] === 'number') {
ref.timeSpent += row[0];
}
}, `SELECT time FROM gamelog_join_leave WHERE (type = 'OnPlayerLeft') AND (user_id = '${userId}' OR display_name = '${displayName}')`);
return ref;
}
}
var self = new Database();