Source code for sidequest_common.schemas.signup_notices

 1"""New-signup officer notice outbox, and bot-key roster confirmation by Discord id.
 2
 3The bot polls ``GET /api/guilds/{guild_id}/signup-notices`` for members it hasn't posted a notice embed for yet
 4(``pending``), and for already-posted notices whose embed is stale because the member was confirmed on the site
 5since (``resolved``: needs its message edited to say so). ``POST .../signup-notices/{member_id}/ack`` tells the API
 6the bot's message now accurately reflects the member's state, for both cases.
 7"""
 8
 9from datetime import datetime
10
11from pydantic import BaseModel, Field
12
13from sidequest_common.schemas.member_profiles import MemberProfileIn
14
15
[docs] 16class SignupNoticeCandidate(BaseModel): 17 """One member who has never had a signup notice posted for them, oldest first.""" 18 19 member_id: int 20 discord_id: str 21 display_name: str 22 username: str 23 avatar_hash: str | None 24 battletag: str | None 25 roster_confirmed: bool 26 confirmed_from_roster: bool = False 27 """Confirmed automatically: one of the member's Battle.net characters is in the in-game guild.""" 28 guild_characters: list[str] = [] 29 """Their characters on the Battle.net guild roster ("Name Surname"), the one that joined the guild first leading.""" 30 created_at: datetime
31 32
[docs] 33class SignupNoticeResolution(BaseModel): 34 """One posted notice whose message no longer reflects the member's state (confirmed since, e.g. on the site).""" 35 36 member_id: int 37 discord_id: str 38 display_name: str 39 channel_id: str 40 message_id: str 41 confirmed_by: str | None = Field( 42 description="The Quest Guide's display name as recorded in the officer audit log for the confirmation, " 43 "if found." 44 ) 45 confirmed_from_roster: bool = False 46 """Confirmed automatically from the Battle.net guild roster, not by a Quest Master (``confirmed_by`` is null).""" 47 guild_characters: list[str] = [] 48 """As on the candidate: by now the roster may know characters it didn't when the notice was posted."""
49 50
[docs] 51class SignupNoticesPage(BaseModel): 52 """API -> bot: what the signup-notices poll should act on this tick.""" 53 54 pending: list[SignupNoticeCandidate] 55 resolved: list[SignupNoticeResolution]
56 57
[docs] 58class SignupNoticeAck(BaseModel): 59 """Bot -> API: the notice message for this member now accurately reflects their current state.""" 60 61 channel_id: int 62 message_id: int
63 64
[docs] 65class ConfirmByDiscordRequest(BaseModel): 66 """Bot -> API: a Discord user (identified by snowflake) is taking a roster-confirmation action. 67 68 ``actor_name`` is the clicking user's live Discord display name, used as the ``officer_audit`` actor snapshot 69 only if ``actor_discord_id`` has no ``Member`` row of its own (defensive fallback; the GM gate itself requires 70 a ``Member`` row with a configured GM role, so this normally isn't reached). 71 """ 72 73 actor_discord_id: str 74 actor_name: str
75 76
[docs] 77class DiscordRosterConfirmRequest(ConfirmByDiscordRequest): 78 """Bot -> API: a Quest Master confirms a Discord member on the guild roster from Discord (**Confirm in guild**). 79 80 ``profile`` is the target's current Discord profile; it creates their ``Member`` row (never signed in, so 81 ``last_login_at`` stays null) if they have none, or refreshes it like a ``member-profiles`` push if they do. 82 """ 83 84 profile: MemberProfileIn