diff options
Diffstat (limited to 'lib/lsg_irc/np_handler.ex')
-rw-r--r-- | lib/lsg_irc/np_handler.ex | 40 |
1 files changed, 0 insertions, 40 deletions
diff --git a/lib/lsg_irc/np_handler.ex b/lib/lsg_irc/np_handler.ex deleted file mode 100644 index 1a52c75..0000000 --- a/lib/lsg_irc/np_handler.ex +++ /dev/null @@ -1,40 +0,0 @@ -defmodule LSG.IRC.NpHandler do - @moduledoc """ - # np - - * **!np** chanson/émission actuellement sur le stream de 115ans.net - """ - - def short_irc_doc, do: "!np (en ce moment sur 115ans)" - def irc_doc, do: @moduledoc - def start_link(client) do - GenServer.start_link(__MODULE__, [client], name: __MODULE__) - end - - def init([client]) do - ExIRC.Client.add_handler client, self - {:ok, _} = Registry.register(LSG.BroadcastRegistry, "icecast", [plugin: __MODULE__]) - {:ok, client} - end - - def handle_info({:received, "!np", _, chan}, client) do - stats = LSG.IcecastAgent.get - np = if stats.live do - "en direct: #{format_genre(stats.genre)}#{stats.np}" - else - "np: #{stats.np}" - end - ExIRC.Client.msg(client, :privmsg, chan, np) - {:noreply, client} - end - - # Catch-all for messages you don't care about - def handle_info(msg, client) do - {:noreply, client} - end - - defp format_genre(nil), do: "" - defp format_genre(""), do: "" - defp format_genre(text), do: "[#{text}] " - -end |