helpers

Helper functions for the system domain.

System domain helper functions.

async byte_bot.server.domain.system.helpers.check_byte_status() Status[source]

Check Byte status.

Todo

This is a stub. Need to figure out how to call the current bot instance from here.

Example usage of check_byte_status
async def healthcheck(self) -> Status:
    latency = round(self.bot.latency * 1000, 2)
    ratelimited = self.bot.is_ws_ratelimited()
    ready = self.bot.is_ready()
    if closed := self.bot.is_closed():
        return "offline"
    latency_threshold = 1000
    return (
        "degraded"
        if not ready or ratelimited or latency > latency_threshold
        else "online"
    )
Returns:

Byte status.

Return type:

Status

async byte_bot.server.domain.system.helpers.check_database_status(db_session: AsyncSession) Status[source]

Check database health.

Parameters:

db_session (AsyncSession) – Database session.

Returns:

Database status.

Return type:

Status