Esempio n. 1
0
def svtv_handle_subscribe(sender_id, quick_reply_payload):
    if quick_reply_payload == 'no':
        text = "Okey. Bất cứ khi nào bạn cần đăng ký nhận tin tức thì quay lại đây nhé!"
        buttons = [
            Template.ButtonPostBack("HOME", "svtv_home")
        ]
        svtv.send(sender_id, Template.Buttons(text, buttons))

        user = CUSTOMER.find_one({'id_user': sender_id})
        new_script = {
            'upload_status': user['SCRIPT']['upload_status'],
            'subscribe': quick_reply_payload
        }
        CUSTOMER.update_one(
            {'id_user': sender_id},
            {'$set': {'SCRIPT': new_script}}
        )
    else:
        text = "Bạn đã đăng ký nhận thông báo thành công.\nMỗi khi có thông báo mới về chương trình, mình sẽ gửi tới bạn."
        buttons = [
            Template.ButtonPostBack("HOME", "svtv_home")
        ]
        svtv.send(sender_id, Template.Buttons(text, buttons))

        user = CUSTOMER.find_one({'id_user': sender_id})
        new_script = {
            'upload_status': user['SCRIPT']['upload_status'],
            'subscribe': quick_reply_payload
        }
        CUSTOMER.update_one(
            {'id_user': sender_id},
            {'$set': {'SCRIPT': new_script}}
        )
Esempio n. 2
0
def ttb_handle_subscribe(sender_id, quick_reply_payload):
    if quick_reply_payload == 'no':
        text = "Okey. Bất cứ khi nào bạn cần đăng ký nhận tin tức thì quay lại đây nhé!"
        buttons = [Template.ButtonPostBack("Home", "ttb_home")]

        ttb.send(sender_id, Template.Buttons(text, buttons))
        CUSTOMER.update_one(
            {'id_user': sender_id},
            {'$set': {
                'SCRIPT': {
                    'subscribe': quick_reply_payload
                }
            }})
    else:
        text = "Bạn đã đăng ký nhận thông báo thành công.\nMỗi khi có thông báo mới về chương trình, mình sẽ gửi tới bạn."
        buttons = [Template.ButtonPostBack("Home", "ttb_home")]

        ttb.send(sender_id, Template.Buttons(text, buttons))
        CUSTOMER.update_one(
            {'id_user': sender_id},
            {'$set': {
                'SCRIPT': {
                    'subscribe': quick_reply_payload
                }
            }})
Esempio n. 3
0
def ghvn_image_fs(sender_id, sizeFont, hlv, first, last, x_Text, y_Text):
    userName = last + ' ' + first
    font = ImageFont.truetype(
        "./resource/font_fansign/ghvn/font_fansign.ttf", sizeFont)
    imageFile = "./resource/image/ghvn/fansign/" + hlv + ".jpg"
    im = Image.open(imageFile)
    draw = ImageDraw.Draw(im)
    draw.text((x_Text, y_Text), userName, (0, 0, 0), font=font)
    draw = ImageDraw.Draw(im)
    name_fansigned = "/home/hoangphuc/Bot_Pictures/fs_" + hlv + \
        sender_id + ".jpg"
    im.save(name_fansigned)

    hlv_dict = {
        'sb': 'Soobin',
        'vct': 'Vũ Cát Tường',
        'ht': 'Hương Tràm',
        'tc': 'Tiên Cookie'
    }

    text1 = hlv_dict.get(
        hlv) + " đang viết lời chúc dành cho bạn. " + userName + " chờ xíu nhé 😉"
    ghvn.send(sender_id, text1)

    ghvn.send(sender_id, Attachment.Image(
        "http://210.211.109.211/weqbfyretnccbsaf/fs_" + hlv + sender_id + ".jpg"))
    text2 = 'Phía trên là hình fansign của ' + \
        hlv_dict.get(
            hlv) + ' dành riêng cho bạn. Hãy chia sẻ món quà này ngay kèm hashtag #gionghatvietnhifansign nha bạn ơi'
    buttons = [
        Template.ButtonPostBack("Fansign khác", "fansign"),
        Template.ButtonPostBack("Home", "ghvn_home")
    ]
    ghvn.send(sender_id, Template.Buttons(text2, buttons))
    print('da gui hinh fansign')
Esempio n. 4
0
def svtv_ads(sender_id):
    text = 'Liên hệ hợp tác quảng cáo & xuất bản nội dung: [email protected]\nhoặc Hotline: 097.674.6263 (Mr Dương).'
    buttons = [
        Template.ButtonPostBack(
            "Home", "svtv_home")
    ]
    svtv.send(sender_id, Template.Buttons(text, buttons))
