Fixed games listing / display
Showing
2 changed files
with
14 additions
and
5 deletions
... | @@ -90,10 +90,11 @@ def on_socket_raw_send(payload, binary=False): | ... | @@ -90,10 +90,11 @@ def on_socket_raw_send(payload, binary=False): |
90 | 90 | ||
91 | @client.event | 91 | @client.event |
92 | def on_status(member): | 92 | def on_status(member): |
93 | print("Status Changed %s" % (member,)) | 93 | #print("Status Changed %s" % (member,)) |
94 | try: | 94 | try: |
95 | json_data=open(member_status).read() | 95 | json_data=open(member_status).read() |
96 | data = json.loads(json_data) | 96 | data = json.loads(json_data) |
97 | print(json_data) | ||
97 | except ValueError: | 98 | except ValueError: |
98 | data = {} | 99 | data = {} |
99 | if not data: | 100 | if not data: |
... | @@ -145,7 +146,7 @@ def on_status(member): | ... | @@ -145,7 +146,7 @@ def on_status(member): |
145 | 'games_played': games_played, | 146 | 'games_played': games_played, |
146 | 'aliases': aliases | 147 | 'aliases': aliases |
147 | } | 148 | } |
148 | print('Status Change: %s' % (data,)) | 149 | #print('Status Change: %s' % (data,)) |
149 | jdata = json.dumps(data, ensure_ascii=False) | 150 | jdata = json.dumps(data, ensure_ascii=False) |
150 | except Exception as e: | 151 | except Exception as e: |
151 | print('Error saving status change: %s' % (e),) | 152 | print('Error saving status change: %s' % (e),) |
... | @@ -159,9 +160,14 @@ def get_game_names(game_id_list): | ... | @@ -159,9 +160,14 @@ def get_game_names(game_id_list): |
159 | data = json.loads(json_data) | 160 | data = json.loads(json_data) |
160 | result = [] | 161 | result = [] |
161 | for game_id in game_id_list: | 162 | for game_id in game_id_list: |
163 | if isinstance(game_id, str) and not game_id.isdigit(): | ||
164 | result.append(game_id) | ||
165 | continue | ||
166 | name_set = False | ||
162 | for game in data: | 167 | for game in data: |
163 | if game['id'] == game_id: | 168 | if game['id'] == game_id: |
164 | result.append(game['name']) | 169 | result.append(game['name']) |
170 | name_set = True | ||
165 | return result | 171 | return result |
166 | 172 | ||
167 | def get_mention_status(mention): | 173 | def get_mention_status(mention): |
... | @@ -187,7 +193,7 @@ def check_msg_queue(): | ... | @@ -187,7 +193,7 @@ def check_msg_queue(): |
187 | data = {} | 193 | data = {} |
188 | if not data: | 194 | if not data: |
189 | data = {} | 195 | data = {} |
190 | print("Data: %s" % data) | 196 | #print("Data: %s" % data) |
191 | new_data = {} | 197 | new_data = {} |
192 | for username in data: | 198 | for username in data: |
193 | for author in data[username]: | 199 | for author in data[username]: |
... | @@ -215,7 +221,7 @@ def check_msg_queue(): | ... | @@ -215,7 +221,7 @@ def check_msg_queue(): |
215 | new_data[username][author] = data[username][author] | 221 | new_data[username][author] = data[username][author] |
216 | 222 | ||
217 | jdata = json.dumps(new_data, ensure_ascii=False) | 223 | jdata = json.dumps(new_data, ensure_ascii=False) |
218 | print("New Data: %s" % new_data) | 224 | #print("New Data: %s" % new_data) |
219 | open(deliveries_file, 'wb+').write(jdata.encode('utf8')) | 225 | open(deliveries_file, 'wb+').write(jdata.encode('utf8')) |
220 | return | 226 | return |
221 | 227 | ||
... | @@ -467,7 +473,7 @@ Stuff: | ... | @@ -467,7 +473,7 @@ Stuff: |
467 | for username in member_data: | 473 | for username in member_data: |
468 | if 'games_played' in member_data[username]: | 474 | if 'games_played' in member_data[username]: |
469 | for id in member_data[username]['games_played']: | 475 | for id in member_data[username]['games_played']: |
470 | if id == game_id: | 476 | if id == game_id or id == game_name: |
471 | matched_usernames.append(username) | 477 | matched_usernames.append(username) |
472 | client.send_message(message.channel, 'I have seen {} playing: {}'.format(', '.join(matched_usernames), game_name)) | 478 | client.send_message(message.channel, 'I have seen {} playing: {}'.format(', '.join(matched_usernames), game_name)) |
473 | 479 | ||
... | @@ -579,6 +585,9 @@ Stuff: | ... | @@ -579,6 +585,9 @@ Stuff: |
579 | 585 | ||
580 | if message.content.startswith('!question'): | 586 | if message.content.startswith('!question'): |
581 | question = message.content[10:] | 587 | question = message.content[10:] |
588 | if "is it gay" in question: | ||
589 | client.send_message(message.channel, 'Yes {}, it is gay.'.format(message.author.mention())) | ||
590 | return | ||
582 | res = wolf.query(question) | 591 | res = wolf.query(question) |
583 | try: | 592 | try: |
584 | if len(res.pods): | 593 | if len(res.pods): | ... | ... |
This diff is collapsed.
Click to expand it.
-
Please register or sign in to post a comment