diff options
Diffstat (limited to 'lib/plugins/txt')
-rw-r--r-- | lib/plugins/txt/markov.ex | 8 | ||||
-rw-r--r-- | lib/plugins/txt/markov_py_markovify.ex | 13 |
2 files changed, 9 insertions, 12 deletions
diff --git a/lib/plugins/txt/markov.ex b/lib/plugins/txt/markov.ex index b47666c..2b3d210 100644 --- a/lib/plugins/txt/markov.ex +++ b/lib/plugins/txt/markov.ex @@ -1,9 +1,7 @@ defmodule Nola.Plugins.Txt.Markov do - @type state :: any() @callback start_link() :: {:ok, state()} - @callback reload(content :: Map.t, state()) :: any() - @callback sentence(state()) :: {:ok, String.t} | {:error, String.t} - @callback complete_sentence(state()) :: {:ok, String.t} | {:error, String.t} - + @callback reload(content :: Map.t(), state()) :: any() + @callback sentence(state()) :: {:ok, String.t()} | {:error, String.t()} + @callback complete_sentence(state()) :: {:ok, String.t()} | {:error, String.t()} end diff --git a/lib/plugins/txt/markov_py_markovify.ex b/lib/plugins/txt/markov_py_markovify.ex index f79ed47..47ff0a7 100644 --- a/lib/plugins/txt/markov_py_markovify.ex +++ b/lib/plugins/txt/markov_py_markovify.ex @@ -1,5 +1,4 @@ defmodule Nola.Plugins.Txt.MarkovPyMarkovify do - def start_link() do {:ok, nil} end @@ -19,7 +18,8 @@ defmodule Nola.Plugins.Txt.MarkovPyMarkovify do defp run(args \\ []) do {binary, script} = script() args = [script, Path.expand(Nola.Plugins.Txt.directory()) | args] - IO.puts "Args #{inspect args}" + IO.puts("Args #{inspect(args)}") + case MuonTrap.cmd(binary, args) do {response, 0} -> response {response, code} -> "error #{code}: #{response}" @@ -28,12 +28,11 @@ defmodule Nola.Plugins.Txt.MarkovPyMarkovify do defp script() do default_script = to_string(:code.priv_dir(:nola)) <> "/irc/txt/markovify.py" - env = Application.get_env(:nola, Nola.Plugins.Txt, []) - |> Keyword.get(:py_markovify, []) + + env = + Application.get_env(:nola, Nola.Plugins.Txt, []) + |> Keyword.get(:py_markovify, []) {Keyword.get(env, :python, "python3"), Keyword.get(env, :script, default_script)} end - - - end |