diff options
Diffstat (limited to 'lib/lsg_irc/handler.ex')
-rw-r--r-- | lib/lsg_irc/handler.ex | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/lib/lsg_irc/handler.ex b/lib/lsg_irc/handler.ex new file mode 100644 index 0000000..19c0945 --- /dev/null +++ b/lib/lsg_irc/handler.ex @@ -0,0 +1,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 |