Files
Advanced-Community-Bot/community/db.py
T
William Kray 034446f28c Include redaction logic:
- redact command to remove messages from a user in a room
- option to redact messages from a user in all space rooms when banned
2025-03-31 15:25:00 -07:00

25 lines
755 B
Python

from __future__ import annotations
from mautrix.util.async_db import UpgradeTable, Connection
upgrade_table = UpgradeTable()
@upgrade_table.register(description="Table initialization")
async def upgrade_v1(conn: Connection) -> None:
await conn.execute(
"""CREATE TABLE user_events (
mxid TEXT PRIMARY KEY,
last_message_timestamp BIGINT NOT NULL,
ignore_inactivity INT
)"""
)
@upgrade_table.register(description="Include message redaction tracking")
async def upgrade_v2(conn: Connection) -> None:
await conn.execute(
"""CREATE TABLE redaction_tasks (
event_id TEXT PRIMARY KEY,
room_id TEXT NOT NULL
)"""
)