db
This commit is contained in:
parent
db2e6c4f15
commit
f583352e42
10 changed files with 47 additions and 12 deletions
8
mail.py
8
mail.py
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue