|
|
|
@ -113,7 +113,10 @@ class ChatManager: |
|
|
|
|
elif 'text' in data: |
|
|
|
|
return data['text'] |
|
|
|
|
elif 'with' in data: |
|
|
|
|
return '<{}> {}'.format(*[self.translate_chat(x) for x in data['with']]) |
|
|
|
|
if len(data['with']) >= 2: |
|
|
|
|
return '<{}> {}'.format(*[self.translate_chat(x) for x in data['with']]) |
|
|
|
|
else: |
|
|
|
|
return self.translate_chat(data['with'][0]) |
|
|
|
|
elif 'translate' in data: |
|
|
|
|
return data['translate'] |
|
|
|
|
else: |
|
|
|
@ -127,6 +130,7 @@ class ChatManager: |
|
|
|
|
print('[%s] %s'%(source, text)) |
|
|
|
|
except Exception as ex: |
|
|
|
|
print('Exception %r on message (%s): %s' % (ex, chat_packet.field_string('position'), chat_packet.json_data)) |
|
|
|
|
return |
|
|
|
|
|
|
|
|
|
if self.handler: |
|
|
|
|
self.handler((source, text)) |
|
|
|
|