Add player count handler

This commit is contained in:
Flashfyre committed 2024-03-23 21:34:18 -04:00
1 parent 2495c1ee9a
commit 7d23859dea
3 files changed
+42

No files matched your search

+12
View File
@@ -0,0 +1,12 @@
package db
func FetchPlayerCount() (int, error) {
var playerCount int
err := handle.QueryRow("SELECT COUNT(*) FROM accounts WHERE lastActivity > DATE_SUB(UTC_TIMESTAMP(), INTERVAL 5 MINUTE)").Scan(&playerCount)
if err != nil {
return 0, err
}
return playerCount, nil
}