Dynamically compile and load modules

Your suggestion of Code.require_file/2 works.

  defp process([{_, %BotHost.BotInfo{module: module} = bot}], req) when module == nil, do: BotHost.Processor.process(bot, req) # use generic processor
  defp process([{_, %BotHost.BotInfo{module: module, module_file: file} = bot}], req) do
    case Code.require_file(file, "modules") do
      nil -> apply(module, :process, [bot, req])
      [{module,  _}] -> apply(module, :process, [bot, req])
      err -> log "load failed: #{module} - #{inspect err}" ; BotHost.Processor.process(bot, req) # unable to load bot-specific module, use generic processor instead
    end
  end