Validate message before trying to demunge (#1427)
The data field of the message sent to the event handler may not always be a dictionary, (Example case Timer skill, which sets data to the timer name) This validates the message type and the type of the data field before trying to unmunge.pull/1428/head
parent
ead38602cb
commit
b4c6f63352
|
@ -69,9 +69,11 @@ def unmunge_message(message, skill_id):
|
|||
Returns:
|
||||
Message without clear keywords
|
||||
"""
|
||||
for key in message.data:
|
||||
new_key = key.replace(to_letters(skill_id), '')
|
||||
message.data[new_key] = message.data.pop(key)
|
||||
if isinstance(message, Message) and isinstance(message.data, dict):
|
||||
for key in message.data:
|
||||
new_key = key.replace(to_letters(skill_id), '')
|
||||
message.data[new_key] = message.data.pop(key)
|
||||
|
||||
return message
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue