бэта сайта, убрал мусор, чуть-чуть допилил код
This commit is contained in:
+7
-5
@@ -15,15 +15,17 @@ def loging(message: types.Message, service: str, file_path: str, text: str, f: f
|
||||
:param f: float - длинна аудиофайла
|
||||
:return: None
|
||||
"""
|
||||
if not os.path.isdir(f"logs/{message.chat.id}"): # если папки нет
|
||||
os.makedirs(f"logs/{message.chat.id}") # создаю папку
|
||||
if not os.path.isdir(f"static/logs/{message.chat.id}"): # если папки нет
|
||||
os.makedirs(f"static/logs/{message.chat.id}") # создаю папку
|
||||
file_name = file_path.split("/")[-1].split(".") # достаю имя файла
|
||||
try: # защита
|
||||
os.makedirs(f"logs/{message.chat.id}/{file_name[0]}") # создание папки
|
||||
os.makedirs(f"static/logs/{message.chat.id}/{file_name[0]}") # создание папки
|
||||
except FileExistsError:
|
||||
pass
|
||||
shutil.copy(file_path, f"logs/{message.chat.id}/{file_name[0]}/audio.{file_name[1]}") # копирование файла
|
||||
with open(f'logs/{message.chat.id}/{file_name[0]}/{service}-text.txt', 'w+') as the_file: # открываю файл в запись
|
||||
shutil.copy(file_path, f"static/logs/{message.chat.id}/{file_name[0]}/audio.{file_name[1]}")
|
||||
# копирование файла
|
||||
with open(f'static/logs/{message.chat.id}/{file_name[0]}/{service}-text.txt', 'w+') as the_file:
|
||||
# открываю файл в запись
|
||||
the_file.write(text) # записываю
|
||||
user_id = message.from_user.id
|
||||
group_id = message.chat.id
|
||||
|
||||
Reference in New Issue
Block a user