示例#1
0
 def warframe_loop(self):
     last_alerts = None
     while True:
         time.sleep(5 * 60)
         try:
             alerts = warframe.alert_analysis()
             if len(alerts) > 0 and alerts != last_alerts:
                 broadcast_alerts = set(alerts) - set(last_alerts)
                 self.send_message(config.bot.warframe['channel'],
                                   '\n'.join(broadcast_alerts))
             last_alerts = alerts
         except requests.exceptions.RequestException as e:
             log.write('warframe: %s' % e)
示例#2
0
	def warframe_loop(self):
		last_alerts = []
		while True:
			time.sleep(5 * 60)
			try:
				alerts = warframe.alert_analysis()
				broadcast_alerts = set(alerts) - set(last_alerts)
				if len(broadcast_alerts) > 0:
					self.send_message(config.bot.warframe['channel'], '\n'.join(broadcast_alerts))
				last_alerts = alerts
			except requests.exceptions.HTTPError as e:
				log.write('warframe: %s\n%s' % (e, e.response.text[:1000]))
			except requests.exceptions.RequestException as e:
				log.write('warframe: %s' % e)