Esempio n. 5
0
def svtv_default_message(sender_id):
    text = 'Chào bạn! Sinh Viên TV có thể giúp gì cho bạn?'
    buttons = [
        Template.ButtonPostBack(
            "HOME", "svtv_home")
    ]
    svtv.send(sender_id, Template.Buttons(text, buttons))
Esempio n. 6
0
def ghvn_minigame2_rule(sender_id):
    text = "- Mỗi bạn tham gia được dự đoán không giới hạn ‘Từ khóa’ may mắn để nhận được trọn bộ Sticker hình vẽ HLV Giọng Hát Việt Nhí 2017.\n- ‘Từ khóa’ có thể gồm 1 từ hoặc 1 cụm từ miêu tả gần giống với các HLV nhất.\n- Nếu dự đoán đúng từ khóa. Bạn sẽ nhận được những Sticker ‘Siêu Đáng Yêu’.\nNgại gì không thử??\n\n👉👉👉 “Giọng Hát Việt Nhí” 2017 sẽ chính thức được phát sóng vào lúc 21h10 thứ 7 hằng tuần (từ ngày 12/8/2017) trên kênh VTV3"
    buttons = [
        Template.ButtonPostBack("Home", "ghvn_home")
    ]
    ghvn.send(sender_id, Template.Buttons(text, buttons))
    return
Esempio n. 7
0
def svtv_menu_upload(sender_id):
    # text = 'nhấn chọn nút ở dưới để bắt đầu quy trình upload'
    text = 'Chào bạn, bạn muốn đóng góp nội dung gì cho Sinh Viên TV? Chọn nút bên dưới để bắt đầu Upload'
    buttons = [
        Template.ButtonPostBack(
            "Upload", "svtv_implement_upload")
    ]
    svtv.send(sender_id, Template.Buttons(text, buttons))
Esempio n. 8
0
def ghvn_introduce(sender_id):
    text = "Đến hẹn lại lên, 'Giọng Hát Việt Nhí' đã trở lại và lợi hại hơn bao giờ hết. Với dàn huấn luyện viên là những nghệ sỹ trẻ nổi tiếng tài năng và sở hữu lượng fan hùng hậu nhất nhì làng giải trí Việt. Đó là cặp đôi Hương Tràm –Tiên Cookie, ca sĩ – nhạc sĩ Vũ Cát Tường, ca sĩ Soobin Hoàng Sơn. Họ hứa hẹn sẽ mang đến cho Giọng Hát Việt Nhí mùa 5 nhiều điều thú vị với độ cạnh tranh, “chặt chém” quyết liệt trên ghế nóng.\n📣📣📣 21h10 thứ 7 hằng tuần trên kênh VTV3 - Giọng Hát Việt Nhí 2017 với những bất ngờ đang chờ bạn khám phá!"
    buttons = [
        Template.ButtonPostBack("Home", "ghvn_home")
    ]

    ghvn.send(sender_id, Template.Buttons(text, buttons))
    return
Esempio n. 9
0
def ghvn_minigame2_handle_result(message, sender_id):
    message = message.lower()
    huong_tram = ["đỉnh", "xinh", "bánh bèo"]
    vu_cat_tuong = ["chất", "cá tính", "phũ"]
    soobin = ["đẹp trai", "ế", "cao"]
    tien_cookie = ["hit", "cute", "nhọ"]
    if message in huong_tram:
        game2_hlv_url = "http://210.211.109.211/weqbfyretnccbsaf/game2_huongtram.jpg"
        ghvn.send(sender_id, Attachment.Image(game2_hlv_url))
        text = "Chính xác!!!!!!!!"
        buttons = [
            Template.ButtonPostBack(
                "Đoán thêm lần nữa 😻", "ghvn_minigame2_menu"),
            Template.ButtonPostBack("Home", "ghvn_home")
        ]
        ghvn.send(sender_id, Template.Buttons(text, buttons))
    elif message in vu_cat_tuong:
        game2_hlv_url = "http://210.211.109.211/weqbfyretnccbsaf/game2_vucattuong.jpg"
        ghvn.send(sender_id, Attachment.Image(game2_hlv_url))
        text = "Chính xác!!!!!!!!"
        buttons = [
            Template.ButtonPostBack(
                "Đoán thêm lần nữa 😻", "ghvn_minigame2_menu"),
            Template.ButtonPostBack("Home", "ghvn_home")
        ]
        ghvn.send(sender_id, Template.Buttons(text, buttons))
    elif message in soobin:
        game2_hlv_url = "http://210.211.109.211/weqbfyretnccbsaf/game2_soobin.jpg"
        ghvn.send(sender_id, Attachment.Image(game2_hlv_url))
        text = "Chính xác!!!!!!!!"
        buttons = [
            Template.ButtonPostBack(
                "Đoán thêm lần nữa 😻", "ghvn_minigame2_menu"),
            Template.ButtonPostBack("Home", "ghvn_home")
        ]
        ghvn.send(sender_id, Template.Buttons(text, buttons))
    elif message in tien_cookie:
        game2_hlv_url = "http://210.211.109.211/weqbfyretnccbsaf/game2_tiencookie.jpg"
        ghvn.send(sender_id, Attachment.Image(game2_hlv_url))
        text = "Chính xác!!!!!!!!"
        buttons = [
            Template.ButtonPostBack(
                "Đoán thêm lần nữa 😻", "ghvn_minigame2_menu"),
            Template.ButtonPostBack("Home", "ghvn_home")
        ]
        ghvn.send(sender_id, Template.Buttons(text, buttons))
