예제 #1
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')
예제 #2
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}}
        )
예제 #3
0
파일: ttb.py 프로젝트: hoangphuc17/chat-bot
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
                }
            }})
예제 #4
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
예제 #5
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
예제 #6
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}})
예제 #7
0
def cbtest_get_news_am_nhac(sender_id):
    elements = []
    news_list = []
    for news in NEWS.find({'chatbot': 'saostar', 'category': 'am nhac'}):
        news_list.append(news)

    # print(news_list)

    for news in news_list:
        element = Template.GenericElement(
            title=news['title'],
            subtitle=news['subtitle'],
            image_url=news['image_url'],
            buttons=[
                Template.ButtonWeb('Đọc tin', news['item_url']),
                Template.ButtonPostBack('Về Home', 'cbtest_home')
            ])
        elements.append(element)

    short_list_elements = random.sample(elements, 10)
    cbtest.send(sender_id, Template.Generic(short_list_elements))

    question = 'Xem thêm'
    quick_replies = [QuickReply(title="Giải trí", payload="giai_tri")]
    cbtest.send(sender_id,
                question,
                quick_replies=quick_replies,
                metadata="DEVELOPER_DEFINED_METADATA")
예제 #8
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
예제 #9
0
def saostar_get_news_thoi_trang(sender_id):
    elements = []
    news_list = []
    for news in NEWS.find({'chatbot': 'saostar', 'category': 'thoi trang'}):
        news_list.append(news)

    for news in news_list:
        element = Template.GenericElement(
            title=news['title'],
            subtitle=news['subtitle'],
            image_url=news['image_url'],
            buttons=[
                Template.ButtonWeb('Đọc tin', news['item_url']),
                Template.ButtonPostBack('HOME', 'saostar_home')
            ])
        elements.append(element)

    short_list_elements = random.sample(elements, 5)
    saostar.send(sender_id, Template.Generic(short_list_elements))

    question = 'Xem thêm'
    quick_replies = [
        QuickReply(title="Xem thêm", payload="xem_them"),
        QuickReply(title="Giải trí", payload="giai_tri"),
        QuickReply(title="Âm nhạc", payload="am_nhac"),
        QuickReply(title="Phim ảnh", payload="phim_anh"),
        QuickReply(title="Đời sống", payload="doi_song")
        # QuickReply(title="Âm nhạc", payload="thoi_trang")
    ]
    saostar.send(sender_id,
                 question,
                 quick_replies=quick_replies,
                 metadata="DEVELOPER_DEFINED_METADATA")
예제 #10
0
def svtv_get_news(sender_id):
    elements = []
    news_list = []
    for news in NEWS.find({'chatbot': 'svtv'}):
        news_list.append(news)

    for news in news_list:
        element = Template.GenericElement(
            title=news['title'],
            subtitle=news['subtitle'],
            image_url=news['image_url'],
            buttons=[
                Template.ButtonWeb('Đọc tin', news['item_url']),
                Template.ButtonPostBack('Về Home', 'svtv_home')
            ])
        elements.append(element)

    short_list_elements = random.sample(elements, 5)
    svtv.send(sender_id, Template.Generic(short_list_elements))

    question = 'Xem thêm'
    quick_replies = [
        QuickReply(title="Xem thêm", payload="svtv_get_news")

    ]
    svtv.send(sender_id,
              question,
              quick_replies=quick_replies,
              metadata="DEVELOPER_DEFINED_METADATA")
예제 #11
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))
예제 #12
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))
예제 #13
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))
예제 #14
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
예제 #15
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
예제 #16
0
def cbtest_home(sender_id):
    elements = [
        Template.GenericElement(
            "Đóng góp hình ảnh",
            subtitle="Saostar",
            image_url="http://210.211.109.211/weqbfyretnccbsaf/ttb_tintuc.jpg",
            buttons=[Template.ButtonPostBack("Upload", "cbtest_menu_upload")]),
        Template.GenericElement(
            "Tin tức",
            subtitle="Saostar",
            image_url=
            "http://210.211.109.211/weqbfyretnccbsaf/ttb_xemtintuc.jpg",
            buttons=[
                Template.ButtonPostBack("Xem tin tức",
                                        "cbtest_get_news_general")
            ])
    ]
    cbtest.send(sender_id, Template.Generic(elements))
