Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions interactions/client/auto_shard_client.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import asyncio
import time
from datetime import datetime
from collections import defaultdict
from typing import TYPE_CHECKING, Optional

Expand Down Expand Up @@ -68,6 +69,16 @@ def latencies(self) -> dict[int, float]:
"""
return {state.shard_id: state.latency for state in self._connection_states}

@property
def start_time(self) -> datetime:
"""The start time of the first shard of the bot."""
return next((state.start_time for state in self._connection_states), MISSING) # type: ignore

@property
def start_times(self) -> dict[int, datetime]:
"""The start times of all shards of the bot."""
return {state.shard_id: state.start_time for state in self._connection_states} # type: ignore

async def stop(self) -> None:
"""Shutdown the bot."""
self.logger.debug("Stopping the bot.")
Expand Down