Browse Source

log new highscore to (public) channel

Helge Jung 9 years ago
parent
commit
04e6483256
1 changed files with 6 additions and 0 deletions
  1. 6 0
      modules/ffpb.py

+ 6 - 0
modules/ffpb.py

@@ -423,6 +423,12 @@ def ffpb_get_stats(bot):
 
 	if highscore_changed:
 		print('HIGHSCORE changed: {0} nodes ({1}), {2} clients ({3})'.format(highscores['nodes'], highscores['nodes_ts'], highscores['clients'], highscores['clients_ts']))
+		if not (bot.config.ffpb.msg_target is None):
+			action_msg = 'notiert sich den neuen Highscore: {0} Knoten ({1}), {2} Clients ({3})'.format(highscores['nodes'], pretty_date(int(highscores['nodes_ts'])), highscores['clients'], pretty_date(int(highscores['clients_ts'])))
+			action_target = bot.config.ffpb.msg_target
+			if (not bot.config.ffpb.msg_target_public is None):
+				action_target = bot.config.ffpb.msg_target_public
+			bot.msg(action_target, '\x01ACTION %s\x01' % action_msg)
 
 @willie.module.commands('status')
 def ffpb_status(bot, trigger):