diff options
-rw-r--r-- | lib/plugins/txt.ex | 24 |
1 files changed, 4 insertions, 20 deletions
diff --git a/lib/plugins/txt.ex b/lib/plugins/txt.ex index b06e5ff..c582e67 100644 --- a/lib/plugins/txt.ex +++ b/lib/plugins/txt.ex @@ -60,7 +60,7 @@ defmodule Nola.Plugins.Txt do Keyword.get( Application.get_env(:nola, __MODULE__, []), :markov_handler, - Nola.Plugins.Txt.Markov.Native + Nola.Plugins.Txt.MarkovPyMarkovify ) {:ok, markov} = markov_handler.start_link() @@ -138,40 +138,24 @@ defmodule Nola.Plugins.Txt do # def handle_info({:irc, :trigger, "txt", msg = %{trigger: %{type: :dot}}}, state) do - map = - Enum.map(state.triggers, fn {key, data} -> - ignore? = String.contains?(key, ".") - - locked? = - case :dets.lookup(state.locks, key) do - [{trigger}] -> "*" - _ -> "" - end - - unless ignore?, do: "#{key}: #{to_string(Enum.count(data))}#{locked?}" - end) - |> Enum.filter(& &1) - total = Enum.reduce(state.triggers, 0, fn {_, data}, acc -> acc + Enum.count(data) end) - detail = Enum.join(map, ", ") - link = NolaWeb.Router.Helpers.irc_url( NolaWeb.Endpoint, :txt, - m.network, - NolaWeb.format_chan(m.channel) + msg.network, + NolaWeb.format_chan(msg.channel) ) total = "#{Enum.count(state.triggers)} fichiers, #{to_string(total)} lignes: #{link}" ro = if !state.rw, do: " (lecture seule activée)", else: "" - (detail <> total <> ro) + (total <> ro) |> msg.replyfun.() {:noreply, state} |