бэта сайта, убрал мусор, чуть-чуть допилил код

This commit is contained in:
2023-04-27 16:27:23 +07:00
parent 9aca8ad10e
commit e7a2be67ff
12 changed files with 237 additions and 198 deletions
+7 -5
View File
@@ -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