feat: add help version notices and user errors

This commit is contained in:
admin committed 2026-10-04 22:26:28 +02:00
1 parent 9e46b7218c
commit 9f32f930db
9 files changed
+256 -30

No files matched your search

+25
View File
@@ -42,6 +42,31 @@ def get_tone_of_voice(user_id: int, db_path: str | None = None) -> str:
return str(row["tone_of_voice"] or "") if row else ""
def get_deploy_notice_version(db_path: str | None = None) -> str:
with closing(connect(db_path)) as connection, connection:
connection.execute(
"CREATE TABLE IF NOT EXISTS app_state (key TEXT PRIMARY KEY, value TEXT NOT NULL)"
)
row = connection.execute(
"SELECT value FROM app_state WHERE key = 'deploy_notice_version'"
).fetchone()
return str(row["value"]) if row else ""
def set_deploy_notice_version(version: str, db_path: str | None = None) -> None:
with closing(connect(db_path)) as connection, connection:
connection.execute(
"CREATE TABLE IF NOT EXISTS app_state (key TEXT PRIMARY KEY, value TEXT NOT NULL)"
)
connection.execute(
"""
INSERT INTO app_state (key, value) VALUES ('deploy_notice_version', ?)
ON CONFLICT(key) DO UPDATE SET value = excluded.value
""",
(version,),
)
def save_tone_of_voice(user_id: int, tone_of_voice: str, db_path: str | None = None) -> None:
tone = tone_of_voice.strip()[:1200]
with closing(connect(db_path)) as connection, connection: