示例#1
0
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
示例#2
0
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)
示例#3
0
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
示例#4
0
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
示例#5
0
def voice(bot, update):
    logging.debug("Received voice message")
    local_file_path = audio.saveVoice(bot, update.message)
    audio.playAudioFile(local_file_path)
示例#6
0
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
示例#7
0
def playAudio(bot, update):
    audio.playAudioFile('temp.wav')
示例#8
0
 def ringBuzzer(self):
     audio.playAudioFile(audio.BUZZER_AUDIO_FILE)
示例#9
0
 def openDoor(self):
     audio.playAudioFile(audio.AUTHORIZED_AUDIO_FILE)
     self.openDoorClient.sendOpenDoor()