Beispiel #1
0
def urban_handler():
    text = slack_utils.get_slack_text()
    LOG.info(text)
    if text is None:
        return 'Invalid text'
    ret = {
        "response_type": "in_channel",
        "text": urban_dict.word_to_defn_slack(text)}
    return Response(json.dumps(ret), mimetype='application/json')
Beispiel #2
0
def random_slack_handler():
    text = slack_utils.get_slack_text()
    if text is None:
        return 'Invalid text'
    if text == 'number':
        rand = random.randrange(1000 * 1000)
    else:
        rand = slack_utils.get_random_str()
    ret = {"response_type": "in_channel", "text": rand}
    return Response(json.dumps(ret), mimetype='application/json')
Beispiel #3
0
def dict_handler():
    text = slack_utils.get_slack_text()
    LOG.info("/slack/dict : " + text)
    if text is None:
        return 'Invalid text'
    text = '\n\n'.join(eng_dict.get_word_defns(text)['defns'])
    ret = {'response_type': 'in_channel', 'text': text}
    ret = {'response_type': 'in_channel', 'text': eng_dict.get_word_defns(text)[
        'defns']}
    text = '\n\n'.join(eng_dict.get_word_defns(text)['defns'])
    ret = {'response_type': 'in_channel', 'text': text}
    return Response(json.dumps(ret), mimetype='application/json')