summaryrefslogtreecommitdiff
path: root/lib/lsg_irc/txt_plugin.ex
diff options
context:
space:
mode:
authorhref <href@random.sh>2021-09-01 23:53:38 +0200
committerhref <href@random.sh>2021-09-01 23:53:52 +0200
commitf099a73f44e2eec135f33d5823bc65c0f8ff1da1 (patch)
tree43d56bb5ad18adbdd4564275b793dc7b9b4600a0 /lib/lsg_irc/txt_plugin.ex
parentalcoolog: use txt (diff)
txt: .txt: ignore files containing dots
Diffstat (limited to '')
-rw-r--r--lib/lsg_irc/txt_plugin.ex4
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)