 defmodule Evaluator do
-  def eval(expr, version \\ "0.12.5") do
-    result = :httpc.request(:post, {'http://localhost:8001/eval/elixir/#{version}', [], '', expr}, [], [sync: true])
+  def eval(expr, opts \\ []) do
+    lang = Keyword.get(opts, :lang, "elixir")
+    version = Keyword.get(opts, :version, "0.12.5")
+    result = :httpc.request(:post, {'http://localhost:8001/eval/#{lang}/#{version}', [], '', expr}, [], [sync: true])
     case result do
       {:error, _reason} ->
         IO.inspect _reason

        {:msg, Evaluator.eval(String.strip(expr))}

      "eval~13 " <> expr ->
        {:msg, Evaluator.eval(String.strip(expr), "0.13")}

      _ -> nil
    end

    case command do
      'PRIVMSG' ->
        [_chan, msg] = args
        {:msg, sender, msg}
      'PING' ->
        :pong
      _ -> nil
