перешёл на aiogram

This commit is contained in:
2022-12-09 16:47:01 +07:00
parent 949092707c
commit 391c05f1e3
4 changed files with 60 additions and 30 deletions
+14 -1
View File
@@ -1,2 +1,15 @@
import os
import shutil
def loging(message, service, file_path, text):
print(message)
if not os.path.isdir(f"logs/{message.chat.id}"):
os.makedirs(f"logs/{message.chat.id}")
file_name = file_path.split("/")[-1].split(".")
try:
os.makedirs(f"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:
the_file.write(text)