мега обновление всего на свете.

1. добавил chatgpt
2. многое переписал
This commit is contained in:
2023-01-28 14:01:59 +07:00
parent f212f04bc2
commit 6f480bdcb2
23 changed files with 158 additions and 15 deletions
+18 -1
View File
@@ -1,9 +1,10 @@
import os
import shutil
from aiogram import types
import sqlite3
def loging(message: types.Message, service: str, file_path: str, text: str) -> None:
def loging(message: types.Message, service: str, file_path: str, text: str, f: float) -> None:
"""
Функция логирует каждое сообщение
@@ -11,6 +12,7 @@ def loging(message: types.Message, service: str, file_path: str, text: str) -> N
:param service: str - название сервиса для генерации
:param file_path: str - путь до файла
:param text: str - текст который был разобран
:param f: float - длинна аудиофайла
:return: None
"""
if not os.path.isdir(f"logs/{message.chat.id}"): # если папки нет
@@ -23,3 +25,18 @@ def loging(message: types.Message, service: str, file_path: str, text: str) -> N
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) # записываю
user_id = message.from_user.id
group_id = message.chat.id
time = f
user_name = message.from_user.first_name
if message.chat.first_name:
chat_title = message.chat.first_name
else:
chat_title = message.chat.title
print(user_id, group_id, service, time, user_name, chat_title)
conn = sqlite3.connect("db.sql")
cur = conn.cursor()
user = (user_id, group_id, service, time, user_name, chat_title)
cur.execute("INSERT INTO statistic(user_id, group_id, service, time, user_name, chat_title) "
"VALUES(?, ?, ?, ?, ?, ?);", user)
conn.commit()