|
@@ -21,7 +21,6 @@ import threading
|
|
|
|
|
|
msgserver = None
|
|
|
peers_repo = None
|
|
|
-stats = None
|
|
|
monitored_nodes = None
|
|
|
highscores = None
|
|
|
|
|
@@ -391,8 +390,6 @@ def ffpb_updatepeers(bot):
|
|
|
|
|
|
@willie.module.interval(15)
|
|
|
def ffpb_get_stats(bot):
|
|
|
- global stats
|
|
|
-
|
|
|
response = urllib2.urlopen('http://map.paderborn.freifunk.net/nodes.json')
|
|
|
|
|
|
data = json.load(response)
|
|
@@ -412,8 +409,9 @@ def ffpb_get_stats(bot):
|
|
|
if link['type'] == 'client':
|
|
|
clients_count += 1
|
|
|
|
|
|
- if stats is None:
|
|
|
- stats = { }
|
|
|
+ if not 'ffpb_stats' in bot.memory:
|
|
|
+ bot.memory['ffpb_stats'] = { }
|
|
|
+ stats = bot.memory['ffpb_stats']
|
|
|
stats["nodes_active"] = nodes_active
|
|
|
stats["nodes_total"] = nodes_total
|
|
|
stats["clients"] = clients_count
|
|
@@ -441,6 +439,7 @@ def ffpb_get_stats(bot):
|
|
|
@willie.module.commands('status')
|
|
|
def ffpb_status(bot, trigger):
|
|
|
"""Status des FFPB-Netzes: Anzahl (aktiver) Knoten + Clients"""
|
|
|
+ stats = bot.memory['ffpb_stats'] if 'ffpb_stats' in bot.memory else None
|
|
|
if stats is None:
|
|
|
bot.say('Uff, kein Plan wo der Zettel ist. Fragst du später nochmal?')
|
|
|
return
|