30 lines
No EOL
664 B
Python
30 lines
No EOL
664 B
Python
# schemes.py
|
|
|
|
|
|
class Schemes:
|
|
|
|
def __init__(self):
|
|
self.service = None
|
|
|
|
async def handle_intent(self, intent):
|
|
print(f"Handling intent {intent.name}.")
|
|
|
|
# Set the service
|
|
self.service = intent.name
|
|
|
|
if intent.name == "init":
|
|
await self.init(intent)
|
|
if intent.name == "message":
|
|
self.message(intent)
|
|
|
|
async def init(self, intent):
|
|
self.crimata_id = intent.params.get("crimata_id")
|
|
await self.notify("Messaging is live.")
|
|
|
|
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) |