from modules.db import shared_db async def init_db(): async with shared_db() as db: await db.executescript(""" CREATE TABLE IF NOT EXISTS groups ( chat_id INTEGER PRIMARY KEY, title TEXT, antispam_on INTEGER DEFAULT 1, added_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ); CREATE TABLE IF NOT EXISTS spam_log ( id INTEGER PRIMARY KEY AUTOINCREMENT, chat_id INTEGER, user_id INTEGER, username TEXT, message TEXT, action TEXT, created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ); CREATE TABLE IF NOT EXISTS user_strikes ( chat_id INTEGER, user_id INTEGER, strikes INTEGER DEFAULT 0, PRIMARY KEY (chat_id, user_id) ); CREATE TABLE IF NOT EXISTS new_members ( chat_id INTEGER, user_id INTEGER, joined_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (chat_id, user_id) ); CREATE TABLE IF NOT EXISTS tos_consent ( chat_id INTEGER PRIMARY KEY, accepted_by INTEGER, accepted_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ); """) await db.commit()