Wordbot is a little more complex of a bot module and I've been working on it here. Other than wordbot module, a few minor tweaks have been added all around that don't really affect anything. Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
10 lines
254 B
Elixir
10 lines
254 B
Elixir
defmodule Omnibot.Util do
|
|
def string_empty?(s), do: String.length(s) == 0
|
|
|
|
def string_or_nil(s), do: if(string_empty?(s), do: nil, else: s)
|
|
|
|
def now_unix, do: now_unix("Etc/UTC")
|
|
|
|
def now_unix(tz), do: DateTime.now!(tz) |> DateTime.to_unix()
|
|
end
|