   defp process_msg(msg) do
     IO.puts msg
 
-    {_prefix, command, args} = parse_msg(msg)
+    {prefix, command, args} = parse_msg(msg)
+
+    sender = if prefix do
+      case Regex.run(~r"^([^! ]+)(?:$|!)", String.from_char_list!(prefix)) do
+        [_, sender] -> sender
+        other -> IO.puts "bad sender: #{inspect prefix} #{inspect other}"; nil
+      end
+    end
+
     case command do
       'PRIVMSG' ->
         [_chan, msg] = args

end

defmodule TriviaHook do
  def run(text) do
    tokens = tokenize(text)
    result = if find_at_least(tokens, [{["mix", "project", "application", "app"], 1}, {["shell", "iex", "repl"], 1}]) do
      "To start an interactive shell with your mix project loaded in it, run `iex -S mix`"



  defp irc_cmd(sock, cmd, rest) do
    IO.puts "Executing command #{cmd} with args #{inspect rest}"
    :ok = :gen_tcp.send(sock, "#{cmd} #{rest}\r\n")
    sock
  end
