add fix
This commit is contained in:
parent
6d8591eeb1
commit
b11945cdde
2
telegram-application/poetry.lock
generated
2
telegram-application/poetry.lock
generated
@ -1706,4 +1706,4 @@ propcache = ">=0.2.0"
|
||||
[metadata]
|
||||
lock-version = "2.1"
|
||||
python-versions = ">=3.11, <4.0"
|
||||
content-hash = "4c5bdf8bea56a29cbf6eb743a2c3e1214b327580f86788e9bdbf609a379732af"
|
||||
content-hash = "65b93102052fc6bdc2add0c17d35a9b9d32f43265ea51509de7ef1dc24bd1123"
|
||||
|
@ -8,7 +8,6 @@ authors = [
|
||||
readme = "README.md"
|
||||
requires-python = ">=3.11, <4.0"
|
||||
dependencies = [
|
||||
"pyrogram (>=2.0.106,<3.0.0)",
|
||||
"tgcrypto (>=1.2.5,<2.0.0)",
|
||||
"kurigram (>=2.1.37,<3.0.0)",
|
||||
"httpx (>=0.28.1,<0.29.0)",
|
||||
@ -19,7 +18,8 @@ dependencies = [
|
||||
"google-generativeai (>=0.8.4,<0.9.0)",
|
||||
"faststream[rabbitmq] (>=0.5.34,<0.6.0)",
|
||||
"asyncpg (>=0.30.0,<0.31.0)",
|
||||
"aio-pika (>=9.5.4,<10.0.0)"
|
||||
"aio-pika (>=9.5.4,<10.0.0)",
|
||||
"pyrogram (>=2.0.106,<3.0.0)"
|
||||
]
|
||||
|
||||
|
||||
|
7
telegram-application/src/core/settings/account.py
Normal file
7
telegram-application/src/core/settings/account.py
Normal file
@ -0,0 +1,7 @@
|
||||
from pydantic import BaseModel
|
||||
|
||||
|
||||
class AccountSettings(BaseModel):
|
||||
API_ID: int
|
||||
API_HASH: str
|
||||
NAME: str = "tg_account"
|
@ -1,6 +1,7 @@
|
||||
from pydantic_settings import BaseSettings, SettingsConfigDict
|
||||
|
||||
from src.core.common.constants import PydanticEnvPrefixEnum, EnvFileLocation, EnvironmentEnum
|
||||
from src.core.settings.account import AccountSettings
|
||||
from src.core.settings.bot import BotSettings
|
||||
|
||||
from src.core.settings.database import DatabaseSettings
|
||||
@ -27,6 +28,7 @@ class Settings(BaseSettings):
|
||||
|
||||
NOTIFY: NotifySettings = NotifySettings()
|
||||
BOT: BotSettings
|
||||
ACCOUNT: AccountSettings
|
||||
|
||||
GROQ: GroqSettings
|
||||
GEMINI: GeminiSettings
|
||||
|
@ -1 +1 @@
|
||||
MESSAGE_CHANG_SIZE: int = 2
|
||||
MESSAGE_CHANG_SIZE: int = 20
|
@ -10,6 +10,7 @@ DATA: dict[int, list[MessageFromChatSchema]] = dict()
|
||||
|
||||
|
||||
async def message_listener(client: Client, message: Message):
|
||||
print("received message")
|
||||
if api_tg_utils.check_message_condition(message):
|
||||
await check_user_exists(
|
||||
user_pyrogram=message.from_user,
|
||||
|
@ -17,6 +17,6 @@ async def notify_for_success(
|
||||
chat=chat,
|
||||
)
|
||||
|
||||
await send_to_tg_from_bot(
|
||||
text=message
|
||||
)
|
||||
# await send_to_tg_from_bot(
|
||||
# text=message
|
||||
# )
|
@ -22,20 +22,21 @@ def create_and_format_message(
|
||||
user_model: User,
|
||||
) -> str:
|
||||
if user_model.username:
|
||||
user_link = f"{user_model.username}](tg://user?id={user_model.id})"
|
||||
user_link = f"[{user_model.username}](tg://user?id={user_model.id})"
|
||||
else:
|
||||
user_link = f"ID: {user_model.id}"
|
||||
|
||||
messages_text = "\n".join(
|
||||
f"{msg.message_time.isoformat()}: {msg.text}\n" for msg in messages
|
||||
)
|
||||
messages_text = '```dialog\n' + messages_text + '```'
|
||||
|
||||
chat_link = f"https://t.me/c/{str(chat.id)[4:]}" if str(chat.id).startswith(
|
||||
"-100") else f"https://t.me/{chat.id}"
|
||||
|
||||
return f"""🔥 *Найдена успешка!*
|
||||
👤 *Пользователь:* {user_link}
|
||||
return f""" 🔥 *Найдена успешка!*
|
||||
👤 *Пользователь:* {user_link}\n
|
||||
🐩 *Чат*: [{chat.title}]({chat_link})
|
||||
📌 *Причина:* {reason}
|
||||
|
||||
📝 *Диалог:* {messages_text}
|
||||
"""
|
@ -5,13 +5,11 @@ from src.core.settings.base import settings
|
||||
from src.core.tg_service.messages_handler import message_listener
|
||||
from src.core.rabbitmq.connect import broker, init_queue_and_publisher
|
||||
|
||||
api_id = 17718565
|
||||
api_hash = "72f93973f4227415572f039d4f847082"
|
||||
|
||||
app = Client(
|
||||
name="advatroniks",
|
||||
api_id=api_id,
|
||||
api_hash=api_hash,
|
||||
name=settings.ACCOUNT.NAME,
|
||||
api_id=settings.ACCOUNT.API_ID,
|
||||
api_hash=settings.ACCOUNT.API_HASH,
|
||||
)
|
||||
|
||||
app.add_handler(MessageHandler(
|
||||
|
Loading…
x
Reference in New Issue
Block a user