Esempio n. 1
0
def list_bot_messages(user=None):
    try:
        data = request.query
        type = data.get('type')
        return BotView().list_messages(type)
    except Exception as e:
        return e
Esempio n. 2
0
def messenger_post_message():
    try:
        payload = request.body.read()
        signature = request.headers.get('X-Hub-Signature')

        response.status = 200
        BotView().validate_util_charge(payload, signature)

    except Exception as e:
        response.status = 200
Esempio n. 3
0
def get_link_account():
    try:
        data = json.loads(request.body.read())
        login = data.get("login")
        password = data.get("password")
        token = data.get("token")

        user = BotView().update_user(token, login, password)
        return user
    except Exception as e:
        return e
Esempio n. 4
0
def verification():
    try:
        data = request.query
        verify_token = data.get('hub.verify_token')
        challenge = data.get('hub.challenge')

        if challenge is None or verify_token is None:
            return Error('No data', 400)
        return BotView().verify_token(verify_token, challenge)
    except Exception as e:
        return e
Esempio n. 5
0
def create_bot_message(user=None):
    try:
        data = json.loads(request.body.read())
        text = data.get('text')
        type = data.get('type', 'text')

        if not text:
            return Error('no data', 400).get_error()
        return BotView().add_message(text, type)

    except Exception as e:
        return e
Esempio n. 6
0
def delete_bot_message(id, user=None):
    try:
        return BotView().delete_message(id)
    except Exception as e:
        return e
Esempio n. 7
0
def get_bot_message(id, user=None):
    try:
        return BotView().get_message(id)
    except Exception as e:
        return e