Esempio n. 10
0
def ghvn_timeline(sender_id):
    text = "📣📣📣 Chương trình “Giọng Hát Việt Nhí” 2017 sẽ được phát sóng vào lúc 9h10 tối thứ 7 hằng tuần từ (ngày 12/08/2017) trên kênh VTV3"
    buttons = [
        Template.ButtonPostBack("Home", "ghvn_home")
    ]

    ghvn.send(sender_id, Template.Buttons(text, buttons))
    return
Esempio n. 11
0
def cbtest_greeting(sender_id):
    user_profile = cbtest.get_user_profile(sender_id)
    first = user_profile["first_name"]
    last = user_profile["last_name"]

    check_customer_by_id('cbtest', sender_id)
    print(sender_id)
    text = 'chao'
    buttons = [Template.ButtonPostBack("Home", "cbtest_home")]
    cbtest.send(sender_id, Template.Buttons(text, buttons))
Esempio n. 12
0
def ghvn_minigame1(sender_id):
    text = "Minigame 1:\n   Dự đoán đội quán quân"
    buttons = [
        Template.ButtonPostBack(
            "Tham gia dự đoán 👍", "ghvn_minigame1_menu"),
        Template.ButtonPostBack(
            "Thể lệ dự đoán 📜", "ghvn_minigame1_rule")
    ]
    ghvn.send(sender_id, Template.Buttons(text, buttons))
    return
Esempio n. 13
0
def ghvn_minigame2(sender_id):
    text = "Minigame 2:\n   Đoán từ khóa nhận Sticker"
    buttons = [
        Template.ButtonPostBack(
            "Tham gia dự đoán 👍", "ghvn_minigame2_menu"),
        Template.ButtonPostBack(
            "Thể lệ dự đoán 📜", "ghvn_minigame2_rule")
    ]

    ghvn.send(sender_id, Template.Buttons(text, buttons))
    return
Esempio n. 14
0
def saostar_greeting(sender_id):
    user_profile = saostar.get_user_profile(sender_id)
    first = user_profile["first_name"]
    last = user_profile["last_name"]

    check_customer_by_id('saostar', sender_id)
    print(sender_id)
    text = 'Chào ' + first + ' ' + last + \
        '. Nhấn nút home bên dưới để tìm hiểu các tính năng Saostar có nhé'
    buttons = [Template.ButtonPostBack("HOME", "saostar_home")]
    saostar.send(sender_id, Template.Buttons(text, buttons))
Esempio n. 15
0
def saostar_upload_success_continue(chatbot, sender_id, attachment_link):
    # check upload status
    # save hình đó lại
    # hiển thị thông báo đã upload thành công
    # hỏi upload tiếp tục không
    cus = CUSTOMER.find_one({'id_user': sender_id})
    if bool(cus):
        if cus['SCRIPT']['upload_status'] == 'on':
            save_attachments(chatbot, sender_id, attachment_link)
            text = 'Cảm ơn bạn đã đóng góp cho Saostar nhé!'
            buttons = [Template.ButtonPostBack("HOME", "saostar_home")]
            saostar.send(sender_id, Template.Buttons(text, buttons))
