groups ====== .. py:module:: sidequest_common.schemas.groups .. autoapi-nested-parse:: Group voice channel schemas: the bot's session reports, and the officer stats and public leaderboard. Discord snowflakes are strings on the wire (browsers can't hold them in a JS number). .. py:data:: GROUP_KINDS :type: tuple[sidequest_common.schemas.events.EventKind, ...] The kinds the ``#lfg`` panel offers, in button order. ``social`` is the panel's "Hangout". .. py:data:: GROUP_KIND_LABELS :type: dict[sidequest_common.schemas.events.EventKind, str] .. py:data:: GROUP_KIND_PREFIX :type: dict[sidequest_common.schemas.events.EventKind, str] ``dungeon-1`` by default, ``dungeon-deadmines`` once named. :type: Channel name prefix .. py:data:: GROUP_KIND_DEFAULT_CAP :type: dict[sidequest_common.schemas.events.EventKind, int | None] Voice user limit a new channel gets; ``None`` is no limit. The owner can change it. .. py:data:: MAX_GROUP_CAP :value: 99 Discord's voice channel user limit ceiling. .. py:data:: MAX_LIVE_GROUPS :value: 15 Group channels allowed at once across the server. .. py:data:: EMPTY_GRACE_SECONDS :value: 120 How long a group channel may sit empty (or unjoined after creation) before it is torn down. .. py:data:: COUNTED_GROUP_MINUTES :value: 10 A session counts toward stats once two or more members spent this many minutes in it together. .. py:data:: GROUP_TRANSCRIPT_RETENTION_DAYS :value: 30 .. py:data:: PARTY_ANIMAL_THRESHOLD :value: 50 Counted groups a member must take part in (10+ minutes each) for the Party Animal badge. .. py:data:: PARTY_LEADER_THRESHOLD :value: 25 Counted groups a member must start for the Party Leader badge. .. py:data:: CROSSROADS_HOST_THRESHOLD :value: 10 Counted PUG groups a member must start for the Crossroads Host badge (the first one earns Open Road). .. py:data:: CARAVAN_MASTER_THRESHOLD :value: 25 Counted PUG groups a member must start for the Caravan Master badge. .. py:data:: MAX_GROUP_NAME_LENGTH :value: 80 .. py:data:: MAX_GROUP_NOTE_LENGTH :value: 200 .. py:data:: MAX_TRANSCRIPT_MESSAGES :value: 2000 .. py:class:: GroupEndReason Bases: :py:obj:`enum.StrEnum` Why a group channel was torn down. .. py:attribute:: EMPTY :value: 'empty' Everyone left and it stayed empty for ``EMPTY_GRACE_SECONDS``. .. py:attribute:: UNJOINED :value: 'unjoined' Nobody joined within ``EMPTY_GRACE_SECONDS`` of creation. .. py:attribute:: OWNER :value: 'owner' The owner pressed End. .. py:attribute:: LOST :value: 'lost' The channel disappeared (deleted by hand, or gone when the bot came back up). .. py:class:: GroupMemberMinutes Bases: :py:obj:`pydantic.BaseModel` One member's cumulative minutes in a group channel, so far. .. py:attribute:: discord_id :type: str .. py:attribute:: display_name :type: str .. py:attribute:: minutes :type: int .. py:class:: GroupPairMinutes Bases: :py:obj:`pydantic.BaseModel` Cumulative minutes two members spent in a group channel together. ``discord_id_a < discord_id_b``. .. py:attribute:: discord_id_a :type: str .. py:attribute:: discord_id_b :type: str .. py:attribute:: minutes :type: int .. py:class:: GroupPresenceReport Bases: :py:obj:`pydantic.BaseModel` Bot -> API: a group channel's cumulative presence so far. Idempotent like ``VoicePresenceReport``: every number is stored as ``max(existing, reported)``, so the bot can push repeatedly, including after a restart resumed its counters from ``GroupSessionSchema``. .. py:attribute:: peak_size :type: int .. py:attribute:: grouped_minutes :type: int .. py:attribute:: pug_minutes :type: int Minutes with at least one guild member and one outside player (PUG role holder) present together. .. py:attribute:: members :type: list[GroupMemberMinutes] .. py:attribute:: pairs :type: list[GroupPairMinutes] .. py:class:: GroupSessionCreate Bases: :py:obj:`pydantic.BaseModel` Body for ``POST /api/guilds/{id}/groups``: the bot just created a group channel. .. py:attribute:: discord_channel_id :type: str .. py:attribute:: channel_name :type: str .. py:attribute:: kind :type: sidequest_common.schemas.events.EventKind .. py:attribute:: creator_discord_id :type: str .. py:attribute:: name :type: str | None .. py:attribute:: note :type: str | None .. py:attribute:: needs :type: list[sidequest_common.schemas.events.SignupRole] .. py:attribute:: cap :type: int | None .. py:attribute:: event_id :type: uuid.UUID | None :value: None .. py:attribute:: card_message_id :type: str | None :value: None .. py:attribute:: pug_role_id :type: str | None :value: None the temporary Discord role its invite grants to outside players. :type: Set for a PUG group .. py:class:: GroupSessionUpdate Bases: :py:obj:`pydantic.BaseModel` Body for ``PATCH /api/guilds/{id}/groups/{session_id}``. Only fields sent change; send ``null`` to clear. .. py:attribute:: channel_name :type: str | None ``null`` leaves it as is. :type: Never cleared .. py:attribute:: name :type: str | None .. py:attribute:: note :type: str | None .. py:attribute:: needs :type: list[sidequest_common.schemas.events.SignupRole] | None :value: None .. py:attribute:: cap :type: int | None .. py:attribute:: owner_discord_id :type: str | None :value: None .. py:attribute:: card_message_id :type: str | None :value: None .. py:class:: GroupTranscriptMessage Bases: :py:obj:`pydantic.BaseModel` One message from a group channel's text chat. .. py:attribute:: author_discord_id :type: str .. py:attribute:: author_name :type: str .. py:attribute:: content :type: str .. py:attribute:: created_at :type: datetime.datetime .. py:attribute:: attachments :type: list[str] Attachment URLs. Discord's CDN links expire, so these are a pointer, not a copy. .. py:class:: GroupSessionClose Bases: :py:obj:`pydantic.BaseModel` Body for ``POST /api/guilds/{id}/groups/{session_id}/close``. Closing twice keeps the first close. .. py:attribute:: end_reason :type: GroupEndReason .. py:attribute:: presence :type: GroupPresenceReport .. py:attribute:: transcript :type: list[GroupTranscriptMessage] .. py:class:: GroupSessionSchema Bases: :py:obj:`pydantic.BaseModel` A group session as the bot sees it: settings plus presence so far, so a restarted bot can resume counting. .. py:attribute:: id :type: uuid.UUID .. py:attribute:: discord_channel_id :type: str .. py:attribute:: channel_name :type: str .. py:attribute:: kind :type: sidequest_common.schemas.events.EventKind .. py:attribute:: name :type: str | None .. py:attribute:: note :type: str | None .. py:attribute:: needs :type: list[sidequest_common.schemas.events.SignupRole] .. py:attribute:: cap :type: int | None .. py:attribute:: creator_discord_id :type: str .. py:attribute:: owner_discord_id :type: str .. py:attribute:: event_id :type: uuid.UUID | None .. py:attribute:: card_message_id :type: str | None .. py:attribute:: pug_role_id :type: str | None :value: None .. py:attribute:: started_at :type: datetime.datetime .. py:attribute:: ended_at :type: datetime.datetime | None .. py:attribute:: end_reason :type: GroupEndReason | None .. py:attribute:: peak_size :type: int .. py:attribute:: grouped_minutes :type: int .. py:attribute:: pug_minutes :type: int :value: 0 .. py:attribute:: members :type: list[GroupMemberMinutes] .. py:attribute:: pairs :type: list[GroupPairMinutes] .. py:class:: GroupTranscriptPurge Bases: :py:obj:`pydantic.BaseModel` Reply from ``POST /api/guilds/{id}/groups/purge``: transcripts deleted for being past retention. .. py:attribute:: deleted :type: int .. py:class:: GroupPerson Bases: :py:obj:`pydantic.BaseModel` Someone on a stats list. ``member_id`` is set when they have a site account (links to their profile). .. py:attribute:: discord_id :type: str .. py:attribute:: display_name :type: str .. py:attribute:: member_id :type: int | None :value: None .. py:class:: GroupPersonStat Bases: :py:obj:`pydantic.BaseModel` One person's line on a stats list: ``value`` is minutes, groups, or partners depending on the list. .. py:attribute:: person :type: GroupPerson .. py:attribute:: value :type: int .. py:attribute:: sessions :type: int .. py:class:: GroupDuoStat Bases: :py:obj:`pydantic.BaseModel` Two people who grouped together. .. py:attribute:: a :type: GroupPerson .. py:attribute:: b :type: GroupPerson .. py:attribute:: minutes :type: int .. py:attribute:: sessions :type: int .. py:class:: GroupKindStat Bases: :py:obj:`pydantic.BaseModel` Counted sessions and member-minutes for one kind. .. py:attribute:: kind :type: sidequest_common.schemas.events.EventKind .. py:attribute:: sessions :type: int .. py:attribute:: minutes :type: int .. py:class:: GroupInstanceStat Bases: :py:obj:`pydantic.BaseModel` How often a named group (an instance, usually) was run. .. py:attribute:: kind :type: sidequest_common.schemas.events.EventKind .. py:attribute:: name :type: str .. py:attribute:: sessions :type: int .. py:class:: GroupHourStat Bases: :py:obj:`pydantic.BaseModel` Counted sessions that started in one weekday/hour slot, America/Chicago. ``weekday`` 0 is Monday. .. py:attribute:: weekday :type: int .. py:attribute:: hour :type: int .. py:attribute:: sessions :type: int .. py:class:: GroupStats Bases: :py:obj:`pydantic.BaseModel` ``GET /api/groups/stats`` (officer): who groups, with whom, and what, over the last ``days`` days. Only counted sessions (see ``COUNTED_GROUP_MINUTES``) feed the lists; ``sessions_total`` includes the rest. Lists hold at most ten lines each. .. py:attribute:: days :type: int .. py:attribute:: sessions_total :type: int .. py:attribute:: sessions_counted :type: int .. py:attribute:: grouped_minutes :type: int .. py:attribute:: by_kind :type: list[GroupKindStat] .. py:attribute:: top_instances :type: list[GroupInstanceStat] .. py:attribute:: most_grouped :type: list[GroupPersonStat] .. py:attribute:: most_social :type: list[GroupPersonStat] .. py:attribute:: best_duos :type: list[GroupDuoStat] .. py:attribute:: most_led :type: list[GroupPersonStat] .. py:attribute:: busy_hours :type: list[GroupHourStat] .. py:class:: GroupSessionSummary Bases: :py:obj:`pydantic.BaseModel` One line on ``GET /api/groups/sessions`` (officer). .. py:attribute:: id :type: uuid.UUID .. py:attribute:: kind :type: sidequest_common.schemas.events.EventKind .. py:attribute:: name :type: str | None .. py:attribute:: channel_name :type: str .. py:attribute:: creator :type: GroupPerson .. py:attribute:: event_id :type: uuid.UUID | None .. py:attribute:: started_at :type: datetime.datetime .. py:attribute:: ended_at :type: datetime.datetime | None .. py:attribute:: end_reason :type: GroupEndReason | None .. py:attribute:: peak_size :type: int .. py:attribute:: grouped_minutes :type: int .. py:attribute:: counted :type: bool .. py:attribute:: has_transcript :type: bool .. py:class:: GroupSessionDetail Bases: :py:obj:`GroupSessionSummary` ``GET /api/groups/sessions/{id}`` (officer): one session with who was in it and its chat, if still kept. .. py:attribute:: note :type: str | None .. py:attribute:: needs :type: list[sidequest_common.schemas.events.SignupRole] .. py:attribute:: members :type: list[GroupPersonStat] .. py:attribute:: transcript :type: list[GroupTranscriptMessage] | None .. py:attribute:: transcript_expires_at :type: datetime.datetime | None .. py:class:: GroupLeaderboardRow Bases: :py:obj:`pydantic.BaseModel` One line on the public "most grouped" board. Only members with a site account appear. .. py:attribute:: member_id :type: int .. py:attribute:: display_name :type: str .. py:attribute:: groups :type: int .. py:attribute:: minutes :type: int .. py:class:: GroupLeaderboard Bases: :py:obj:`pydantic.BaseModel` ``GET /api/groups/leaderboard`` (public): members by counted groups joined, last 30 days and all time. .. py:attribute:: month :type: list[GroupLeaderboardRow] .. py:attribute:: all_time :type: list[GroupLeaderboardRow]