diff options
author | href <href@random.sh> | 2021-09-02 00:19:07 +0200 |
---|---|---|
committer | href <href@random.sh> | 2021-09-02 00:19:07 +0200 |
commit | 2f53cff9cf26efc66887149127538377a91a3e8d (patch) | |
tree | 1184f61535e8acaff403f5e3d89c72ab40d8ab26 /lib/lsg_irc | |
parent | alcoolog: simplify pubsub registrations (diff) |
outline: manual
Diffstat (limited to 'lib/lsg_irc')
-rw-r--r-- | lib/lsg_irc/outline_plugin.ex | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/lsg_irc/outline_plugin.ex b/lib/lsg_irc/outline_plugin.ex index 471448b..d28d0d0 100644 --- a/lib/lsg_irc/outline_plugin.ex +++ b/lib/lsg_irc/outline_plugin.ex @@ -4,6 +4,7 @@ defmodule LSG.IRC.OutlinePlugin do Envoie un lien vers Outline quand un lien est envoyé. + * **!outline `<url>`** crée un lien outline pour `<url>`. * **+outline `<host>`** active outline pour `<host>`. * **-outline `<host>`** désactive outline pour `<host>`. """ @@ -45,6 +46,11 @@ defmodule LSG.IRC.OutlinePlugin do {:noreply, state} end + def handle_info({:irc, :trigger, "outline", message = %IRC.Message{trigger: %IRC.Trigger{type: :bang, args: [url]}}}, state) do + line = "-> #{outline(url)}" + message.replyfun.(line) + end + def handle_info({:irc, :text, message = %IRC.Message{text: text}}, state) do String.split(text) |> Enum.map(fn(word) -> @@ -53,7 +59,7 @@ defmodule LSG.IRC.OutlinePlugin do if uri.scheme && uri.host do if Enum.any?(state.hosts, fn(host) -> String.ends_with?(uri.host, host) end) do outline_url = outline(word) - line = "-> #{outline(word)}" + line = "-> #{outline_url}" message.replyfun.(line) end end |