diff --git a/astrbot/core/db/__init__.py b/astrbot/core/db/__init__.py index 48ccb6801..2af0428d0 100644 --- a/astrbot/core/db/__init__.py +++ b/astrbot/core/db/__init__.py @@ -184,7 +184,7 @@ class BaseDatabase(abc.ABC): user_id: str, offset_sec: int = 86400, ) -> None: - """Delete platform message history records older than the specified offset.""" + """Delete platform message history records newer than the specified offset.""" ... @abc.abstractmethod diff --git a/astrbot/core/db/sqlite.py b/astrbot/core/db/sqlite.py index 202c9d892..140fb2a26 100644 --- a/astrbot/core/db/sqlite.py +++ b/astrbot/core/db/sqlite.py @@ -414,7 +414,7 @@ class SQLiteDatabase(BaseDatabase): user_id, offset_sec=86400, ): - """Delete platform message history records older than the specified offset.""" + """Delete platform message history records newer than the specified offset.""" async with self.get_db() as session: session: AsyncSession async with session.begin(): @@ -424,7 +424,7 @@ class SQLiteDatabase(BaseDatabase): delete(PlatformMessageHistory).where( col(PlatformMessageHistory.platform_id) == platform_id, col(PlatformMessageHistory.user_id) == user_id, - col(PlatformMessageHistory.created_at) < cutoff_time, + col(PlatformMessageHistory.created_at) >= cutoff_time, ), )