33 lines
No EOL
732 B
Python
33 lines
No EOL
732 B
Python
# schemes.py
|
|
|
|
|
|
class Schemes:
|
|
|
|
def handle_intent(self, intent):
|
|
print(f"Handling {intent.name}.")
|
|
|
|
# Set the service.
|
|
self.service = intent.name
|
|
|
|
# Run intent endpoint.
|
|
if intent.name == "init":
|
|
self.init(intent)
|
|
|
|
if intent.name == "message":
|
|
self.message(intent)
|
|
|
|
# Init session by setting Crimata ID.
|
|
def init(self, intent):
|
|
self.crimata_id = intent.params.get("crimata_id")
|
|
print(f"Initalized for {self.crimata_id}")
|
|
|
|
# Push message to anoter Crimata ID.
|
|
#! Push message to backend.
|
|
def message(self, intent):
|
|
text = intent.params.get("text")
|
|
target = intent.params.get("target") #crimata_id
|
|
|
|
print(f"Messaging {target}: '{text}'")
|
|
|
|
# Uses mail.Mail interface.
|
|
self.mailbox_send(intent) |