MCPcopy Index your code
hub / github.com/AstrBotDevs/AstrBot / count_platform_stats

Method count_platform_stats

astrbot/core/db/sqlite.py:168–178  ·  view source on GitHub ↗

Count the number of platform statistics records.

(self)

Source from the content-addressed store, hash-verified

166 )
167
168 async def count_platform_stats(self) -> int:
169 """Count the number of platform statistics records."""
170 async with self.get_db() as session:
171 session: AsyncSession
172 result = await session.execute(
173 select(func.count(col(PlatformStat.platform_id))).select_from(
174 PlatformStat,
175 ),
176 )
177 count = result.scalar_one_or_none()
178 return count if count is not None else 0
179
180 async def get_platform_stats(self, offset_sec: int = 86400) -> list[PlatformStat]:
181 """Get platform statistics within the specified offset in seconds and group by platform_id."""

Callers

nothing calls this directly

Calls 2

get_dbMethod · 0.45
executeMethod · 0.45

Tested by

no test coverage detected