Exemple #1
0
def uploadGroupFile():
    if request.method == "POST":
        if "groupfile" not in request.files:
            flash("No file part")
            return redirect(request.url)

        groupfile = request.files["groupfile"]
        if groupfile.filename == "":
            flash("No selected file")
            return redirect(request.url)

        if groupfile:
            filename = secure_filename(groupfile.filename)
            path = app.config["UPLOAD_FOLDER"] + "/" + session["username"]
            # path = app.config["UPLOAD_FOLDER"] + "\\" + session["username"]
            groupfile.save(os.path.join(path, filename))

            filepath = path + "/" + filename
            # filepath = path + "\\" + filename

            grouplinks = getExcel(filepath)

            client = TelegramClient("ToGetGroupID", 3845192,
                                    "ee3f76456f539941ef8c223d793c1187")
            with client:
                for link in grouplinks:
                    group = check_and_join(client, link[0])
                    Group.addGroup(
                        session["username"],
                        group["group_id"],
                        group["group_title"],
                        link[0],
                    )
    return redirect(url_for("manageGroups"))
Exemple #2
0
def index():
    # check admin pack
    Customer.admin_pack()
    username = session["username"]
    Customer.update_remaining_days(username)
    # try:
    # group_id = Dialog.get_group_id(username)
    (
        register_time,
        sentences_per_day,
        clone_limit,
        effective_days,
        vip_pack,
        expired_date,
        remaining_days,
    ) = Customer.return_value(username)
    sentences_left = Customer.sentences_check(username)
    groups = Group.getAllGroup(username)

    return render_template(
        "index.html",
        groups=groups,
        username=username,
        sentences_left=sentences_left,
        register_time=register_time.date(),
        sentences_per_day=sentences_per_day,
        clone_limit=clone_limit,
        effective_days=effective_days,
        vip_pack=vip_pack,
        expired_date=expired_date,
        remaining_days=remaining_days,
    )
Exemple #3
0
def addGroup():
    group_link = request.form["grouplink"]
    client = TelegramClient("ToGetGroupID", 3090444,
                            "d9815b9e9afda43ea26738f9000c2439")
    with client:
        join = check_and_join(client, group_link)
        return Group.addGroup(session["username"], join["group_id"],
                              join["group_title"], group_link)
Exemple #4
0
def main_function(username):
    dialogue = Dialog.get_all_message(username)
    for dial in dialogue:
        user = Clone.getCloneWithID(dial.user_id)
        session = "session/" + "{}".format(user.phone)
        api_id = int(user.api_id)
        api_hash = user.api_hash

        phone_number = "84" + str(user.phone)
        group_id = int(dial.group_id)
        grouplinks = Group.getGroupWithID(group_id)
        client = TelegramClient(session=str(session),
                                api_id=api_id,
                                api_hash=api_hash)
        print("Clone", user.id)
        client.connect()
        if check_banned(client, phone_number) is not False:
            check_and_join(client, grouplinks.group_link)
            client.loop.run_until_complete(
                interact(client, group_id, emoji.emojize(dial.content)))
            client.disconnect()
            sleep(dial.delay)
Exemple #5
0
def deleteAllGR():
    customer = session["username"]
    return Group.deleteAllGroup(customer)
Exemple #6
0
def deleteGroup(id):
    customer = session["username"]
    return Group.deleteGroup(customer, id)
Exemple #7
0
def manageGroups():
    groups = Group.getAllGroup(session["username"])
    return render_template("manageGroup.html",
                           title="Groups | MQM Seeding Tool",
                           groups=groups)