Repository navigation
Closed
Labels
difficulty:medium3-5 daysmod:bot-discordDiscord bot modulemod:eventsEvents & participationtype:featNew feature
Description
Parent
What to build
Enable Discord/Twitch bots to trigger check-ins via domain events. The bot dispatches a CheckInRequested event, the Events module listens and processes it, then dispatches a CheckInProcessed response event for the bot to reply to the user.
Domain event: CheckInRequested
- Dispatched by bot module (Discord slash command or Twitch chat command)
- Payload:
provider(discord/twitch),external_user_id,code(numeric),event_id(optional, can be inferred),channel_context(for bot reply routing)
Listener: HandleBotCheckIn (in Events module)
- Resolves user from
external_user_id+providervia Identity module - Finds the user's enrollment for the relevant event (active event for today, or specified event_id)
- Delegates to
CheckInActionwith method=numeric_code - On success: dispatches
CheckInProcessedwith status=success, enrollment info - On failure: dispatches
CheckInProcessedwith status=error, reason (invalid code, not enrolled, already checked in, etc.)
Domain event: CheckInProcessed (response)
- Payload:
provider,external_user_id,channel_context,status(success/error),message,enrollment_id - Bot module listens and replies to user in chat
Auto-discovery:
- Listener uses type-hinted
handle(CheckInRequested $event)— Laravel auto-discovers it - No manual registration needed
Edge cases:
- User not found by external_id: error response "User not linked to platform"
- User not enrolled in any active event: error response "No active enrollment found"
- Multiple active events: require explicit event_id or use the one happening today
- Code validation follows same rules as App panel (expiry, max_uses, date)
Important: This slice only implements the Events module side (listener + response event). The bot-side command that dispatches CheckInRequested is a separate concern in app-modules/bot-discord/.
Acceptance criteria
-
CheckInRequestedevent is defined with proper payload structure - Events module listener resolves user and processes check-in
-
CheckInProcessedresponse event is dispatched with success/error status - Numeric code validation applies same rules as web flow
- Error cases handled: user not found, not enrolled, invalid code, already checked in
- Listener is auto-discovered (no manual registration)
- Feature tests: successful bot check-in, user not found, invalid code, not enrolled
- Pint passes
Blocked by
- feat(events): numeric code check-in #245 (Check-in Numeric Code — reuses numeric code validation logic)
Metadata
Metadata
Assignees
Labels
difficulty:medium3-5 daysmod:bot-discordDiscord bot modulemod:eventsEvents & participationtype:featNew feature
Activity
[-]Events: Bot Check-in Integration (extra)[/-][+]feat(events): bot check-in integration[/+]feat(events): bot check-in integration (#326)
feat: events module (#309)