summaryrefslogtreecommitdiff
path: root/lib/lsg_irc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/lsg_irc')
-rw-r--r--lib/lsg_irc/outline_plugin.ex8
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