diff --git a/func.py b/func.py index d6e59ec..14288be 100644 --- a/func.py +++ b/func.py @@ -9,6 +9,14 @@ API_TOKEN = var.API_MAIN bot = telebot.TeleBot(API_TOKEN) +#Get home dir +#from subprocess import getoutput +#global home +#home = getoutput("echo $HOME") + +#Work with OS +from os import system as sys + #Work with JSON import json def read(): @@ -19,6 +27,25 @@ def write(): with open("db.json", "w") as outfile: outfile.write(js) +def readfp(): + with open('fp.json', 'r') as openfile: + var.fp = json.load(openfile) +def writefp(): + js = json.dumps(var.fp, indent=4) + with open("fp.json", "w") as outfile: + outfile.write(js) + +def readtime(): + global home + with open(f'../db.json', 'r') as openfile: + var.dbtime = json.load(openfile) +def writetime(): + js = json.dumps(var.dbtime, indent=4) + with open(f"../db.json", "w") as outfile: + outfile.write(js) +# sys(f'cp time_db.json {home}/db.json') + + #SHA256 for sign import hashlib #Date&Time