Esempio n. 16
0
def cdhh_vote_handler(sender_id, quickreply):
    space = " "
    a = "Bạn đã dự đoán thành công. Dự đoán của bạn đang dành cho"
    seq = (a, quickreply)
    text = space.join(seq)
    buttons = [
        Template.ButtonPostBack("Bình chọn lại", "cdhh_vote_menu"),
        Template.ButtonPostBack("Home", "cdhh_home")
    ]
    cdhh.send(sender_id, Template.Buttons(text, buttons))

    USER.update_one({'id_user': sender_id}, {'$set': {'vote': quickreply}})
Esempio n. 17
0
def ttb_greeting(sender_id):
    user_profile = ttb.get_user_profile(sender_id)
    first = user_profile["first_name"]
    last = user_profile["last_name"]

    check_customer_by_id('ttb', sender_id)

    space = " "
    a = "Chào"
    b = "đã đến với Chatbot Thần Tượng Bolero 2018. Tại đây, các bạn có thể đặt câu hỏi, chơi Mini game và theo dõi những tin tức 'nóng' nhất từ chương trình. Còn chần chừ gì mà không bắt đầu cuộc 'trò chuyện thân mật' ngay nào !!! ;) ;)\n⏩ Quay về tính năng chính bằng cách ấn phím 'Home' hoặc gõ vào chữ 'Home' hoặc 'Menu'👇\n⏩ Chương trình Thần Tượng Bolero 2018 sẽ được phát sóng vào lúc 20h30 thứ 5 hằng tuần trên kênh VTV3 bắt đầu từ ngày 25.1.2018"
    seq = (a, last, first, b)
    text = space.join(seq)
    buttons = [Template.ButtonPostBack("Home", "ttb_home")]
    ttb.send(sender_id, Template.Buttons(text, buttons))
Esempio n. 18
0
def ghvn_handle_subscribe_news(sender_id, quick_reply_payload):
    if quick_reply_payload == 'no':
        text = "Okey. Bất cứ khi nào bạn cần đăng ký nhận tin tức thì quay lại đây nhé!"
        buttons = [
            Template.ButtonPostBack("Home", "ghvn_home")
        ]

        ghvn.send(sender_id, Template.Buttons(text, buttons))
        USER.update_one(
            {'id_user': sender_id},
            {'$set': {'subscribe_news': quick_reply_payload}}
        )
    else:
        text = "Bạn đã đăng ký nhận thông báo thành công.\nMỗi khi có thông báo mới về chương trình The Voice Kid 2017, mình sẽ gửi tới bạn."
        buttons = [
            Template.ButtonPostBack("Home", "ghvn_home")
        ]

        ghvn.send(sender_id, Template.Buttons(text, buttons))
        USER.update_one(
            {'id_user': sender_id},
            {'$set': {'subscribe_news': quick_reply_payload}}
        )
Esempio n. 19
0
def ghvn_greeting(sender_id):
    user_profile = ghvn.get_user_profile(sender_id)
    first = user_profile["first_name"]
    last = user_profile["last_name"]
    check_customer_by_id('ghvn', sender_id)
    space = " "
    a = "Chào"
    b = "đến với Giọng Hát Việt Nhí. Tại đây, bạn có thể đặt câu hỏi, chơi Mini game và theo dõi những tin tức “nóng hổi” nhất từ chương trình. Còn chần chừ gì mà không bắt đầu cuộc “trò chuyện thân mật” ngay nào !!! ;) ;)\n⏩⏩⏩ Quay về tính năng chính bằng cách ấn phím “Home” hoặc gõ vào chữ “Home” hoặc “Menu” 👇\n⏩⏩⏩ Chương trình “Giọng Hát Việt Nhí” 2017 sẽ được phát sóng vào lúc 21h10 thứ 7 hằng tuần trên kênh VTV3📺 "
    seq = (a, last, first, b)
    text = space.join(seq)
    buttons = [
        Template.ButtonPostBack(
            "Home", "ghvn_home")
    ]
    ghvn.send(sender_id, Template.Buttons(text, buttons))
Esempio n. 20
0
def cdhh_greeting(sender_id):
    user_profile = cdhh.get_user_profile(sender_id)
    first = user_profile["first_name"]
    last = user_profile["last_name"]
    # gender = user_profile["gender"]

    check_customer_by_id('cdhh', sender_id)

    space = " "
    a = "Chào"
    b = "đến với Cặp Đôi Hoàn Hảo - Trữ Tình & Bolero.\nMình là LERO, rất vui được gặp bạn. Bạn có thể cùng mình cập nhật thông tin về chương trình một cách nhanh nhất. Cùng khám phá nào! 👇👇"
    seq = (a, last, first, b)
    text = space.join(seq)
    buttons = [Template.ButtonPostBack("Home", "cdhh_home")]
    cdhh.send(sender_id, Template.Buttons(text, buttons))
