old_contents: from leaguebot import app
  import leaguebot.models.map as screepmap
  import leaguebot.services.screeps as screeps
  import leaguebot.services.slack as slack
  import re
  
  
  def sendBattleMessage(battleinfo):
      message = getBattleMessageText(battleinfo)
      sendToSlack(message)
  
  
  def getBattleMessageText(battleinfo):
      tick = screeps.get_time()
      room_name = battleinfo['_id']
      room_owner = screepmap.getRoomOwner(room_name)
      message = str(tick) + ' - Battle: ' + '<https://screeps.com/a/#!/room/' + roomname + '|' + roomname + '>'
      if not room_owner:
          return message
  
      room_level = screepmap.getRoomLevel(room_name)
  
      if room_level and room_level > 0:
          message += ' RCL ' + str(room_level)
  
      message += ', defender ' + '<https://screeps.com/a/#!/profile/' + room_owner + '|' + room_owner + '>'
      room_alliance = screepmap.getUserAlliance(room_owner)
      if room_alliance:
          message += ' (' + room_alliance + ')'
  
      return message
  
  
  def sendNukeMessage(nukeinfo):
      message = getNukeMessageText(nukeinfo)
      sendToSlack(message)
  
  
  def getNukeMessageText(nukeinfo):
      tick = screeps.get_time()
      eta = str(nukeinfo['landTime']-tick)
      room_name = nukeinfo['room']
      room_owner = screepmap.getRoomOwner(room_name)
      message = str(tick) + ' - Nuke: ' + room_name + ' in ' + str(eta) + ' ticks'
  
      if not room_owner:
          message += ', abandoned'
      else:
          room_alliance = screepmap.getUserAlliance(room_owner)
          message += ', defender ' + room_owner
          if room_alliance:
              message += ' (' + room_alliance + ')'
      return message
  
  def sendToSlack(message):
      if 'SEND_TO_SLACK' not in app.config or not app.config['SEND_TO_SLACK']:
          return False
      try:
          channel = app.config['SLACK_CHANNEL']
          slack.send_slack_message(channel, message)
          print (message)
          return True
      except:
          return False
  
new_contents: from leaguebot import app
  import leaguebot.models.map as screepmap
  import leaguebot.services.screeps as screeps
  import leaguebot.services.slack as slack
  import re
  
  
  def sendBattleMessage(battleinfo):
      message = getBattleMessageText(battleinfo)
      sendToSlack(message)
  
  
  def getBattleMessageText(battleinfo):
      tick = screeps.get_time()
      room_name = battleinfo['_id']
      room_owner = screepmap.getRoomOwner(room_name)
      message = str(tick) + ' - Battle: ' + '<https://screeps.com/a/#!/room/' + room_name + '|' + room_name + '>'
      if not room_owner:
          return message
  
      room_level = screepmap.getRoomLevel(room_name)
  
      if room_level and room_level > 0:
          message += ' RCL ' + str(room_level)
  
      message += ', defender ' + '<https://screeps.com/a/#!/profile/' + room_owner + '|' + room_owner + '>'
      room_alliance = screepmap.getUserAlliance(room_owner)
      if room_alliance:
          message += ' (' + room_alliance + ')'
  
      return message
  
  
  def sendNukeMessage(nukeinfo):
      message = getNukeMessageText(nukeinfo)
      sendToSlack(message)
  
  
  def getNukeMessageText(nukeinfo):
      tick = screeps.get_time()
      eta = str(nukeinfo['landTime']-tick)
      room_name = nukeinfo['room']
      room_owner = screepmap.getRoomOwner(room_name)
      message = str(tick) + ' - Nuke: ' + room_name + ' in ' + str(eta) + ' ticks'
  
      if not room_owner:
          message += ', abandoned'
      else:
          room_alliance = screepmap.getUserAlliance(room_owner)
          message += ', defender ' + room_owner
          if room_alliance:
              message += ' (' + room_alliance + ')'
      return message
  
  
  def sendToSlack(message):
      if 'SEND_TO_SLACK' not in app.config or not app.config['SEND_TO_SLACK']:
          return False
      try:
          channel = app.config['SLACK_CHANNEL']
          slack.send_slack_message(channel, message)
          print (message)
          return True
      except:
          return False
  
subject: fix romance error