mirror of
https://github.com/TheRealOwenRees/plantid-discord-bot.git
synced 2026-07-23 12:36:58 +00:00
20 lines
500 B
Elixir
20 lines
500 B
Elixir
defmodule PlantIdDiscordBot.Utils do
|
|
def get_uptime() do
|
|
start_time = Application.get_env(:plantid_discord_bot, :start_time)
|
|
|
|
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
|