in lex/__init__.py [0:0]
def get_user_input(self):
self.log.debug('Getting user_input for {}'.format(self.bot_name))
self.log.debug('Bot restart={}'.format(self.restart))
message = ""
if self.restart:
message = "How can I help you?"
self.log.debug('Restarting bot, message={}'.format(message))
if self.ice_breaker:
self.log.debug('Ice breaker: "{}"'.format(self.ice_breaker))
self.send_response(self.ice_breaker)
self.log.debug('Disabling restart flag')
self.restart = False
elif self.last_response and 'message' in self.last_response.keys():
message = self.last_response['message']
self.log.debug('Bot is running: {}'.format(message))
elif self.last_response and \
not self.is_fulfilled and not self.is_failed:
self.log.debug('Something happened')
message = "Something is wrong."
self.output(Message=message)
if self.no_audio:
self.text_response = raw_input('> ')
self.log.debug('Sending: {}'.format(self.text_response))
self.send_response(self.text_response)
else:
audio_file_path = self.listen()
self.send_response(audio_file_path)
os.remove(audio_file_path)
self.last_message = message