Update modules to be more egonomic, add command macro

Modules are now defined using on_{msg,channel_msg,join,part,kick}.
Additionally, commands can be defined using a convenient macro.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
2020-06-13 15:20:00 -04:00
parent afd8f8c667
commit ed22d1bf0f
3 changed files with 101 additions and 55 deletions

View File

@@ -33,7 +33,7 @@ defmodule Omnibot.Router do
# Find modules that want this message
State.cfg()
|> Config.channel_modules(channel)
|> Enum.each(fn {module, _} -> module.msg(module, msg) end)
|> Enum.each(fn {module, _} -> module.on_msg(msg) end)
end
def handle(_irc, :join, %Msg {prefix: %Msg.Prefix{nick: nick}, params: [channel | _]}) do