   end
 
   def start(conn, %{
-        "user_name" => _user,
         "channel_name" => channel_name,
         "text" => "reveal"
       }) do

    client = Tentacat.Client.new(%{access_token: access_token})

    case Tentacat.Issues.find(client, org, repo, issue) do
      {200, issue, _http_response} -> {:ok, issue}
      {_response_code, %{"message" => error_message}, _http_response} -> {:error, error_message}
    end

      channel_name: channel_name,
      text: current_estimates
    })

    text(conn, "")
  end

  def start(
        conn,
        %{
          "channel_name" => channel_name,
          "text" => "decide" <> repo_issue_and_score
        }
      ) do
    access_token = conn.assigns.current_user.github_access_token

    with {:ok, issue} <- decide_issue(access_token, repo_issue_and_score) do
      %{"title" => title, "html_url" => url} = issue

      Slack.post_message_to_channel(%{
        channel_name: channel_name,
        text: "Jackpot. Issue *#{title}* at #{url} has been scored!"
      })
    else
      {:error, error_message} ->
        IO.puts("Error fetching issue from github")
        text(conn, error_message)

      x ->
        IO.inspect(x)
        text(conn, "Invalid parameters, repo/issue_number/score is required")
    end

    text(conn, "")
  end
