def handleReplayDetails(details, message, events):
  if (len(details['m_playerList']) != 1):
    funcs.messageReply(message, "Wrong number of players in replay, please host the game by yourself")
    return False
  realm = details['m_playerList'][0]['m_toon']['m_realm']
  regionInt = details['m_playerList'][0]['m_toon']['m_region']
  playerInt = details['m_playerList'][0]['m_toon']['m_id']
  playerName = details['m_playerList'][0]['m_name']

  playerName = funcs.stripOutClan(playerName)

  redditname = funcs.FindRedditName(events)
  if not (redditname):
    funcs.messageReply(message, "Reddit name not found in replay. Be sure to type out your reddit name in the exact format specified.")
    return False
  if redditname.lower() != message.author.name.lower():
    funcs.messageReply(message, "The reddit name in the replay is not the same reddit name you sent this message as. Be sure to type out your reddit name exactly" )
    return False

  regionName = funcs.RegionNameFromId(regionInt)
  if regionName == None:
    funcs.messageReply(message, "Your region is not supported. Go yell at the programmer responsible")
    return False

  playerBnetUrl = '{0}/{1}/{2}/'.format(playerInt, realm, playerName)
  print "getLeague(" + settings.regions[regionName][0] + ", " + playerBnetUrl + ")"
  leagueData = funcs.getLeague(settings.regions[regionName], playerBnetUrl)
  if not (leagueData):
    funcs.messageReply(message, "Error: {DD6B39E6-857C-11E3-9693-7A7328D43830}")
    return False

  f = open("accounts.txt","a")
  f.write('{0},{1},{2},\n'.format(playerBnetUrl, redditname, regionName))
  f.close()
  subreddit.flair.set('bboe', playerName, leagueData[0].title() + " "+regionName+" " + leagueData[1] + "-" + leagueData[2] + "-" + leagueData[3])
  funcs.messageReply(message, "Your flair has been set. Account link is a success!")
  return True
예제 #2
0
 def getNewLeagueForAccountMap(accountMap):
   league = funcs.getLeague(settings.regions[accountMap['region']], accountMap['bnet'])
   return (accountMap['redditName'], league)