diff options
author | href <href@random.sh> | 2021-09-01 23:53:38 +0200 |
---|---|---|
committer | href <href@random.sh> | 2021-09-01 23:53:52 +0200 |
commit | f099a73f44e2eec135f33d5823bc65c0f8ff1da1 (patch) | |
tree | 43d56bb5ad18adbdd4564275b793dc7b9b4600a0 /lib/lsg_irc/txt_plugin.ex | |
parent | alcoolog: use txt (diff) |
txt: .txt: ignore files containing dots
Diffstat (limited to '')
-rw-r--r-- | lib/lsg_irc/txt_plugin.ex | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/lsg_irc/txt_plugin.ex b/lib/lsg_irc/txt_plugin.ex index ae369d1..93c4bb1 100644 --- a/lib/lsg_irc/txt_plugin.ex +++ b/lib/lsg_irc/txt_plugin.ex @@ -120,13 +120,15 @@ defmodule LSG.IRC.TxtPlugin 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 - "#{key}: #{to_string(Enum.count(data))}#{locked?}" + 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) |