summaryrefslogtreecommitdiff
path: root/lib/lsg_irc/handler.ex
blob: 19c0945c0c5654d105a7982ef66a0b16fdb5e737 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
defmodule LSG.IRC.Handler do
  defmacro __using__(_) do
    quote do
      alias LSG.IRC
      alias LSG.IRC.UserTrack
      alias ExIRC.Client
      require LSG.IRC.Handler
      import LSG.IRC.Handler
    end
  end

  def privmsg(client, {nil, %ExIRC.SenderInfo{nick: nick}}, message) do
    privmsg(client, nick, message)
  end

  def privmsg(client, {channel, _}, message) do
    privmsg(client, channel, message)
  end

  def privmsg(client, target, message) when is_binary(target) do
    ExIRC.Client.msg(client, :privmsg, target, message)
  end

end