Skip to content

feat(events): bot check-in integration #248

Closed

Description

@danielhe4rt

Parent

#237

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 + provider via Identity module
  • Finds the user's enrollment for the relevant event (active event for today, or specified event_id)
  • Delegates to CheckInAction with method=numeric_code
  • On success: dispatches CheckInProcessed with status=success, enrollment info
  • On failure: dispatches CheckInProcessed with 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

  • CheckInRequested event is defined with proper payload structure
  • Events module listener resolves user and processes check-in
  • CheckInProcessed response 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

Activity

  1. added
    enhancement
    ready-for-agent
    type:feat
    mod:events
    and removed
    enhancement
    ready-for-agent
    on May 17, 2026
  2. changed the title [-]Events: Bot Check-in Integration (extra)[/-] [+]feat(events): bot check-in integration[/+] on May 23, 2026
  3. self-assigned this
    on Jun 9, 2026
  4. added a commit that references this issue on Jun 14, 2026
    98342e9
  5. added a commit that references this issue on Aug 15, 2026
    bd5cd67
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

difficulty:mediummod:bot-discordmod:eventstype:feat

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions