Exemple #1
0
async def update_reach(num, path_file, path_drop):
    global reach
    f = open(path_file, "w")
    f.write(str(num))
    f.close()

    use.drop_up(path_drop, path_file)
Exemple #2
0
async def delete_com(client, member, invoke):
    download_custom()

    id = member.id

    path_file = "data/temp/custom.txt"
    path_drop = "/Gear_Two/custom.txt"

    with open(path_file) as f:
        content = f.readlines()
        content = [x.strip() for x in content]

    if check_contains(content, id, invoke):
        with open(path_file, "w") as f:
            f.write("0\n")
            for x in content[1:]:
                x_sp = x.split(" ")
                if x_sp[0] != id or x_sp[1] != invoke:
                    f.write(str(x) + "\n")
        use.drop_up(path_drop, path_file)
        await client.send_message(
            member,
            "The command with the trigger \"%s\" has been removed." % invoke)
    else:
        await use.error(
            "There is no command with the trigger: \"%s\"" %
            invoke.replace("_", " "), member, client)
Exemple #3
0
async def create_new_com(client, member, invoke, result):
    download_custom()

    id = member.id

    path_file = "data/temp/custom.txt"
    path_drop = "/Gear_Two/custom.txt"

    with open(path_file) as f:
        content = f.readlines()
        content = [x.strip() for x in content]

    if check_contains(content, id, invoke):
        await use.error(
            "There is already a command with the trigger: \"%s\"" %
            invoke.replace("_", " "), member, client)
    else:
        append_str = "%s %s %s\n" % (id, invoke, result)

        with open(path_file, "a") as f:
            f.write(append_str)
        content = "Success!\nYour command trigger is:\n%s\nThe result will be:\n%s" % (
            invoke.replace("-", " "), result.replace("-", " "))
        await client.send_message(member, content)

        use.drop_up(path_drop, path_file)
Exemple #4
0
def set_antispam_status(num, server):
    file_path = "SETTINGS/" + server.id + "/antispam_status.txt"
    drop_path = "/Gear_Two/antispam_status.txt"

    f = open(file_path, "w")
    f.write(str(num))
    f.close()
    use.drop_up(drop_path, file_path)
Exemple #5
0
def update_status(num):

    path_file = "data/temp/status.txt"
    path_drop = "/Pictures/info/status.txt"
    f = open(path_file, "w")
    f.write(str(num))
    f.close()
    use.drop_up(path_drop, path_file)
Exemple #6
0
def error_process(error):

    path_file = "data/temp/error.txt"
    path_drop = "/Pictures/info/error.txt"

    use.drop_down(path_drop, path_file)

    with open(path_file, "a") as myfile:
        new_id = "\n" + str(error)
        myfile.write(new_id)
        myfile.close()

    use.drop_up(path_drop, path_file)

    os.remove(path_file)
Exemple #7
0
async def set_channel(dbx, client, channel):
    global send_channel
    path_channel = "data/temp/channel.txt"
    channel_id = channel.id
    path_dbx = "/Pictures/info/channel.txt"

    #if not path.isfile(path_channel):

    f = open(path_channel, "w")
    f.write(str(channel_id))
    f.close()

    use.drop_up(path_dbx,path_channel)

    send_channel = channel
Exemple #8
0
async def add_auth2(client, server, channel, member):
    file_path = "SETTINGS/" + server.id + "/permission_type2.txt"
    drop_path = "/Gear_Two/permission_type2.txt"
    try:
        use.drop_down(drop_path, file_path)
    except:
        print("File not in Dropbox.")
    if await use.dev_authorisation_type2(server, member) == False:
        with open(file_path, "a") as myfile:
            new_id = "\n" + str(member.id)
            myfile.write(new_id)
            myfile.close()

        use.drop_up(drop_path, file_path)
        await client.send_message(
            channel, "Authorisation granted to %s" % member.mention)
    else:
        await client.send_message(
            channel, "Member %s already has authorisation2" % member.mention)
Exemple #9
0
def increase_down_count(dbx):


    path_file = "data/info.txt"
    path_drop = "/Pictures/info/name_info.txt"

    metadata, f = dbx.files_download(path_drop)
    numbers = str(f.content).replace("b", "").replace("'", "").split("\\r\\n")
    lastn = int(numbers[len(numbers)-1])+1
    out = open(path_file, 'wb')
    out.write(f.content)
    out.close()
    txt = open(path_file, 'w')
    txt.write(str(lastn))
    txt.close()

    use.drop_up(path_drop,path_file)

    os.remove(path_file)
    return lastn
Exemple #10
0
def update_give_info(user, tday, path_file, path_drop):
    global delta_add
    f = open(path_file, "r")
    lines = f.readlines()
    f.close()

    lines = lines[1:]

    date_line = str(tday + delta_add) + "\n"
    user_line = str(user.id) + " " + str(tday + delta_add) + "\n"

    f = open(path_file, "w")
    f.write(date_line)
    for line in lines:
        line_list = line.split(" ")
        if line_list[0] != str(user.id):
            f.write(line)
    f.write(user_line)
    f.close()

    use.drop_up(path_drop, path_file)
Exemple #11
0
async def delete_auth2(client, server, channel, user):
    file_path = "SETTINGS/" + server.id + "/permission_type2.txt"
    drop_path = "/Gear_Two/permission_type2.txt"
    try:
        use.drop_down(drop_path, file_path)
    except:
        print("File not in Dropbox.")

    if await use.dev_authorisation_type2(server, user):
        f = open(file_path, "r")
        lines = f.readlines()
        f.close()

        f = open(file_path, "w")
        for line in lines:
            if line != str(user.id) + "\n":
                f.write(line)
        f.close()

        use.drop_up(drop_path, file_path)
        await client.send_message(
            channel, "Authorisation off %s deleted!" % user.mention)
    else:
        await client.send_message(channel, "You do not have auth2.")