def basic_response(bot, update): file = speech_recognition.transformToAudio(update.message.text) if file: audio.playAudioFile('temp.wav') update.message.reply_text('Entrance denied and message sent', reply_markup=main_menu) return ConversationHandler.END
def voiceSenderTester(bot, update): file = speech_recognition.transformToAudio("Say your message") if file: audio.playAudioFile(file) # if file: # update.message.reply_text('', reply_markup=main_menu) file = audio.recordVoice() sendVoiceToChat(bot, update, file) file = speech_recognition.transformToAudio("Stop talking") if file: audio.playAudioFile(file)
def talk(bot, update): file = speech_recognition.transformToAudio(update.message.text) if file: update.message.reply_text('Your message was successfully transmitted.', reply_markup=main_menu) audio.playAudioFile('temp.wav') else: update.message.reply_text( 'There has been a problem with your message.', reply_markup=main_menu) return ConversationHandler.END
def verify(bot, update): photo_file = bot.getFile(update.message.photo[-1].file_id) path = 'candidate.jpg' photo_file.download(path) file_stream = open(path, "rb").read() verified_name = face_recognition.verify_face(file_stream) text = '%s is knocking on the door!' % verified_name if verified_name is None: text = 'Some stranger is knocking on the door. Do you want to let him in?' else: audio.playAudioFile(audio.BUZZER_AUDIO_FILE) update.message.reply_text(text, reply_markup=door_menu) return READY
def voice(bot, update): logging.debug("Received voice message") local_file_path = audio.saveVoice(bot, update.message) audio.playAudioFile(local_file_path)
def hold_the_door(bot, update): audio.playAudioFile(audio.NOT_PERMITTED_AUDIO_FILE) update.message.reply_text('Entrance denied', reply_markup=main_menu) return ConversationHandler.END
def playAudio(bot, update): audio.playAudioFile('temp.wav')
def ringBuzzer(self): audio.playAudioFile(audio.BUZZER_AUDIO_FILE)
def openDoor(self): audio.playAudioFile(audio.AUTHORIZED_AUDIO_FILE) self.openDoorClient.sendOpenDoor()