how to fix the error: name 'event' is not defined bot vk

40 views Asked by At
def loop2():
    while True:
        try:
            time.sleep(2)
            run=random.randint(10000,100000)
            file=open(str(event.obj.peer_id)+".txt","r")
            balans=file.read()
            file.close()
            balans=int(balans)
            balans+=run
            balans=str(balans)
            file=open(str(event.obj.peer_id)+".txt","w")
            file.write(balans)
            file.close()
            print("+ к балансу")
            print(run)
        except Exception as Y:
            print(Y)
Thread(target=loop1).start()
Thread(target=loop2).start()

I want the bot to add a random amount to the balance every minute and not interfere with the dialogue and save it in the database (the database is in my text file)

0

There are 0 answers