Exemplo n.º 1
0
def index():
    text = request.args.get('msg')
    if not text:
        return 'I need some text.', 200
    
    try:
        out = partyparrot.convert_str_to_emoji(text, space=(EN_SPACE * 3))

        return jsonify(text=partyparrot.make_slack_compatible(out))
    except ValueError as e:
        return jsonify(text=str(e))
Exemplo n.º 2
0
def slack():
    if slack_team_token and request.form.get('token') != slack_team_token:
        return 'Unauthorized', 401

    text = request.form.get('text')
    if not text:
        return 'I need some text.', 200

    try:
        out = partyparrot.convert_str_to_emoji(text, space=(EN_SPACE * 3))

        return jsonify(response_type='in_channel',
                       text=partyparrot.make_slack_compatible(out))
    except ValueError as e:
        return jsonify(text=str(e))