You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
900 B
Python
39 lines
900 B
Python
import requests
|
|
|
|
if __name__ == '__main__':
|
|
from skill import Skill
|
|
from config import ntfy_url
|
|
else:
|
|
from skills.skill import Skill
|
|
from skills.config import ntfy_url
|
|
|
|
|
|
class Phone(Skill):
|
|
def __init__(self):
|
|
self.trigger_phrase = "phone"
|
|
|
|
def _send_to_phone(self, name, number):
|
|
r = requests.post(f"https://ntfy.sh/{ntfy_url}",
|
|
data=f" ",
|
|
headers={
|
|
"Title": f"Phone {name}",
|
|
"Priority": "default",
|
|
"Tags": "iphone",
|
|
"Click": f"tel://{number}"
|
|
})
|
|
return r
|
|
|
|
def parse_phone_string(self, text):
|
|
return ["name", "111-222-3333"]
|
|
#Todo: parse out phone number from icloud contacts (maybe google contacts? depending on where its stored)
|
|
|
|
|
|
def phone_call(self, text):
|
|
parsed_output = self.parse_phone_string(text)
|
|
self._send_to_phone(parsed_output[0], parsed_output[1])
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
p = Phone()
|
|
p._send_to_phone("Trav", "4169074987") |