JarvisAPI(self, jarvis)
Jarvis interface for plugins.
Plugins will receive a instance of this as the second (non-self) parameter of the exec()-method.
Everything Jarvis-related that can't be implemented as a stateless-function in the utilities-package should be implemented here.
JarvisAPI.say(self, text, color='', speak=True)
This method give the jarvis the ability to print a text and talk when sound is enable. :param text: the text to print (or talk) :param color: for text - use colorama (https://pypi.org/project/colorama/) e.g. Fore.BLUE :param speak: False, if text shouldn't be spoken even if speech is enabled
JarvisAPI.input(self, prompt='', color='')
Get user input
JarvisAPI.input_number(self, prompt='', color='', rtype=<class 'float'>, rmin=None, rmax=None)
Get user input: As number.
Guaranteed only returns number - ask user till correct number entered.
:param prompt: Printed to console :param color: Color of prompot :param rtype: type of return value; e.g. float (default) or int :param rmin: Minum of values returned :param rmax: Maximum of values returned
JarvisAPI.connection_error(self)
Print generic connection error
JarvisAPI.exit(self)
Immediately exit Jarvis
JarvisAPI.notification(self, msg, time_seconds=0)
Sends notification msg in time_in milliseconds :param msg: Message. Either String (message body) or tuple (headline, message body) :param time_seconds: Time in seconds to wait before showing notification
JarvisAPI.schedule(self, time_seconds, function, *args)
Schedules function After time_seconds call function with these parameter:
- reference to this JarvisAPI instance
- schedule_id (return value of this function)
- *args :return: integer, id - use with cancel
JarvisAPI.cancel(self, schedule_id)
Cancel event scheduled with schedule :param schedule_id: id returned by schedule
JarvisAPI.enable_voice(self)
Use text to speech for every text passed to jarvis.say()
JarvisAPI.disable_voice(self)
Stop text to speech output for every text passed to jarvis.say()
JarvisAPI.is_voice_enabled(self)
Returns True/False if voice is enabled/disabled with enable_voice or disable_voice Default: False (disabled)
JarvisAPI.get_data(self, key)
Get a specific key from memory
JarvisAPI.add_data(self, key, value)
Add a key and value to memory
JarvisAPI.update_data(self, key, value)
Updates a key with supplied value.
JarvisAPI.del_data(self, key)
Delete a key from memory
JarvisAPI.eval(self, s)
Simulates typing 's' in Jarvis prompt