예제 #17
0
def cdhh_home(sender_id):
    elements = [
        Template.GenericElement(
            "Tin tức",
            subtitle="Tin tức mới nhất từ Cặp Đôi Hoàn Hảo - Trữ Tình & Bolero",
            image_url="http://210.211.109.211/weqbfyretnccbsaf/cdhh_tintuc.jpg",
            buttons=[
                Template.ButtonPostBack("Xem tin tức 👓", "cdhh_news"),
                Template.ButtonPostBack("Theo dõi tin tức 📸", "cdhh_subscribe")
            ]),
        Template.GenericElement(
            "Xem chương trình",
            subtitle=
            "Chương trình phát sóng 20:30 thứ 5 hàng tuần trên VTV3.\nBạn có thế xem lại tập Full với các bản tình ca siêu ngọt ngào tại đây nha!",
            image_url=
            "http://210.211.109.211/weqbfyretnccbsaf/cdhh_xemtintuc.jpg",
            buttons=[
                Template.ButtonWeb(
                    "Tập 2", "https://www.youtube.com/watch?v=Ynu6u0WSxrU"),
                Template.ButtonWeb(
                    "Tập 1", "https://www.youtube.com/watch?v=6xE6VOkRr4Qv")
            ]),
        Template.GenericElement(
            "Bình chọn thí sinh",
            subtitle="Tin tức mới nhất từ Cặp Đôi Hoàn Hảo - Trữ Tình & Bolero",
            image_url=
            "http://210.211.109.211/weqbfyretnccbsaf/cdhh_binhchon.jpg",
            buttons=[Template.ButtonPostBack("Bình chọn", "cdhh_vote")]),
        Template.GenericElement(
            "Tìm hiểu thêm thông tin",
            subtitle="Theo dõi Cặp Đôi Hoàn Hảo ngay nhé",
            image_url="http://210.211.109.211/weqbfyretnccbsaf/cdhh_lienhe.jpg",
            buttons=[
                Template.ButtonWeb(
                    "Facebook",
                    "https://www.facebook.com/capdoihoanhaotrutinhbolero/"),
                Template.ButtonWeb(
                    "Youtube",
                    "https://www.youtube.com/channel/UCF5RuEuoGrqGtscvLGLOMew/featured"
                )
            ])
    ]
    cdhh.send(sender_id, Template.Generic(elements))
예제 #18
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))
예제 #19
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}}
    )
예제 #20
0
def svtv_home(sender_id):
    elements = [
        # Template.GenericElement("Đóng góp hình ảnh",
        #                         subtitle="svtv",
        #                         # image_url="http://210.211.109.211/weqbfyretnccbsaf/ttb_tintuc.jpg",
        #                         buttons=[
        #                             Template.ButtonPostBack(
        #                                 "Upload", "svtv_menu_upload")
        #                         ]),
        Template.GenericElement("Tin tức",
                                subtitle="svtv",
                                # image_url="http://210.211.109.211/weqbfyretnccbsaf/ttb_xemtintuc.jpg",
                                buttons=[
                                    Template.ButtonPostBack(
                                        "Xem tin tức", "svtv_get_news"),
                                    Template.ButtonPostBack(
                                        "Theo dõi tin tức", "svtv_menu_subscribe")
                                ])
    ]
    svtv.send(sender_id, Template.Generic(elements))
예제 #21
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))
예제 #22
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))
예제 #23
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))
예제 #24
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
예제 #25
0
def ghvn_read_news(sender_id):
    elements = []
    for news in NEWS.find():
        element = Template.GenericElement(
            title=news['title'],
            subtitle=news['subtitle'],
            image_url=news['image_url'],
            buttons=[
                Template.ButtonWeb('Đọc tin', news['item_url']),
                Template.ButtonPostBack('Về Home', 'ghvn_home')
            ])
        elements.append(element)
    ghvn.send(sender_id, Template.Generic(elements))
예제 #26
0
파일: ttb.py 프로젝트: hoangphuc17/chat-bot
def ttb_home(sender_id):
    elements = [
        Template.GenericElement(
            "Tin tức",
            subtitle="Tin tức mới nhất từ Thần tượng Bolero",
            # image_url="http://210.211.109.211/weqbfyretnccbsaf/ttb_tintuc.jpg",
            buttons=[
                Template.ButtonPostBack("Xem tin tức 👓", "ttb_news"),
                Template.ButtonPostBack("Theo dõi tin tức 📸",
                                        "ttb_menu_subscribe")
            ])
        # Template.GenericElement("Xem video thần tượng bolero mùa 3 - 2018",
        #                         subtitle="Chương trình phát sóng 20:30 thứ 5 hàng tuần trên VTV3.\nBạn có thế xem lại tập Full với các bản tình ca siêu ngọt ngào tại đây nha!",
        #                         image_url="http://210.211.109.211/weqbfyretnccbsaf/ttb_xemtintuc.jpg",
        #                         buttons=[
        #                             Template.ButtonWeb(
        #                                 "Tập 2", "https://www.youtube.com/watch?v=Ynu6u0WSxrU"),
        #                             Template.ButtonWeb(
        #                                 "Tập 1", "https://www.youtube.com/watch?v=6xE6VOkRr4Qv")
        #                         ]),
        # Template.GenericElement("Minigame",
        #                         subtitle="Tham gia dự đoán kết quả của cuộc thi để nhận được những phần quà hấp dẫn nhất từ ban tổ chức",
        #                         image_url="http://210.211.109.211/weqbfyretnccbsaf/ttb_binhchon.jpg",
        #                         buttons=[
        #                             Template.ButtonPostBack(
        #                                 "Bình chọn", "ttb_vote")
        #                         ]),
        # Template.GenericElement("About us",
        #                         subtitle="Theo dõi Cặp Đôi Hoàn Hảo ngay nhé",
        #                         image_url="http://210.211.109.211/weqbfyretnccbsaf/ttb_lienhe.jpg",
        #                         buttons=[
        #                             Template.ButtonWeb(
        #                                 "Facebook", "https://www.facebook.com/capdoihoanhaotrutinhbolero/"),
        #                             Template.ButtonWeb(
        #                                 "Youtube", "https://www.youtube.com/channel/UCF5RuEuoGrqGtscvLGLOMew/featured")
        #                         ])
    ]
    ttb.send(sender_id, Template.Generic(elements))
