2023-11-02 20:12:36 +00:00
|
|
|
#!/usr/bin/python3
|
|
|
|
# -- coding: utf-8 --
|
|
|
|
|
|
|
|
import os, uuid
|
|
|
|
from datetime import datetime
|
|
|
|
from lang import LANG as msg
|
|
|
|
from db import PATH
|
|
|
|
|
|
|
|
def dt():
|
|
|
|
date = datetime.now().date()
|
|
|
|
time = datetime.now().time()
|
|
|
|
str = f'{date} | {time.strftime("%H:%M:%S")}'
|
|
|
|
return str
|
|
|
|
|
2023-11-03 14:43:50 +00:00
|
|
|
DEFAULT = [f'{dt()} LOG: ',f'{dt()} ERROR: ']
|
2023-11-02 20:12:36 +00:00
|
|
|
ID = str(uuid.uuid1())[0:7]
|
|
|
|
FILE = f'{ID}.txt'
|
|
|
|
|
|
|
|
def file(log):
|
|
|
|
if os.path.exists(f'{PATH}logs') == False:
|
|
|
|
os.mkdir(f'{PATH}logs')
|
|
|
|
with open(f'{PATH}logs/{FILE}','a') as logfile:
|
|
|
|
logfile.write(f'{log}\n')
|
|
|
|
logfile.close()
|
|
|
|
|
|
|
|
def start():
|
2023-11-03 14:43:50 +00:00
|
|
|
log1 = DEFAULT[0] + str(msg.get('l_create').format(FILE))
|
|
|
|
log2 = DEFAULT[0] + str(msg.get('l_start'))
|
2023-11-02 20:12:36 +00:00
|
|
|
file(log2)
|
|
|
|
print(f'{log1}\n{log2}')
|
|
|
|
|
2023-11-03 14:23:22 +00:00
|
|
|
def auth(name,id):
|
2023-11-03 14:43:50 +00:00
|
|
|
log = DEFAULT[0] + str(msg.get('l_auth').format(name,id))
|
2023-11-02 20:12:36 +00:00
|
|
|
file(log)
|
|
|
|
print(log)
|
|
|
|
|
2023-11-03 14:23:22 +00:00
|
|
|
def add(name,id,folder,path):
|
2023-11-03 14:43:50 +00:00
|
|
|
log = DEFAULT[0] + str(msg.get('l_add').format(name,id,folder,path))
|
2023-11-02 20:12:36 +00:00
|
|
|
file(log)
|
|
|
|
print(log)
|
|
|
|
|
2023-11-03 14:23:22 +00:00
|
|
|
def rm(name,id,folder):
|
2023-11-03 14:43:50 +00:00
|
|
|
log = DEFAULT[0] + str(msg.get('l_rm').format(name,id,folder))
|
2023-11-02 20:12:36 +00:00
|
|
|
file(log)
|
|
|
|
print(log)
|
|
|
|
|
2023-11-03 14:23:22 +00:00
|
|
|
def addfile(name,id,filename):
|
2023-11-03 14:43:50 +00:00
|
|
|
log = DEFAULT[0] + str(msg.get('l_file').format(name,id,filename[9:]))
|
2023-11-02 20:12:36 +00:00
|
|
|
file(log)
|
|
|
|
print(log)
|
|
|
|
|
2023-11-03 14:23:22 +00:00
|
|
|
def addmagnet(name,id,link):
|
2023-11-03 14:43:50 +00:00
|
|
|
log = DEFAULT[0] + str(msg.get('l_magnet').format(name,id,link))
|
2023-11-02 20:12:36 +00:00
|
|
|
file(log)
|
|
|
|
print(log)
|
2023-11-02 22:38:12 +00:00
|
|
|
|
|
|
|
def errqbt():
|
2023-11-03 14:43:50 +00:00
|
|
|
log = DEFAULT[1] + str(msg.get('l_errqbt'))
|
2023-11-02 22:38:12 +00:00
|
|
|
file(log)
|
|
|
|
print(log)
|
|
|
|
|
|
|
|
def errtelebot():
|
2023-11-03 14:43:50 +00:00
|
|
|
log = DEFAULT[1] + str(msg.get('l_errtele'))
|
2023-11-02 22:38:12 +00:00
|
|
|
file(log)
|
|
|
|
print(log)
|