mirror of
https://github.com/avatao-content/baseimage-tutorial-framework
synced 2024-12-23 03:41:55 +00:00
Remove Cenator :'( sorry to see you go
This commit is contained in:
parent
3caf170c7d
commit
3e0592c176
@ -1,18 +1,7 @@
|
||||
from itertools import cycle
|
||||
|
||||
from tfw.networking.serialization import deserialize_all
|
||||
from tfw.networking.event_handlers.server_connector import ServerConnector
|
||||
|
||||
|
||||
def cenator():
|
||||
yield from [
|
||||
'**Your time is up**',
|
||||
'`My time is now`',
|
||||
'_You can\'t see me_',
|
||||
'My time is now'
|
||||
]
|
||||
|
||||
|
||||
class EventHandlerBase:
|
||||
def __init__(self, key):
|
||||
self.server_connector = ServerConnector()
|
||||
@ -21,13 +10,9 @@ class EventHandlerBase:
|
||||
self.subscribe(self.key)
|
||||
self.subscribe('reset')
|
||||
self.server_connector.register_callback(self.event_handler_callback)
|
||||
self.cenerator = cycle(cenator())
|
||||
|
||||
def event_handler_callback(self, msg_parts):
|
||||
key, message = deserialize_all(*msg_parts)
|
||||
from .message_sender import MessageSender
|
||||
ms = MessageSender()
|
||||
ms.send('avataobot', next(self.cenerator))
|
||||
response = self.dispatch_handling(key, message)
|
||||
if response is None: return
|
||||
self.server_connector.send(key, response)
|
||||
|
Loading…
Reference in New Issue
Block a user