File size: 839 Bytes
63c0c36
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from environment import pushover_token, pushover_user
import requests

pushover_url = "https://api.pushover.net/1/messages.json"

class Pushover:
    # notify via pushover
    def __push(self, message):
        print(f"Push: {message}")
        payload = {"user": pushover_user, "token": pushover_token, "message": message}
        requests.post(pushover_url, data=payload)

    # tools to notify when user is exist on a prompt
    def record_user_details(self, email, name="Anonymous", notes="not provided"):
        self.__push(f"Recorded interest from {name} with email {email} and notes {notes}")
        return {"status": "ok"}


    # tools to notify when user not exist on a prompt
    def record_unknown_question(self, question):
        self.__push(f"Recorded '{question}' that couldn't answered")
        return {"status": "ok"}