From 2ce11122c851eb68eb3461b759ae1a7f3b29a596 Mon Sep 17 00:00:00 2001 From: maike Date: Sun, 5 Jul 2020 23:49:32 +0200 Subject: [PATCH] [email] Started implementing bot.py --- kibicara/platforms/email/bot.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 kibicara/platforms/email/bot.py diff --git a/kibicara/platforms/email/bot.py b/kibicara/platforms/email/bot.py new file mode 100644 index 0000000..08a3bd9 --- /dev/null +++ b/kibicara/platforms/email/bot.py @@ -0,0 +1,27 @@ +# Copyright (C) 2020 by Maike +# +# SPDX-License-Identifier: 0BSD + +from kibicara.platforms.email.model import EmailRecipients, Email +from kibicara.platformapi import Censor, Spawner, Message +from logging import getLogger +import email +import datetime + +logger = getLogger(__name__) + + +class EmailBot(Censor): + def __init__(self, email_model): + super().__init__(email_model.hood) + self.model = email_model + self.messages = [] + + async def run(self): + while True: + message = await self.receive() + print("push " + message.text) + # send message to everyone in EmailRecipients(hood=self.hood) + + +spawner = Spawner(Email, EmailBot)