Browse Source

ffpb_updatealfred(): shuffle new node messages

Helge Jung 9 years ago
parent
commit
d36c89ae9c
1 changed files with 14 additions and 3 deletions
  1. 14 3
      modules/ffpb.py

+ 14 - 3
modules/ffpb.py

@@ -11,6 +11,7 @@ import json
 import urllib2
 import re
 import os
+import random
 import shelve
 import subprocess
 import time
@@ -307,11 +308,21 @@ def ffpb_updatealfred(bot):
 				new.append((nodeid,alfred_data[nodeid]['hostname']))
 				print('First time seen: ' + str(nodeid))
 		if len(new) > 0 and not bot.memory['ffpb_in_setup']:
-			action_msg = 'bemerkt '
+			action_msg = None
 			if len(new) == 1:
-				action_msg += 'den neuen Knoten \'' + str(new[0][1]) + '\''
+				action_msg = random.choice((
+					'bemerkt den neuen Knoten {0}',
+					'entdeckt {0}',
+					'reibt sich die Augen und erblickt einen verpackungsfrischen Knoten {0}',
+					'hat {0} noch nie gesehen',
+				)).format('\'' + str(new[0][1]) + '\'')
 			else:
-				action_msg += 'die neuen Knoten \'' + '\', \''.join([ str(x[1]) for x in new[0:-1] ]) + '\' und \'' + str(new[-1][1]) + '\''
+				action_msg = random.choice((
+					'bemerkt die neuen Knoten {0} und {1}',
+					'hat {0} und {1} entdeckt',
+					'bewundert {0} sowie {1}',
+					'freut sich, dass {0} und {1} nun auch online sind',
+				)).format('\'' + '\', \''.join([ str(x[1]) for x in new[0:-1] ]) + '\'', '\'' + str(new[-1][1]) + '\'')
 			action_target = bot.config.ffpb.msg_target
 			bot.msg(action_target, '\x01ACTION %s\x01' % action_msg)