feat(bot): implement conversational input, forwarded message auto-detection, and button-driven channel config
This commit is contained in:
+12
-2
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user