merge: T50 time_skip event handlers
This commit is contained in:
@@ -29,6 +29,34 @@ def _apply_chat_created(conn: Connection, e: Event) -> None:
|
||||
)
|
||||
|
||||
|
||||
@on("time_skip_elision")
|
||||
def _apply_time_skip_elision(conn: Connection, e: Event) -> None:
|
||||
p = e.payload
|
||||
conn.execute(
|
||||
"UPDATE chat_state SET time = ? WHERE chat_id = ?",
|
||||
(p["new_time"], p["chat_id"]),
|
||||
)
|
||||
|
||||
|
||||
@on("time_skip_jump")
|
||||
def _apply_time_skip_jump(conn: Connection, e: Event) -> None:
|
||||
p = e.payload
|
||||
chat_id = p["chat_id"]
|
||||
conn.execute(
|
||||
"UPDATE chat_state SET time = ? WHERE chat_id = ?",
|
||||
(p["new_time"], chat_id),
|
||||
)
|
||||
if p.get("reset_activity", False):
|
||||
# Activity rows are keyed by entity_id with a container_id FK.
|
||||
# Each chat owns its containers, so deleting activity rows whose
|
||||
# container_id belongs to this chat clears every present entity.
|
||||
conn.execute(
|
||||
"DELETE FROM activity "
|
||||
"WHERE container_id IN (SELECT id FROM containers WHERE chat_id = ?)",
|
||||
(chat_id,),
|
||||
)
|
||||
|
||||
|
||||
@on("guest_added")
|
||||
def _apply_guest_added(conn: Connection, e: Event) -> None:
|
||||
p = e.payload
|
||||
|
||||
Reference in New Issue
Block a user