Esempio n. 1
0
def create_auto_mailing(data, group_id):
    comm = DB.Community().get(group_id)
    res = get_sub(data, group_id)
    if not res:
        return None
    users = DB.Users(res[0]).get()
    for user in users:
        status = "Success"
        try:
            Vk.send_message(user[0],
                            message=res[3],
                            post="wall{}_{}".format(data["owner_id"],
                                                    data["id"]),
                            token=comm["token"])
        except Exception as e:
            status = str(e)

        DB.Mail().add(user[0], res[0], res[3],
                      "wall{}_{}".format(data["owner_id"],
                                         data["id"]), "auto", status)
    return status
Esempio n. 2
0
def get_community(data):
    community = DB.Community().get(data["group_id"])
    return community