feat: /watch --at HH:MM — hora absoluta en Europe/Madrid
Build & Deploy ResearchOwl / build-and-push (push) Successful in 7s
Build & Deploy ResearchOwl / build-and-push (push) Successful in 7s
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
4bfd27db2c
commit
41e4e3f5d6
+5
-2
@@ -378,13 +378,16 @@ class ResearchDB:
|
||||
|
||||
# --- Watched Topics ---
|
||||
|
||||
async def add_watch(self, topic: str, chat_id: int, interval_hours: int) -> int:
|
||||
async def add_watch(self, topic: str, chat_id: int, interval_hours: int,
|
||||
next_run_at: Optional[float] = None) -> int:
|
||||
now = time.time()
|
||||
if next_run_at is None:
|
||||
next_run_at = now + interval_hours * 3600
|
||||
cursor = await self.db.execute(
|
||||
"""INSERT OR REPLACE INTO watched_topics
|
||||
(topic, chat_id, interval_hours, next_run_at, created_at)
|
||||
VALUES (?, ?, ?, ?, ?)""",
|
||||
(topic, chat_id, interval_hours, now + interval_hours * 3600, now)
|
||||
(topic, chat_id, interval_hours, next_run_at, now)
|
||||
)
|
||||
await self.db.commit()
|
||||
return cursor.lastrowid
|
||||
|
||||
Reference in New Issue
Block a user