aba82c68 by Barry

Fixed games listing / display

1 parent 64f770f2
......@@ -90,10 +90,11 @@ def on_socket_raw_send(payload, binary=False):
@client.event
def on_status(member):
print("Status Changed %s" % (member,))
#print("Status Changed %s" % (member,))
try:
json_data=open(member_status).read()
data = json.loads(json_data)
print(json_data)
except ValueError:
data = {}
if not data:
......@@ -145,7 +146,7 @@ def on_status(member):
'games_played': games_played,
'aliases': aliases
}
print('Status Change: %s' % (data,))
#print('Status Change: %s' % (data,))
jdata = json.dumps(data, ensure_ascii=False)
except Exception as e:
print('Error saving status change: %s' % (e),)
......@@ -159,9 +160,14 @@ def get_game_names(game_id_list):
data = json.loads(json_data)
result = []
for game_id in game_id_list:
if isinstance(game_id, str) and not game_id.isdigit():
result.append(game_id)
continue
name_set = False
for game in data:
if game['id'] == game_id:
result.append(game['name'])
name_set = True
return result
def get_mention_status(mention):
......@@ -187,7 +193,7 @@ def check_msg_queue():
data = {}
if not data:
data = {}
print("Data: %s" % data)
#print("Data: %s" % data)
new_data = {}
for username in data:
for author in data[username]:
......@@ -215,7 +221,7 @@ def check_msg_queue():
new_data[username][author] = data[username][author]
jdata = json.dumps(new_data, ensure_ascii=False)
print("New Data: %s" % new_data)
#print("New Data: %s" % new_data)
open(deliveries_file, 'wb+').write(jdata.encode('utf8'))
return
......@@ -467,7 +473,7 @@ Stuff:
for username in member_data:
if 'games_played' in member_data[username]:
for id in member_data[username]['games_played']:
if id == game_id:
if id == game_id or id == game_name:
matched_usernames.append(username)
client.send_message(message.channel, 'I have seen {} playing: {}'.format(', '.join(matched_usernames), game_name))
......@@ -579,6 +585,9 @@ Stuff:
if message.content.startswith('!question'):
question = message.content[10:]
if "is it gay" in question:
client.send_message(message.channel, 'Yes {}, it is gay.'.format(message.author.mention()))
return
res = wolf.query(question)
try:
if len(res.pods):
......