예제 #27
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}}
        )
예제 #28
0
def cdhh_news(sender_id):
    elements = []
    for item in NEWS.find():
        element = Template.GenericElement(
            title=item['title'],
            subtitle=item['subtitle'],
            image_url=item['image_url'],
            buttons=[
                Template.ButtonWeb('Đọc tin', item['item_url']),
                Template.ButtonPostBack('Về Home', 'cdhh_home')
            ])
        elements.append(element)

    cdhh.send(sender_id, Template.Generic(elements))
예제 #29
0
파일: ttb.py 프로젝트: hoangphuc17/chat-bot
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))
예제 #30
0
def ghvn_home(sender_id):
    elements = [
        Template.GenericElement("Fansign",
                                subtitle="Cùng đón nhận những lời chúc từ các huấn luyện viên Giọng Hát Việt Nhí 2017!!!",
                                image_url="http://210.211.109.211/weqbfyretnccbsaf/home_hinh1_tin_tuc.jpg",
                                buttons=[
                                    Template.ButtonPostBack(
                                        "Lấy Fansign", "ghvn_fansign")
                                ]),
        Template.GenericElement("Tin tức mới nhất từ chương trình “Giọng Hát Việt Nhí” 2017",
                                subtitle="Nơi cập nhật những tin tức mới nhất từ chương trình “Giọng Hát Việt Nhí” 2017",
                                image_url="http://210.211.109.211/weqbfyretnccbsaf/home_hinh1_tin_tuc.jpg",
                                buttons=[
                                    Template.ButtonPostBack(
                                        "Xem tin tức 👓", "ghvn_read_news"),
                                    Template.ButtonPostBack(
                                        "Theo dõi tin tức 📸", "ghvn_subscribe_news")
                                ]),
        Template.GenericElement("Video Full - The Voice Kids 2017 | Giọng Hát Việt Nhí mùa 5",
                                subtitle="Xem lại bản đầy dủ các tập đã được phát sóng trên Youtube, Live Streaming",
                                image_url="http://210.211.109.211/weqbfyretnccbsaf/home_hinh2_xem_video.jpg",
                                buttons=[
                                    Template.ButtonWeb(
                                        "Xem lại tập đã phát", "https://www.youtube.com/user/btcgionghatvietnhi"),
                                    Template.ButtonWeb(
                                        "Oh my kids", "https://www.youtube.com/playlist?list=PLEhBV4sOYnBml5RPOlILDvj5DqNwmG9AI"),
                                    Template.ButtonWeb(
                                        "Off the air", "https://www.youtube.com/playlist?list=PLEhBV4sOYnBk1BX8Jks9152rkNTIZQWuK")
                                ]),

        Template.GenericElement("Dự đoán kết quả và giành lấy cơ hội nhận quà",
                                subtitle="Tham gia dự đoán kết quả của cuộc thi để nhận được những phần quà hấp dẫn nhất từ ban tổ chức",
                                image_url="http://210.211.109.211/weqbfyretnccbsaf/home_hinh3_du_doan.jpg",
                                buttons=[
                                    Template.ButtonPostBack(
                                        "Minigame 1", "ghvn_minigame1"),
                                    Template.ButtonPostBack(
                                        "Minigame 2", "ghvn_minigame2")
                                ]),
        Template.GenericElement("About us",
                                subtitle="Theo dõi chương trình Giọng Hát Việt Nhí 2017 tại các kênh truyền thông",
                                image_url="http://210.211.109.211/weqbfyretnccbsaf/home_hinh4_about_us.jpg",
                                buttons=[
                                    Template.ButtonWeb(
                                        "Facebook", "https://www.facebook.com/gionghatvietnhi/"),
                                    Template.ButtonPostBack(
                                        "Giờ phát sóng", "ghvn_timeline"),
                                    Template.ButtonPostBack(
                                        "Giới thiệu", "ghvn_introduce")
                                ])
    ]
    ghvn.send(sender_id, Template.Generic(elements))