Esempio n. 21
0
def ghvn_minigame1_handle_quick_reply(sender_id, quick_reply_payload):
    hinh_hlv = "http://210.211.109.211/weqbfyretnccbsaf/" + \
        danh_sach_hinh_anh_HLV[quick_reply_payload]
    ghvn.send(sender_id, Attachment.Image(hinh_hlv))

    space = " "
    a = "Bạn đã dự đoán dự đoán thành công đội có thí sinh đạt được vị trí cao nhất của chương trình. Dự đoán của bạn đang dành cho team của"
    seq = (a, quick_reply_payload)
    text = space.join(seq)
    buttons = [
        Template.ButtonPostBack("Bình chọn lại", "ghvn_minigame1_vote"),
        Template.ButtonPostBack("Home", "ghvn_home")
    ]
    ghvn.send(sender_id, Template.Buttons(text, buttons))

    USER.update_one(
        {'id_user': sender_id},
        {'$set': {'HLV_da_binh_chon': quick_reply_payload}}
    )
Esempio n. 22
0
def cdhh_vote(sender_id):
    check_vote = USER.find_one({'id_user': sender_id})

    if check_vote['vote'] == '':
        # user chua binh chon
        cdhh_vote_menu(sender_id)
    else:
        # user da binh chon
        space = " "
        a = "Bạn đã dự đoán thành công. Dự đoán của bạn đang dành cho"
        b = check_vote["vote"]
        seq = (a, b)
        text = space.join(seq)

        buttons = [
            Template.ButtonPostBack("Bình chọn lại", "vote_menu"),
            Template.ButtonPostBack("Home", "home")
        ]

        cdhh.send(sender_id, Template.Buttons(text, buttons))
Esempio n. 23
0
def ghvn_minigame1_menu(sender_id):
    check_vote = USER.find_one({'id_user': sender_id})

    if check_vote["HLV_da_binh_chon"] == "":
        # user chua binh chon
        ghvn_minigame1_vote(sender_id)
    else:
        # user da binh chon
        space = " "
        a = "Bạn đã dự đoán dự đoán thành công đội có thí sinh đạt được vị trí cao nhất của chương trình. Dự đoán của bạn đang dành cho team của"
        # a = a.decode('utf-8')
        b = check_vote["HLV_da_binh_chon"]
        seq = (a, b)
        text = space.join(seq)

        buttons = [
            Template.ButtonPostBack("Bình chọn lại", "ghvn_minigame1_vote"),
            Template.ButtonPostBack("Home", "ghvn_home")
        ]

        ghvn.send(sender_id, Template.Buttons(text, buttons))
    return
Esempio n. 24
0
def cbtest_menu_upload(sender_id):
    text = 'nhấn chọn nút ở dưới để bắt đầu quy trình upload'
    buttons = [Template.ButtonPostBack("Upload", "cbtest_implement_upload")]
    cbtest.send(sender_id, Template.Buttons(text, buttons))
Esempio n. 25
0
def saostar_ads(sender_id):
    text = 'Liên hệ hợp tác quảng cáo & xuất bản nội dung: [email protected] ❤'
    buttons = [Template.ButtonPostBack("HOME", "saostar_home")]
    saostar.send(sender_id, Template.Buttons(text, buttons))
Esempio n. 26
0
def ghvn_minigame1_rule(sender_id):
    text = "- Mỗi bạn tham gia sẽ có 01 lựa chọn cho việc dự đoán đội huấn luyện viên có thí sinh đạt được giải quán quân 🎊 của chương trình.\n- Nếu bạn thay đổi ý kiến, dự đoán được BTC ghi nhận là dự đoán cuối cùng mà bạn chọn.\n- Nếu dự đoán đúng và may mắn, bạn sẽ nhận được 01 phần quà 🎁 hấp dẫn từ ban tổ chức.\n Hãy tận dụng “giác quan thứ 6” của mình để 'rinh' quà về nhà nào!\n👉👉👉 “Giọng Hát Việt Nhí” 2017 sẽ chính thức được phát sóng vào lúc 21h10 thứ 7 hằng tuần trên kênh VTV3"
    buttons = [
        Template.ButtonPostBack("Home", "ghvn_home")
    ]
    ghvn.send(sender_id, Template.Buttons(text, buttons))