Add send_email method to skills
parent
7ac43bd1e2
commit
0cf5c44f7c
|
@ -162,6 +162,13 @@ class DeviceApi(Api):
|
|||
"enclosureVersion": version.get("enclosureVersion")}
|
||||
})
|
||||
|
||||
def send_email(self, title, body, sender):
|
||||
return self.request({
|
||||
"method": "PUT",
|
||||
"path": "/" + self.identity.uuid + "/message",
|
||||
"json": {"title": title, "body": body, "sender": sender}
|
||||
})
|
||||
|
||||
def get(self):
|
||||
""" Retrieve all device information from the web backend """
|
||||
return self.request({
|
||||
|
|
|
@ -25,6 +25,7 @@ from adapt.intent import Intent, IntentBuilder
|
|||
from os import listdir
|
||||
from os.path import join, abspath, dirname, splitext, basename, exists
|
||||
|
||||
from mycroft.api import DeviceApi
|
||||
from mycroft.client.enclosure.api import EnclosureAPI
|
||||
from mycroft.configuration import Configuration
|
||||
from mycroft.dialog import DialogLoader
|
||||
|
@ -229,6 +230,7 @@ class MycroftSkill(object):
|
|||
self.config = self.config_core.get(self.name)
|
||||
self.dialog_renderer = None
|
||||
self.vocab_dir = None
|
||||
self.root_dir = None
|
||||
self.file_system = FileSystemAccess(join('skills', self.name))
|
||||
self.registered_intents = []
|
||||
self.log = LOG.create_logger(self.name)
|
||||
|
@ -324,6 +326,17 @@ class MycroftSkill(object):
|
|||
"""
|
||||
return False
|
||||
|
||||
def send_email(self, title, body):
|
||||
"""
|
||||
Send an email to the registered user's email
|
||||
|
||||
Args:
|
||||
title (str): Title of email
|
||||
body (str): HTML body of email. This supports
|
||||
simple HTML like bold and italics
|
||||
"""
|
||||
DeviceApi().send_email(title, body, basename(self.root_dir))
|
||||
|
||||
def make_active(self):
|
||||
"""
|
||||
Bump skill to active_skill list in intent_service
|
||||
|
@ -599,6 +612,7 @@ class MycroftSkill(object):
|
|||
self.init_dialog(root_directory)
|
||||
self.load_vocab_files(join(root_directory, 'vocab', self.lang))
|
||||
regex_path = join(root_directory, 'regex', self.lang)
|
||||
self.root_dir = root_directory
|
||||
if exists(regex_path):
|
||||
self.load_regex_files(regex_path)
|
||||
|
||||
|
|
Loading…
Reference in New Issue