Copy message context on reply
This ensures that the original context isn't modified, for example when
converse is used the reply there would switch the source/destination for
the original message making the skill speak to the wrong destination.
@@ -16,6 +16,7 @@ import json
import re
import inspect
from mycroft.util.parse import normalize
+from copy import deepcopy
class Message:
@@ -111,10 +112,10 @@ class Message:
Returns:
Message: Message object to be used on the reply to the message
"""
- data = data or {}
+ data = deepcopy(data) or {}
context = context or {}
- new_context = self.context
+ new_context = deepcopy(self.context)
for key in context:
new_context[key] = context[key]
if 'destination' in data:
