mirror of
https://github.com/TheRealOwenRees/plantid-discord-bot.git
synced 2026-07-23 04:26:57 +00:00
start time runtime env fix
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
import Config
|
import Config
|
||||||
|
|
||||||
config :plantid_discord_bot,
|
config :plantid_discord_bot,
|
||||||
|
start_time: DateTime.utc_now(),
|
||||||
guild_ids: [1_002_507_312_159_797_318],
|
guild_ids: [1_002_507_312_159_797_318],
|
||||||
plantnet_api_key: System.get_env("PLANTNET_API_KEY"),
|
plantnet_api_key: System.get_env("PLANTNET_API_KEY"),
|
||||||
fileserver_url: "http://localhost:4321",
|
fileserver_url: "http://localhost:4321",
|
||||||
|
|||||||
@@ -5,10 +5,6 @@ defmodule PlantIdDiscordBot.Application do
|
|||||||
|
|
||||||
@impl true
|
@impl true
|
||||||
def start(_type, _args) do
|
def start(_type, _args) do
|
||||||
# Set the start time for the application
|
|
||||||
start_time = DateTime.utc_now()
|
|
||||||
Application.put_env(:plantid_discord_bot, :start_time, start_time)
|
|
||||||
|
|
||||||
children = [
|
children = [
|
||||||
PlantIdDiscordBot.Consumer,
|
PlantIdDiscordBot.Consumer,
|
||||||
PlantIdDiscordBot.RateLimiter,
|
PlantIdDiscordBot.RateLimiter,
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
defmodule PlantIdDiscordBot.Utils do
|
defmodule PlantIdDiscordBot.Utils do
|
||||||
@start_time Application.get_env(:plantid_discord_bot, :start_time)
|
|
||||||
|
|
||||||
def get_uptime() do
|
def get_uptime() do
|
||||||
DateTime.diff(DateTime.utc_now(), @start_time)
|
start_time = Application.get_env(:plantid_discord_bot, :start_time)
|
||||||
|
|
||||||
|
DateTime.diff(DateTime.utc_now(), start_time)
|
||||||
|> PlantIdDiscordBot.Utils.Duration.sec_to_str()
|
|> PlantIdDiscordBot.Utils.Duration.sec_to_str()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user