Source code for sidequest_common.schemas.discord_live

 1"""Live Discord presence/voice-channel status, counts only (never names or ids)."""
 2
 3from datetime import datetime
 4
 5from pydantic import BaseModel, Field
 6
 7
[docs] 8class VoiceChannelCount(BaseModel): 9 """One voice/stage channel the bot reported on.""" 10 11 name: str = Field(description='Discord channel name as shown, for example "dungeon-1" or "Lobby".') 12 count: int = Field(ge=0, description="Members connected right now, not counting bots.")
13 14
[docs] 15class DiscordLiveReport(BaseModel): 16 """Bot -> API: what the guild looks like right now.""" 17 18 online: int | None = Field(default=None, description="Guild.approximate_presence_count. None if the fetch failed.") 19 members: int | None = Field(default=None, description="Guild.approximate_member_count.") 20 voice: list[VoiceChannelCount] = Field( 21 description="Every voice or stage channel @everyone can view, in Discord's channel order. " 22 "Includes channels with zero members connected." 23 )
24 25
[docs] 26class DiscordLive(BaseModel): 27 """API -> website (public): the guild's live status, or empty if the bot hasn't reported recently.""" 28 29 online: int | None 30 members: int | None 31 voice: list[VoiceChannelCount] 32 reported_at: datetime | None = Field(description="When the bot last reported this status.")