1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
defmodule LSG.IRC.AdminHandler do
@moduledoc """
# admin
!op
op; requiert admin
"""
def irc_doc, do: nil
def start_link(client) do
GenServer.start_link(__MODULE__, [client])
end
def init([client]) do
ExIRC.Client.add_handler client, self
{:ok, client}
end
def handle_info({:received, "!op", sender, chan}, client) do
if LSG.IRC.admin?(sender) do
ExIRC.Client.mode(client, chan, "+o", sender.nick)
end
{:noreply, client}
end
def handle_info(msg, client) do
IO.inspect(msg)
{:noreply, client}
end
end
|