sidequest_common.schemas.discord_events#

Two-way guild event <-> Discord scheduled event sync: the bot-facing contract.

The API decides what Discord should show (DiscordEventPush); the bot does every Discord call and reports back what Discord actually holds (DiscordEventState). See sidequest_common.models.events.GuildEvent for the hash columns that keep the two sides from echoing each other.

Attributes#

PushAction

upsert: create the event if discord_event_id is None (or it no longer exists), else edit it.

Classes#

ActivityAck

POST /api/guilds/{guild_id}/event-sync/activity/ack: the bot posted these sign-up activity rows.

DiscordEventPush

One guild event whose Discord event is out of date. Fields are Discord-ready (within Discord's limits).

DiscordEventReconcile

POST /api/guilds/{guild_id}/event-sync/reconcile: every scheduled event currently in the guild.

DiscordEventState

What Discord currently holds for one scheduled event, as the bot read it (gateway payload or REST response).

DiscordEventStatus

A Discord scheduled event's status, named the way Discord's EventStatus is.

DiscordInterestReport

PUT /api/guilds/{guild_id}/event-sync/interest/{discord_event_id}: the full interested-user set now.

DiscordPushAck

POST /api/guilds/{guild_id}/event-sync/{event_id}/ack: the bot applied push_hash.

DiscordSyncPending

GET /api/guilds/{guild_id}/event-sync: everything the bot should write to Discord now.

SignupActivity

One unposted sign-up activity row, queued to post as a forum comment on thread_id.

Module Contents#

class sidequest_common.schemas.discord_events.ActivityAck#

Bases: pydantic.BaseModel

POST /api/guilds/{guild_id}/event-sync/activity/ack: the bot posted these sign-up activity rows.

ids: list[uuid.UUID]#
class sidequest_common.schemas.discord_events.DiscordEventPush#

Bases: pydantic.BaseModel

One guild event whose Discord event is out of date. Fields are Discord-ready (within Discord’s limits).

action: PushAction#
counts: sidequest_common.schemas.events.EventCounts#
description: str#
discord_event_id: int | None#
ends_at: datetime.datetime#
event_id: uuid.UUID#
kind: sidequest_common.schemas.events.EventKind#
location: str#
name: str#
push_hash: str#
signup_url: str#
starts_at: datetime.datetime#
thread_id: int | None#
title: str#
class sidequest_common.schemas.discord_events.DiscordEventReconcile#

Bases: pydantic.BaseModel

POST /api/guilds/{guild_id}/event-sync/reconcile: every scheduled event currently in the guild.

Applied like individual updates, then any linked guild event whose event isn’t listed is treated as deleted in Discord, and any tombstone whose event isn’t listed is dropped.

events: list[DiscordEventState]#
class sidequest_common.schemas.discord_events.DiscordEventState#

Bases: pydantic.BaseModel

What Discord currently holds for one scheduled event, as the bot read it (gateway payload or REST response).

channel_id: int | None#
description: str | None = None#
ends_at: datetime.datetime | None = None#
id: int#
location: str | None#
name: str#
starts_at: datetime.datetime#
status: DiscordEventStatus#
class sidequest_common.schemas.discord_events.DiscordEventStatus#

Bases: enum.StrEnum

A Discord scheduled event’s status, named the way Discord’s EventStatus is.

Initialize self. See help(type(self)) for accurate signature.

ACTIVE = 'active'#
CANCELLED = 'cancelled'#
COMPLETED = 'completed'#
SCHEDULED = 'scheduled'#
class sidequest_common.schemas.discord_events.DiscordInterestReport#

Bases: pydantic.BaseModel

PUT /api/guilds/{guild_id}/event-sync/interest/{discord_event_id}: the full interested-user set now.

Replaces the previously reported set for the guild event linked to discord_event_id; a no-op (204) if no guild event is linked to it.

user_ids: list[int]#
class sidequest_common.schemas.discord_events.DiscordPushAck#

Bases: pydantic.BaseModel

POST /api/guilds/{guild_id}/event-sync/{event_id}/ack: the bot applied push_hash.

event is what Discord returned, or None when no Discord event is linked any more (ended, deleted, or the push was skipped because the start time had passed). thread_id is the event’s forum thread, if any.

event: DiscordEventState | None#
push_hash: str#
thread_id: int | None = None#
class sidequest_common.schemas.discord_events.DiscordSyncPending#

Bases: pydantic.BaseModel

GET /api/guilds/{guild_id}/event-sync: everything the bot should write to Discord now.

activity: list[SignupActivity]#
deletions: list[int]#
pushes: list[DiscordEventPush]#
class sidequest_common.schemas.discord_events.SignupActivity#

Bases: pydantic.BaseModel

One unposted sign-up activity row, queued to post as a forum comment on thread_id.

action: str#
comment: str | None = None#
detail: str | None = None#
discord_id: int | None#
display_name: str#
id: uuid.UUID#
thread_id: int#
sidequest_common.schemas.discord_events.PushAction#

upsert: create the event if discord_event_id is None (or it no longer exists), else edit it. cancel: cancel a scheduled event (end an active one). complete: end an active event, delete a scheduled one. After cancel/complete the bot acks with event=None: the guild event is no longer linked.