   end
 end
 
+defmodule PingHook do
+  def run(text) do
+    if String.downcase(text) == "ping" do
+      {:msg, "pong"}
+    end
+  end
+end
+
 :inets.start
 :ssl.start
 IRCBot.Connection.start_link

    state = receive do
      {:internal, msg} ->
        case msg do
          {:add_hook, id, hook} ->
            state.add_hook(id, hook)
          {:remove_hook, id} ->
            state.remove_hook(id)
          other ->
            raise RuntimeError[message: "unhandled internal msg #{inspect other}"]
        end

  end

  defp resolve_hook_result({:reply, text}, sock) do
    irc_cmd(sock, "PRIVMSG", "\##{@channel} #{@nickname}: :#{text}")
  end

  defp resolve_hook_result({:reply, to, text}, sock) do
    irc_cmd(sock, "PRIVMSG", "\##{@channel} #{to}: :#{text}")
  end

  defp resolve_hook_result({:msg, text}, sock) do
