# ╔══════════════════════════════════════════════════════════════════╗ # ║ ║ # ║ +-+-+-+-+-+-+-+-+ ║ # ║ |H|e|x|a|H|o|s|t| ║ # ║ +-+-+-+-+-+-+-+-+ ║ # ║ ║ # ║ © 2026 HexaHost — All Rights Reserved ║ # ║ ║ # ║ discord ── https://discord.gg/hexahost ║ # ║ github ── https://github.com/theoneandonlymace ║ # ║ ║ # ╚══════════════════════════════════════════════════════════════════╝ from fastapi import APIRouter, Depends from api.dependencies import get_bot from api.schemas import BotInfo, BotStatus from typing import TYPE_CHECKING from utils.config import * if TYPE_CHECKING: from core.axiom import Axiom router = APIRouter() @router.get("/status", response_model=BotStatus, summary="Get bot status", description="Returns real-time health metrics, latency, and scale information.") async def get_status(bot: "Axiom" = Depends(get_bot)): """ Returns the live status of the bot. """ shard_ids = list(bot.shards.keys()) if bot.shards else ([0] if bot.shard_count else []) shard_latencies = [ {"id": sid, "latency_ms": round(lat * 1000, 2)} for sid, lat in (bot.latencies or []) ] return BotStatus( user=str(bot.user), id=str(bot.user.id) if bot.user else None, latency=bot.latency * 1000, guild_count=len(bot.guilds), user_count=sum(g.member_count or 0 for g in bot.guilds), shards=bot.shard_count, shard_ids=shard_ids, shard_latencies=shard_latencies, ) @router.get("/info", response_model=BotInfo, summary="Get bot info", description="Returns general information about the bot including command count and user reach.") async def get_bot_info(bot: "Axiom" = Depends(get_bot)): """ Get general information about the Discord bot. """ return BotInfo( name=bot.user.name if bot.user else BRAND_NAME, id=str(bot.user.id) if bot.user else None, guilds=len(bot.guilds), users=sum(g.member_count or 0 for g in bot.guilds), commands=len(bot.commands), latency=f"{round(bot.latency * 1000, 2)}ms" )