<commit_before>from config import API_URL
import requests
import sys
import datetime
import utils
import errors


def welcome(bot, update):
    bot.sendMessage(update.message.chat_id, text='Hi!')


def help(bot, update):
    bot.sendMessage(update.message.chat_id, text='Help!')


def info(bot, update):
    user_name, user_id, group = utils.get_info(update)
    bot.sendMessage(group, text=user_name + ' ' + user_id)


# Register group (should automate this though)
def register_group(bot, update):
    user_name, user_id, group = utils.get_info(update)

    # Server request
    data = {
        'group': group
    }
    r = requests.post(API_URL + 'register_group', json=data)

    # Response handling
    if r.status_code == 200:
        bot.sendMessage(group, text='Group registered')
    else:
        bot.sendMessage(group, text='Group already registered / registration failed')


# Registration command
def register(bot, update):
    user_name, user_id, group = utils.get_info(update)

    # Server request
    data = {
        'id': user_id,
        'username': user_name,
        'groupID': group
    }
    r = requests.post(API_URL + 'register', json=data)

    print(r.text)

    # Response handling
    if r.status_code == 200:
        bot.sendMessage(group, text=user_name + ': Successful registration')
    else:
        bot.sendMessage(group, text=user_name + ': Registration failed / already registered')


# Start meal
def start_meal(bot, update, args):
    user_name, user_id, group = utils.get_info(update)

    # TODO: Check the number of args
    meal_type = args[0].strip()

    # Request
    data = {
        'group': group,
        'meal_type': meal_type
    }
    r = requests.post(API_URL + 'add_meal', json=data)

    # Response handling
    if r.status_code == 200:
        data2 = {
            'user_id': user_id,
            'group': group,
            'portions': 1,
            'cooked': True
        }
        r2 = requests.post(API_URL + 'eating', json=data2)
        <commit_msg>make bot say sth if meal type not specified<commit_after>from config import API_URL
import requests
import sys
import datetime
import utils
import errors


def welcome(bot, update):
    bot.sendMessage(update.message.chat_id, text='Hi!')


def help(bot, update):
    bot.sendMessage(update.message.chat_id, text='Help!')


def info(bot, update):
    user_name, user_id, group = utils.get_info(update)
    bot.sendMessage(group, text=user_name + ' ' + user_id)


# Register group (should automate this though)
def register_group(bot, update):
    user_name, user_id, group = utils.get_info(update)

    # Server request
    data = {
        'group': group
    }
    r = requests.post(API_URL + 'register_group', json=data)

    # Response handling
    if r.status_code == 200:
        bot.sendMessage(group, text='Group registered')
    else:
        bot.sendMessage(group, text='Group already registered / registration failed')


# Registration command
def register(bot, update):
    user_name, user_id, group = utils.get_info(update)

    # Server request
    data = {
        'id': user_id,
        'username': user_name,
        'groupID': group
    }
    r = requests.post(API_URL + 'register', json=data)

    print(r.text)

    # Response handling
    if r.status_code == 200:
        bot.sendMessage(group, text=user_name + ': Successful registration')
    else:
        bot.sendMessage(group, text=user_name + ': Registration failed / already registered')


# Start meal
def start_meal(bot, update, args):
    user_name, user_id, group = utils.get_info(update)

    # TODO: Check the number of args

    if len(args) == 0:
        bot.sendMessage(group, text=user_name + ", please indicate meal type, "
                                                  "for example: '/start lunch'")
        return
    else:
        meal_type = args[0].strip()

    # Request
    data = {
        'group': group,
        'meal_type': meal_type
    }
    r = requests.post(API_URL + 'add_meal', json=data)

    # Response handling
    if r.status_code == 200:
        data2 = {
            'user_id': user_id,
            'group': group,
            'portions': 1,
            'cooked': True
        }
        r2 = requests.post(API_URL + 'eating', json=data2)
        
{'fraction_non_alphanumeric': 0.11506080449017773, 'fraction_numerical': 0.006782039289055191, 'mean_word_length': 2.658682634730539, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7264593', 'n_tokens_mistral': 1369, 'n_tokens_neox': 1316, 'n_words': 335}