"""
今日抽卡统计处理模块

处理今日抽卡统计查询命令。
"""

from nonebot.adapters.onebot.v11 import Bot, MessageEvent, GroupMessageEvent
import nonebot

from ..utils import get_gacha_system
from .. import formatters

logger = nonebot.logger


async def handle_daily_stats(bot: Bot, event: MessageEvent, state: dict):
    """处理今日抽卡统计命令"""
    gacha_system = get_gacha_system()
    daily_stats = await gacha_system.get_daily_stats()
    
    if not daily_stats or daily_stats.get("today_total", 0) == 0:
        await event.finish("今日暂无抽卡记录")
    
    msg = formatters.format_daily_stats(daily_stats)
    await event.send(msg)
