Esempio n. 1
0
def add_photo(parameters, posts):
    not_exist_param = adp.check_params_exist(parameters, ['token', 'chat_id'])
    if not_exist_param != None:
        return {
            'result': '1',
            'error': not_exist_param + ' parameter not send'
        }

    not_exist_param = adp.check_params_exist(posts, ['photo'])
    if not_exist_param != None:
        return {
            'result': '1',
            'error': not_exist_param + ' parameter not send'
        }

    res = use.add_photo(token=parameters['token'],
                        chat_id=parameters['chat_id'],
                        base64=posts['photo'])
    return res
Esempio n. 2
0
def all_users(parameters, posts):
    not_exist_param = adp.check_params_exist(parameters, ['token'])
    if not_exist_param != None:
        return {
            'result': '1',
            'error': not_exist_param + ' parameter not send'
        }

    res = use.all_users(parameters['token'])
    return res
Esempio n. 3
0
def delete_chat(parameters, posts):
    not_exist_param = adp.check_params_exist(parameters, ['token', 'chat_id'])
    if not_exist_param != None:
        return {
            'result': '1',
            'error': not_exist_param + ' parameter not send'
        }

    res = use.delete_chat(token=parameters['token'],
                          chat_id=parameters['chat_id'])
    return res
Esempio n. 4
0
def get_file(parameters, posts):
    not_exist_param = adp.check_params_exist(parameters, ['token', 'photo_id'])
    if not_exist_param != None:
        return {
            'result': '1',
            'error': not_exist_param + ' parameter not send'
        }

    res = use.get_file(token=parameters['token'],
                       photo_id=parameters['photo_id'])
    return res
Esempio n. 5
0
def add_user(parameters, posts):
    not_exist_param = adp.check_params_exist(parameters, ['name', 'password'])
    if not_exist_param != None:
        return {
            'result': '1',
            'error': not_exist_param + ' parameter not send'
        }

    res = use.add_user(name=parameters['name'],
                       password=parameters['password'])
    return res
Esempio n. 6
0
def add_chat(parameters, posts):
    not_exist_param = adp.check_params_exist(
        parameters, ['token', 'second_user_id', 'chat_name'])
    if not_exist_param != None:
        return {
            'result': '1',
            'error': not_exist_param + ' parameter not send'
        }

    res = use.add_chat(token=parameters['token'],
                       second_user_id=parameters['second_user_id'],
                       chat_name=parameters['chat_name'])
    return res