refactor: centralize cron session metadata keys

This commit is contained in:
chengyongru
2026-06-12 11:43:23 +08:00
parent 0e3a57b371
commit d9d481bc15
18 changed files with 116 additions and 62 deletions
+12
View File
@@ -0,0 +1,12 @@
"""Shared session key constants and helpers."""
from __future__ import annotations
UNIFIED_SESSION_KEY = "unified:default"
def session_key_for_channel(channel: str, chat_id: str, *, unified_session: bool = False) -> str:
"""Return the session key for a channel/chat pair."""
if unified_session:
return UNIFIED_SESSION_KEY
return f"{channel}:{chat_id}"