コード例 #1
0
 def waitAnswer(self):
     time = '[' + str(now()) + ']'
     print(c.green(time), self.info(), '| waiting answer')
     response = self.queue[TypeQ.MSG_RECEIVER].get(block=True)
     print(c.green(time), self.info(), '| response: ',
           c.orange(msg.readText(response)))
     return response
コード例 #2
0
 def __init__(self, user, queue):
     Thread.__init__(self)
     self.user = user
     self.entityName = self.__class__.__name__
     self.daemon = True
     self.timeStart = now()
     time = '[' + str(self.timeStart) + ']'
     print(c.green(time), ' Start ', self.info())
     if queue:
         self.queue = queue
     else:
         self.queue = {
             TypeQ.MSG_SENDER: Queue(),
             TypeQ.MSG_RECEIVER: Queue(),
             TypeQ.SWITCH_CONVERSATION: Queue()
         }
コード例 #3
0
 def sendTextWithKeyboard(self, text, buttonList):
     self.addMessageToSenderQ(
         msg.createKeyboardMessage(self.user['id'], text, buttonList))
     time = '[' + str(now()) + ']'
     print(c.green(time), self.info(), '| sent: ', c.light_blue(text))
     return self.waitAnswer()
コード例 #4
0
 def sendText(self, text):
     self.addMessageToSenderQ(msg.createTextMessage(self.user['id'], text))
     time = '[' + str(now()) + ']'
     print(c.green(time), self.info(), '| sent: ', c.light_blue(text))
コード例 #5
0
 def __del__(self):
     self.timeEnd = now()
     time = '[' + str(self.timeEnd) + ']'
     print(c.orange(time), ' End ', self.info(), '| DT: ',
           delta(self.timeStart, self.timeEnd))