backwards sync
@@ -19,15 +19,19 @@ class MessengerAgent(Agent):
super().__init__(opt)
self.manager = manager
self.id = messenger_psid
- self.disp_id = 'NewUser'
- self.task_id = task_id
+
+ self.acted_packets = {}
self.active = True
+ self.data = {}
+ self.disp_id = 'NewUser'
+ self.message_partners = []
self.message_request_time = None
- self.acted_packets = {}
- self.observed_packets = {}
self.msg_queue = Queue()
+ self.observed_packets = {}
+ self.page_id = page_id
+ self.task_id = task_id
+
self.stored_data = {}
- self.message_partners = []
# initialize stored data
self.set_stored_data()
@@ -82,6 +86,7 @@ class MessengerAgent(Agent):
'episode_done': False,
'text': text,
'id': self.disp_id,
+ 'sticker_sender': message.get('sticker_sender', None)
}
self.msg_queue.put(action)
@@ -130,6 +135,14 @@ class MessengerAgent(Agent):
self.message_request_time = None
return msg
+ def act_blocking(self, timeout=None):
+ """Repeatedly loop until we retrieve a message from the queue"""
+ while True:
+ msg = self.act(timeout=timeout)
+ if msg is not None:
+ return msg
+ time.sleep(0.2)
+
def episode_done(self):
"""Return whether or not this agent believes the conversation to
be done"""
