[email] Started implementing bot.py
This commit is contained in:
parent
e24a0f8738
commit
2ce11122c8
27
kibicara/platforms/email/bot.py
Normal file
27
kibicara/platforms/email/bot.py
Normal 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)
|
Loading…
Reference in a new issue