コード例 #1
0
    def bot_send_attachment(self,
                            user_model,
                            file_url,
                            file_type,
                            keyboard=None):

        if file_type and file_type.startswith('image'):
            return self._service.send(user_model.conversation_id,
                                      Attachment.Image(file_url),
                                      quick_replies=keyboard)

        if file_type and file_type.startswith('video'):
            return self._service.send(user_model.conversation_id,
                                      Attachment.Video(file_url),
                                      quick_replies=keyboard)

        if file_type and file_type.startswith('audio'):
            return self._service.send(user_model.conversation_id,
                                      Attachment.Audio(file_url),
                                      quick_replies=keyboard)

        return self._service.send(user_model.conversation_id,
                                  Attachment.File(file_url),
                                  quick_replies=keyboard)
コード例 #2
0
def send_audio(recipient):
    page.send(recipient, Attachment.Audio(CONFIG['SERVER_URL'] + "/assets/sample.mp3"))