Example #1
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))
Example #2
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")
Example #3
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")
Example #4
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")
Example #5
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))
Example #6
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))
Example #7
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))
Example #8
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))
Example #9
0
def ttb_news(sender_id):
    elements = []
    news_list = []
    for news in NEWS.find({'chatbot': 'ttb'}):
        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', 'ttb_home')
            ])
        elements.append(element)
    short_list_elements = random.sample(elements, 10)
    ttb.send(sender_id, Template.Generic(short_list_elements))
Example #10
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))
Example #11
0
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))