groups ====== .. py:module:: sidequest_common.models.groups .. autoapi-nested-parse:: Group voice channels: short-lived Discord voice channels members spawn from the ``#lfg`` panel. The bot creates the channel and a ``GroupSession`` row, reports who is in it while it lives, and closes the session (with the channel's text chat) when the channel empties. Officers read the stats; the transcript is purged after ``GROUP_TRANSCRIPT_RETENTION_DAYS``. .. py:class:: GroupSession Bases: :py:obj:`advanced_alchemy.base.UUIDAuditBase` One group voice channel's life, from the panel click to teardown. ``kind`` is an ``EventKind`` value from ``GROUP_KINDS``. ``event_id`` is set when the channel was opened from a scheduled guild event. ``peak_size`` and ``grouped_minutes`` (minutes with two or more members present) only ever rise; a session counts toward stats when ``peak_size >= 2`` and ``grouped_minutes >= COUNTED_GROUP_MINUTES``. ``pug_role_id`` is set for a PUG group: the temporary Discord role its invite link grants to outside players, allowed into this channel only. The bot deletes the role when the group ends. ``pug_minutes`` (only ever rises) counts minutes with at least one guild member and one of those outside players present together; a PUG group counts toward its creator's PUG-host badges once it reaches ``COUNTED_GROUP_MINUTES``. .. py:attribute:: discord_channel_id :type: sqlalchemy.orm.Mapped[int] .. py:attribute:: channel_name :type: sqlalchemy.orm.Mapped[str] .. py:attribute:: kind :type: sqlalchemy.orm.Mapped[str] .. py:attribute:: name :type: sqlalchemy.orm.Mapped[str | None] .. py:attribute:: note :type: sqlalchemy.orm.Mapped[str | None] .. py:attribute:: needs :type: sqlalchemy.orm.Mapped[list[str]] .. py:attribute:: cap :type: sqlalchemy.orm.Mapped[int | None] .. py:attribute:: creator_discord_id :type: sqlalchemy.orm.Mapped[int] .. py:attribute:: owner_discord_id :type: sqlalchemy.orm.Mapped[int] .. py:attribute:: event_id :type: sqlalchemy.orm.Mapped[uuid.UUID | None] .. py:attribute:: card_message_id :type: sqlalchemy.orm.Mapped[int | None] .. py:attribute:: pug_role_id :type: sqlalchemy.orm.Mapped[int | None] .. py:attribute:: started_at :type: sqlalchemy.orm.Mapped[datetime.datetime] .. py:attribute:: ended_at :type: sqlalchemy.orm.Mapped[datetime.datetime | None] .. py:attribute:: end_reason :type: sqlalchemy.orm.Mapped[str | None] .. py:attribute:: peak_size :type: sqlalchemy.orm.Mapped[int] .. py:attribute:: grouped_minutes :type: sqlalchemy.orm.Mapped[int] .. py:attribute:: pug_minutes :type: sqlalchemy.orm.Mapped[int] .. py:class:: GroupSessionMember Bases: :py:obj:`advanced_alchemy.base.UUIDAuditBase` Minutes one Discord member spent in one group channel. Bot-reported; stored as ``max(existing, reported)``. .. py:attribute:: session_id :type: sqlalchemy.orm.Mapped[uuid.UUID] .. py:attribute:: discord_id :type: sqlalchemy.orm.Mapped[int] .. py:attribute:: display_name :type: sqlalchemy.orm.Mapped[str] .. py:attribute:: minutes :type: sqlalchemy.orm.Mapped[int] .. py:class:: GroupSessionPair Bases: :py:obj:`advanced_alchemy.base.UUIDAuditBase` Minutes two members spent in the same group channel together. ``discord_id_a < discord_id_b`` always. .. py:attribute:: session_id :type: sqlalchemy.orm.Mapped[uuid.UUID] .. py:attribute:: discord_id_a :type: sqlalchemy.orm.Mapped[int] .. py:attribute:: discord_id_b :type: sqlalchemy.orm.Mapped[int] .. py:attribute:: minutes :type: sqlalchemy.orm.Mapped[int] .. py:class:: GroupSessionTranscript Bases: :py:obj:`advanced_alchemy.base.UUIDAuditBase` A closed group channel's text chat, kept for moderation and purged after the retention window. ``messages`` is a list of ``GroupTranscriptMessage`` dicts, oldest first. .. py:attribute:: session_id :type: sqlalchemy.orm.Mapped[uuid.UUID] .. py:attribute:: messages :type: sqlalchemy.orm.Mapped[list[dict[str, object]]]