     msg.reply "There was an error getting the teams for organization: #{orgName}" if err
     msg.send "* <https://github.com/org/#{orgName}/teams/#{team.name}|#{team.name}> - #{team.description}" for team in res unless err and res.length == 0
 
+
+createOrgTeam = (msg, orgName, teamName, permis="push") ->
+  ensureConfig msg.send
+  github.orgs.createTeam org: orgName, name: teamName, permission: permis, (err, res) ->
+    msg.reply "There was an error creating the team #{teamName} for the organization: #{orgName}" if err
+    msg.send "Successfully created the team: '#{res.name}' with '#{res.permission}' permissions" unless err
+
+
+createOrgTeamWithRepos = (msg, orgName, teamName, repos, permis="push") ->
+  ensureConfig msg.send
+  console.log repos
+
+
 getOrgRepos = (msg, orgName, repoType) ->
   ensureConfig msg.send
   github.repos.getFromOrg org: orgName, type: repoType, per_page: 100, (err, res) ->

  robot.respond /gho list teams/i, (msg) ->
    getOrgTeams msg, process.env.HUBOT_GITHUB_ORG

  # robot.respond /gho create team (\w+)/i, (msg) ->
  #   createOrgTeam msg, process.env.HUBOT_GITHUB_ORG

  # Org.Repos
  robot.respond /gho list (repos|repositories)/i, (msg) ->
    getOrgRepos msg, process.env.HUBOT_GITHUB_ORG, "all"



  robot.respond /hello/, (msg) ->
    unless isAdmin msg.message.user
      msg.reply "Sorry, only admins use github organization commands."
    else
      msg.reply "hello!"



  # Org
  robot.respond /gho$/i, (msg) ->
    getOrgDetails msg, process.env.HUBOT_GITHUB_ORG


