16 lines
550 B
Python
16 lines
550 B
Python
import os
|
|
import shutil
|
|
|
|
|
|
def loging(message, service, file_path, text):
|
|
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)
|