   @channel "exligir"
   #@channel "elixir-lang"
 
-  defrecordp :hookrec, [type: nil, direct: false, fn: nil]
+  defrecordp :hookrec, [type: nil, direct: false, exclusive: false, fn: nil]
   defrecord State, hooks: []
 
   defp state_add_hook(state, id, f, opts) do

end


:inets.start
:ssl.start
:random.seed(:erlang.now())
IRCBot.Connection.start_link
IRCBot.Connection.add_hook :issue, &IssueHook.run/2, in: :text
IRCBot.Connection.add_hook :doc, &DocHook.run/2, in: :text
IRCBot.Connection.add_hook :link, &LinkHook.run/2, in: :text, direct: true
IRCBot.Connection.add_hook :linkscan, &LinkScanHook.run/2, in: :text
IRCBot.Connection.add_hook :trivia, &TriviaHook.run/2, in: :text
IRCBot.Connection.add_hook :ping, &PingHook.run/2, in: :text, direct: true
IRCBot.Connection.add_hook :rudereply, &RudeReplyHook.run/2, in: :text, direct: true
IRCBot.Connection.add_hook :likewhat, &LikeWhatHook.run/2, in: :text, direct: true
IRCBot.Connection.add_hook :eval, &EvalHook.run/2, in: :text

  end

  defp resolve_hook_result(messages, sock) when is_list(messages) do
    Enum.reduce(messages, nil, fn msg, status ->
      status || resolve_hook_result(msg, sock)
    end)
  end


