make message parameter on intent handler optional
@@ -34,6 +34,8 @@ from mycroft.messagebus.message import Message
from mycroft.util.log import getLogger
from mycroft.skills.settings import SkillSettings
+from inspect import getargspec
+
__author__ = 'seanfitz'
skills_config = ConfigurationManager.instance().get("skills")
@@ -319,9 +321,19 @@ class MycroftSkill(object):
try:
if need_self:
# When registring from decorator self is required
+ if len(getargspec(handler).args) == 2:
handler(self, message)
+ elif len(getargspec(handler).args) == 1:
+ handler(self)
+ else:
+ raise TypeError
else:
+ if len(getargspec(handler).args) == 2:
handler(message)
+ elif len(getargspec(handler).args) == 1:
+ handler()
+ else:
+ raise TypeError
except:
# TODO: Localize
self.speak(
