From 2f53cff9cf26efc66887149127538377a91a3e8d Mon Sep 17 00:00:00 2001 From: href Date: Thu, 2 Sep 2021 00:19:07 +0200 Subject: outline: manual --- lib/lsg_irc/outline_plugin.ex | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'lib/lsg_irc') 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 ``** crée un lien outline pour ``. * **+outline ``** active outline pour ``. * **-outline ``** désactive outline pour ``. """ @@ -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 -- cgit v1.2.3