Exemple #1
0
    def get(self, request, *args, **kwargs):
        page.show_persistent_menu([
            Template.ButtonWeb('University of Sargodha',
                               'https://uos.edu.pk/'),
            Template.ButtonWeb('ORIC', 'https://oric.uos.edu.pk'),
            Template.ButtonWeb('File a Complaint',
                               'https://uos.edu.pk/complaint')
        ])

        page.show_starting_button("Start Asking Your Queries")
        page.greeting(
            "University Enquiring Chatbot is here to answer your queries About University"
        )
        return HttpResponse('yaayyyyy')
Exemple #2
0
max_sentences = 3
max_local_summaries = 20
SUMMARIES = dict()

@app.route('/webhook', methods=['GET'])
def validate():
    if request.args.get('hub.mode', '') == 'subscribe' and \
                    request.args.get('hub.verify_token', '') == CONFIG['VERIFY_TOKEN']:

        print("Validating webhook")

        return request.args.get('hub.challenge', '')
    else:
        return 'Failed validation. Make sure the validation tokens match.'

page.show_starting_button("START_PAYLOAD")       # Getting Started

@page.callback(['START_PAYLOAD'])
def start_callback(payload, event):
    sender_id = event.sender_id
    quick_replies = [
            QuickReply(title="Yeah !", payload="PICK_SYNC"),
            QuickReply(title="Nah ", payload="PICK_DSYNC")
            ]
    page.send(sender_id, "Would you like to sync this conversation ?\n you can subscribe etc. ",quick_replies=quick_replies,metadata="DEVELOPER_DEFINED_METADATA")
    print("Let's start!")

@page.callback(['PICK_SYNC', 'PICK_DSYNC'])
def callback_picked_genre(payload, event):
    sender_id = event.sender_id
    if payload == "PICK_SYNC":
Exemple #3
0
import json
from config import CONFIG
from fbmq import Attachment, Template, QuickReply, NotificationType
from fbpage import page
import twine

USER_SEQ = {}


page.greeting("hi, im archy, and im sorry to hear youve decided to write")

page.show_persistent_menu([
    Template.ButtonPostBack("get started (again)", 'START_PAYLOAD'),
    ])

page.show_starting_button('START_PAYLOAD')





@page.callback(['START_PAYLOAD'])
def start_callback(payload, event):
    """Quick replies have a 20 character limit!
    """
    recipient = event.sender_id
    page.send(recipient, "i cant help with everything, but i can help you do something")
 
    # only 20 characters text in quick replies...
    page.send(recipient, "what is your particular shame today?",
              quick_replies=[
Exemple #4
0
from rivescript_redis import RedisSessionManager
from util import topicos
from util import elimina_tildes

parentdir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
os.sys.path.insert(0, parentdir)

USER_SEQ = {}

bot = RiveScript(session_manager=RedisSessionManager())
bot.load_directory("./rs")
bot.sort_replies()

page.greeting("LinguaBot+, tu mejor opción para el asesoramiento del idioma inglés.")

page.show_starting_button("START_PAYLOAD")


#MÉTODOS MODIFICADOS Y/O CREADOS


@page.callback(['START_PAYLOAD'])
def start_callback(payload, event):
    print("Let's start!")


def set_persistent_menu():
    post_fields = {
        'persistent_menu': [
            {
                'locale': 'default',
Exemple #5
0
    Template.ButtonPostBack("My Subscriptions", "MENUPAYLOAD/Subs"),
    Template.ButtonPostBack("Remove Notification", "MENUPAYLOAD/Remove"),
    Template.ButtonPostBack("Unsubscribe", "Unsub")
]

simple_menu_btns = [
    Template.ButtonPostBack("Current Products", "MENUPAYLOAD/Products"),
]

quick_replies = [
    QuickReply(title="Yes, subscribe", payload="Yes_r"),
    QuickReply(title="No", payload="No")
]

page.greeting("Click Get Started below to subscribe!!")
page.show_starting_button("Subscribe")


def p_menu():
    acct_menu = {"title": "My Account", "type": "nested"}
    menu = [{
        "locale": "default",
        "composer_input_disabled": False,
        "call_to_actions": [acct_menu]
    }]
    call_to_actions = []

    for button in Template.Buttons.convert_shortcut_buttons(acct_menu_btns):
        call_to_actions.append({
            "type": "postback",
            "title": button.title,
Exemple #6
0
from fbpage import page
from fbmq import QuickReply, Template
from zipcode import search

import os
import re
import requests
import dbhandler as db
import yelp as yelp

page.greeting("Click Get Started below to get started!")
page.show_starting_button("Get Started")


def general_query(results):
    print(results)
    try:
        rv_name = results["businesses"][0]["name"]
        rv_url = results["businesses"][0]["url"]
        rv = rv_name + "\n_____\n" + rv_url
    except:
        rv = "yelp can't find that shit man."
    return rv


@page.handle_postback
def received_postback(event):
    sender_id = event.sender_id
    recipient_id = event.recipient_id
    time_of_postback = event.timestamp
    payload = event.payload