Skip to content

Commit

Permalink
some tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
braindigitalis committed Jun 18, 2024
1 parent 60e4024 commit b2661ad
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions modules/trivia/trivia.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ uint64_t TriviaModule::GetActiveGames()
uint64_t TriviaModule::GetGuildTotal()
{
/* Counts all games across all clusters */
auto rs = db::query("SELECT SUM(server_count) AS server_count FROM infobot_discord_counts WHERE dev = ?", {bot->IsDevMode() ? 1 : 0});
auto rs = db::query("SELECT COUNT(id) AS server_count FROM guild_temp_cache", {});
if (rs.size()) {
return from_string<uint64_t>(rs[0]["server_count"], std::dec);
} else {
Expand All @@ -348,7 +348,7 @@ uint64_t TriviaModule::GetGuildTotal()
uint64_t TriviaModule::GetMemberTotal()
{
/* Counts all games across all clusters */
auto rs = db::query("SELECT SUM(user_count) AS user_count FROM infobot_discord_counts WHERE dev = ?", {bot->IsDevMode() ? 1 : 0});
auto rs = db::query("SELECT SUM(user_count) AS user_count FROM guild_temp_cache", {});
if (rs.size()) {
return from_string<uint64_t>(rs[0]["user_count"], std::dec);
} else {
Expand Down
2 changes: 1 addition & 1 deletion update-bot-lists.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@

mysqli_select_db($conn, $settings->dbname);
/* Fetch statistics from all shards for non-development instances */
$totals = mysqli_fetch_object(mysqli_query($conn, "SELECT SUM(user_count) AS users, SUM(server_count) AS servers, SUM(shard_count) AS shards, SUM(sent_messages) AS sent_messages, SUM(received_messages) AS received_messages, MAX(memory_usage) AS memory_usage, SUM(channel_count) AS channels FROM infobot_discord_counts WHERE dev = 0"));
$totals = mysqli_fetch_object(mysqli_query($conn, "SELECT MAX(user_count) AS users, MAX(server_count) AS servers, SUM(shard_count) AS shards, SUM(sent_messages) AS sent_messages, SUM(received_messages) AS received_messages, MAX(memory_usage) AS memory_usage, SUM(channel_count) AS channels FROM infobot_discord_counts WHERE dev = 0"));

/* Get a list of all bot listing sites */
$q = mysqli_query($conn, "SELECT * FROM infobot_discord_list_sites");
Expand Down
2 changes: 1 addition & 1 deletion update-graphs.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
if ($check->online < $total_shards || $check->connected < $total_shards) {
mysqli_query($conn, "INSERT INTO trivia_graphs (entry_date, cpu, user_count, server_count, channel_count, memory_usage, games, discord_ping, trivia_ping, db_ping, kicks, commands, questions, question_total, cluster_cpu) VALUES(now(), $cpu_percent, $last->user_count, $last->server_count, $last->channel_count, $last->memory_usage, $last->games, $discord_api_ping, $tb_api_ping, $db_ping, $kicks, $cmds, $questions, $qcounter, '$cpu_all')");
} else {
$current = mysqli_fetch_object(mysqli_query($conn, "SELECT SUM(user_count) as user_count, SUM(server_count) AS server_count, SUM(channel_count) AS channel_count, SUM(memory_usage) AS memory_usage, SUM(games) AS games FROM infobot_discord_counts WHERE dev = 0"));
$current = mysqli_fetch_object(mysqli_query($conn, "SELECT MAX(user_count) as user_count, MAX(server_count) AS server_count, SUM(channel_count) AS channel_count, SUM(memory_usage) AS memory_usage, SUM(games) AS games FROM infobot_discord_counts WHERE dev = 0"));
mysqli_query($conn, "INSERT INTO trivia_graphs (entry_date, cpu, user_count, server_count, channel_count, memory_usage, games, discord_ping, trivia_ping, db_ping, kicks, commands, questions, question_total, cluster_cpu) VALUES(now(), $cpu_percent, $current->user_count, $current->server_count, $current->channel_count, $current->memory_usage, $current->games, $discord_api_ping, $tb_api_ping, $db_ping, $kicks, $cmds, $questions, $qcounter, '$cpu_all')");
}

0 comments on commit b2661ad

Please sign in to comment.