This commit is contained in:
Andrew Gundersen 2020-12-21 12:00:32 -06:00
commit f583352e42
10 changed files with 47 additions and 12 deletions

View file

@ -20,25 +20,25 @@ class Mail:
return intent
# Send intent.
def mailbox_send(self, jpackage):
async def mailbox_send(self, jpackage):
mail = self.__encode(jpackage)
print(f"Putting message into outbox {self.crimata_id}")
mailroom.put_mail(self.crimata_id, mail)
await self.send(1) # agent confirmation.
def __encode(self, jpackage) -> typs.Mail:
j = jpackage
owner = self.crimata_id
target = j.get("target")
print(target)
text = j.get("text")
audio = j.get("audio")
mail = typs.Mail(owner, target, text, audio)
return mail
@staticmethod
def __decode(mail: typs.Mail):
def __decode(self, mail: typs.Mail):
jpackage = {
"owner": mail.owner,
"target": self.crimata_id,
"text": mail.text, #dev only
"audio": mail.audio
}