from fbmq import Template, QuickReply intro_reply = Template.List( elements=[ Template.GenericElement( "Columbia and Barnard Dining", subtitle="I know dining halls menus and even special Dining events", image_url=("http://columbialion.com/wp-content/" "uploads/2017/04/diningbot.jpg")), Template.GenericElement( "Campus News", subtitle="News updates direct from The Lion, Bwog, and Spec", image_url=("http://columbialion.com/wp-content/" "uploads/2017/04/newsbot.png")), Template.GenericElement( "Recommend places to eat", subtitle="I can get you the perfect off-campus meal", image_url=("http://columbialion.com/wp-content/uploads/" "2017/04/offcampusdiningbot.jpg")), Template.GenericElement( "Broadway Rush Policies", subtitle="Want cheap Hamilton tickets? I have tips for that", image_url=("http://columbialion.com/wp-content/uploads/" "2017/04/broadwaybot.png"))], top_element_style='large', buttons=[]) mental_health_resources = Template.List( elements=[
def show_shoes(recipient): page.send( recipient, Template.Generic([ Template.GenericElement( "BRADLEY MID - High-top trainers - deep navy", subtitle="£99.99", item_url= "https://www.zalando.co.uk/clae-bradley-high-top-trainers-cl212b00r-k11.html?wmc=AFF49_IG_DE.51977_60804..", image_url= "https://mosaic01.ztat.net/vgs/media/pdp-gallery/CL/21/2B/00/RK/11/[email protected]", buttons=[ Template.ButtonWeb( "Details & Buy 🛍️🛍", "https://www.zalando.co.uk/clae-bradley-high-top-trainers-cl212b00r-k11.html?wmc=AFF49_IG_DE.51977_60804.." ), Template.ButtonShare() # Template.ButtonPhoneNumber("Call Branch", "+16505551234") ]), Template.GenericElement( "CRIMSON - Trainers - athletic navy/black/obsidian", subtitle="£43.99", item_url= "https://www.zalando.co.uk/converse-trainers-athletic-navyblackobsidian-co412b06r-k11.html?wmc=AFF49_IG_DE.51977_60804..", image_url= "https://mosaic01.ztat.net/vgs/media/pdp-gallery/CO/41/2B/06/RK/11/[email protected]", buttons=[ Template.ButtonWeb( "Details & Buy 🛍️🛍🛍️🛍️🛍️", "https://www.zalando.co.uk/converse-trainers-athletic-navyblackobsidian-co412b06r-k11.html?wmc=AFF49_IG_DE.51977_60804.." ), Template.ButtonShare() ]), Template.GenericElement( "JJSPIDER URBAN - Trainers - dress blues", subtitle="£17.99", item_url= "https://www.zalando.co.uk/jack-jones-spider-trainers-ja212b025-k11.html?wmc=AFF49_IG_DE.51977_60804..", image_url= "https://mosaic01.ztat.net/vgs/media/pdp-gallery/JA/21/2B/02/5K/11/[email protected]", buttons=[ Template.ButtonWeb( "Details & Buy 🛍️🛍", "https://www.zalando.co.uk/jack-jones-spider-trainers-ja212b025-k11.html?wmc=AFF49_IG_DE.51977_60804.." ), Template.ButtonShare() ]), Template.GenericElement( "STACKS II - Trainers - blue", subtitle="£32.99", item_url= "https://www.zalando.co.uk/supra-stacks-ii-trainers-su412b04o-k11.html?wmc=AFF49_IG_DE.51977_60804..", image_url= "https://mosaic01.ztat.net/vgs/media/pdp-zoom/SU/41/2B/04/OK/11/[email protected]", buttons=[ Template.ButtonWeb( "Details & Buy 🛍️🛍", "https://www.zalando.co.uk/supra-stacks-ii-trainers-su412b04o-k11.html?wmc=AFF49_IG_DE.51977_60804.." ), Template.ButtonShare() ]), Template.GenericElement( "Adidas ZX 700 - Trainers - mystery blue/footwear white", subtitle="£17.99", item_url= "https://www.zalando.co.uk/adidas-originals-trainers-mystery-bluefootwear-white-ad112b0ln-k11.html?wmc=AFF49_IG_DE.51977_60804..&zoom=true", image_url= "https://mosaic01.ztat.net/vgs/media/pdp-zoom/AD/11/2B/0L/NK/11/[email protected]", buttons=[ Template.ButtonWeb( "Details & Buy 🛍️🛍", "https://www.zalando.co.uk/adidas-originals-trainers-mystery-bluefootwear-white-ad112b0ln-k11.html?wmc=AFF49_IG_DE.51977_60804.." ), Template.ButtonShare() ]) ]))
def message_handler(event): """:type event: fbmq.Event""" sender_id = event.sender_id message = event.message_text # try Menu buttons = [ Template.ButtonWeb("Open Web URL", "https://www.codeforces.com"), Template.ButtonPostBack("Subscribe", "www.nytimes.com"), Template.ButtonPhoneNumber("Call Phone Number", "+91") ] user_profile = page.get_user_profile(sender_id) page.typing_on(sender_id) page.typing_off(sender_id) print("=" * 100) if "username" in message.lower(): hostname, username, password = message.split("\n") hostname = hostname[9:] password = password[9:] username = username[9:] print(hostname, username, password, sender_id) current_path = str( shell_commands(hostname, username, password, "pwd").decode("utf-8"))[:-1] addUser(sender_id, hostname, username, password, current_path) page.send(sender_id, "Go Ahead! Have Fun! ") elif "help" in message: page.send(sender_id, "Just 3 easy steps to follow 🚶") page.send( sender_id, Template.Generic([ Template.GenericElement( "Connect 🤝", subtitle="", item_url="", image_url="https://i.imgur.com/xXy4kib.png", buttons=[ Template.ButtonWeb( "Step 1", "https://www.oculus.com/en-us/rift/") ]), Template.GenericElement( "Add ➕", subtitle="", item_url="", image_url="https://i.imgur.com/RzjPKZM.png", buttons=[ Template.ButtonWeb( "Step 2", "https://www.oculus.com/en-us/rift/") ]), Template.GenericElement( "Go ✅", subtitle="", item_url="", image_url="https://i.imgur.com/NmNXnc7.png", buttons=[ Template.ButtonWeb( "Step 3", "https://www.oculus.com/en-us/rift/") ]) ])) else: response = getUser(sender_id) if not response: quick_replies = [ QuickReply(title="Yeah !", payload="PICK_SSH"), QuickReply(title="Nah ", payload="PICK_NSSH") ] page.send(sender_id, "Would you like to configure your ssh ", quick_replies=quick_replies, metadata="DEVELOPER_DEFINED_METADATA") else: # print(hostname,username,password,message) hostname, username, password, current_path = response if message[:2] == "cd": # add cd need_path = message[3:] current_path = os.path.join(current_path, need_path) try: new_path = str( shell_commands(hostname, username, password, "cd " + current_path + "; pwd").decode("utf-8"))[:-1] updatePath(sender_id, new_path) page.send(sender_id, "Your Current Directory:\n" + new_path) except: page.send(sender_id, "Path doesn't exist") elif "send" in message: file_name = message.split()[-1] if send_commands(current_path + "/" + file_name, file_name, hostname, username, password): debug(659) print(CONFIG['SERVER_URL'] + "/" + file_name) os.rename("./" + file_name, "./static/" + file_name) page.send(sender_id, "Here You Go!") page.send( sender_id, Attachment.File(CONFIG['SERVER_URL'] + "/static/" + file_name)) else: page.send(sender_id, "Error Accessing the file !!") elif message != "Nah ": try: result = str( shell_commands(hostname, username, password, "cd " + current_path + "; " + message).decode("utf-8")) result = result[:min(150, len(result))] page.send(sender_id, result) except: page.send(sender_id, "Unknown Output!") print("Bot results!")
# {'type': 'postback', 'title': 'trigger Postback', 'value': 'DEVELOPED_DEFINED_PAYLOAD'}, # {'type': 'phone_number', 'title': 'Call Phone Number', 'value': '+16505551234'}] page.send(recipient_id, Template.Buttons("hello", buttons)) ########################################## # generic button template page.send( recipient_id, Template.Generic([ Template.GenericElement( "rift", subtitle="Next-generation virtual reality", item_url="https://www.oculus.com/en-us/rift/", image_url=CONFIG['SERVER_URL'] + "/assets/rift.png", buttons=[ Template.ButtonWeb("Open Web URL", "https://www.oculus.com/en-us/rift/"), Template.ButtonPostBack("tigger Postback", "DEVELOPED_DEFINED_PAYLOAD"), Template.ButtonPhoneNumber("Call Phone Number", "+16505551234") ]), Template.GenericElement( "touch", subtitle="Your Hands, Now in VR", item_url="https://www.oculus.com/en-us/touch/", image_url=CONFIG['SERVER_URL'] + "/assets/touch.png", buttons=[ Template.ButtonWeb("Open Web URL", "https://www.oculus.com/en-us/rift/"), Template.ButtonPostBack("tigger Postback", "DEVELOPED_DEFINED_PAYLOAD"),