diff options
author | Jordan Bracco <href@random.sh> | 2025-06-25 19:33:00 +0200 |
---|---|---|
committer | Jordan Bracco <href@random.sh> | 2025-06-25 20:05:35 +0200 |
commit | 2e9b62545ae7a2f25b2ce66a7ff8bd2657f92e01 (patch) | |
tree | d867946a91d9417d42555f71aeb555e67276a5c2 /lib/plugins | |
parent | format. (diff) |
txt: do not list, link only
Diffstat (limited to 'lib/plugins')
-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} |