feat(bot): implement conversational input, forwarded message auto-detection, and button-driven channel config

This commit is contained in:
mamad
2026-08-27 22:35:07 +03:30
parent afd99c41f3
commit f7c80b68d2
2 changed files with 366 additions and 259 deletions
+12 -2
View File
@@ -48,12 +48,22 @@ class Repository:
rows = await conn.fetch("SELECT * FROM sources WHERE is_active = TRUE ORDER BY id ASC;")
return [SourceChannel(**dict(r)) for r in rows]
async def get_source_by_channel_id(self, channel_id: int) -> Optional[SourceChannel]:
async def get_source_by_id(self, source_id: int) -> Optional[SourceChannel]:
pool = await self._get_pool()
async with pool.acquire() as conn:
row = await conn.fetchrow("SELECT * FROM sources WHERE channel_id = $1;", channel_id)
row = await conn.fetchrow("SELECT * FROM sources WHERE id = $1;", source_id)
return SourceChannel(**dict(row)) if row else None
async def delete_source(self, source_id: int) -> None:
pool = await self._get_pool()
async with pool.acquire() as conn:
await conn.execute("UPDATE sources SET is_active = FALSE WHERE id = $1;", source_id)
async def delete_target(self, target_id: int) -> None:
pool = await self._get_pool()
async with pool.acquire() as conn:
await conn.execute("UPDATE targets SET is_active = FALSE WHERE id = $1;", target_id)
# --- Target Channels ---
async def add_target(
self,