[email] Started implementing bot.py

This commit is contained in:
maike 2020-07-05 23:49:32 +02:00 committed by dl6tom
parent e24a0f8738
commit 2ce11122c8

View file

@ -0,0 +1,27 @@
# Copyright (C) 2020 by Maike <maike@systemli.org>
#
# 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)