Validate message before trying to demunge
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.
@@ -69,9 +69,11 @@ def unmunge_message(message, skill_id):
Returns:
Message without clear keywords
"""
+ 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
