file server started in supervisor tree

This commit is contained in:
Owen
2024-12-15 22:48:47 +01:00
parent 81c95c28b2
commit 1b1fa19fff
8 changed files with 30 additions and 9 deletions
+19
View File
@@ -0,0 +1,19 @@
defmodule PlantIdDiscordBot.Utils do
@start_time Application.compile_env(:plantid_discord_bot, :start_time)
def get_uptime() do
DateTime.diff(DateTime.utc_now(), @start_time)
|> PlantIdDiscordBot.Utils.Duration.sec_to_str()
end
def get_shard_latency() do
Nostrum.Util.get_all_shard_latencies()
|> Map.get(0)
|> to_string()
|> Kernel.<>("ms")
end
def get_guilds_names() do
Nostrum.Cache.GuildCache.fold([], fn %{name: name}, acc -> [name | acc] end)
end
end