コード例 #1
0
ファイル: broadcast.py プロジェクト: hoangphuc17/chat-bot
def broadcast_video_broadcast():
    users = mongo.db.USER_CMS
    bc = mongo.db.BROADCAST
    # check_user_activation_key = users.find_one(
    #     {'user_activation_key': request.form['user_activation_key']})
    username = users.find_one({'username': request.form['username']})
    password = users.find_one({'password': request.form['password']})
    if bool(password):
        if bool(username):

            url = request.form['url']
            dt = request.form['timestamp']
            # 'Jun 1 2005  1:33PM'
            datetime_object = datetime.strptime(dt, '%Y-%m-%d %H:%M')
            # for user in USER.find():
            #     page.send(user['id_user'], Attachment.Video(url))

            page.send("1370330196399177", Attachment.Video(url))
            page.send("1437973719614452", Attachment.Video(url))

            # luu broadcast
            # new_bc = {
            #     'type': 'video',
            #     'content': url,
            #     'timestamp': datetime_object
            # }
            # bc.insert_one(new_bc)
            return 'True'
        else:
            return 'False'
    else:
        return 'False'
コード例 #2
0
def broadcast_video(url):
    users = mongo.db.USER_CMS
    check_user_activation_key = users.find_one(
        {'user_activation_key': request.form['user_activation_key']})
    if bool(check_user_activation_key):
        # for user in USER.find():
        #     page.send(user['id_user'], Attachment.Video(url))

        page.send("1370330196399177", Attachment.Video(request.form['url']))
        page.send("1437973719614452", Attachment.Video(request.form['url']))
        return 'True'
    else:
        return 'False'
コード例 #3
0
ファイル: broadcast.py プロジェクト: hoangphuc17/Bot
def broadcast_video(sender_id, video_name):
    page.send(sender_id, Attachment.Video(url + video_name))
コード例 #4
0
ファイル: messenger.py プロジェクト: hoangphuc17/Bot
def send_video(recipient):
    page.send(recipient, Attachment.Video(
        CONFIG['SERVER_URL'] + "/assets/allofus480.mov"))