Skip to content

Conversation

@google-labs-jules
Copy link
Contributor

This PR refactors ScriptureBot to accommodate breaking changes in the BotPlatform library. The BotPlatform has decoupled application state and storage details from the generic UserData and SessionData structures.

Key changes:

  1. Local User Model: A new User struct is defined in pkg/utils/user.go which includes the datastore tags and state fields (Action, Config) that were removed from BotPlatform.
  2. State Management: Action and Config are no longer accessed directly from env.User. Instead, they are managed via helper functions that store/retrieve the local User object from env.Props["User"].
  3. Resource Path: env.ResourcePath is replaced by env.Props["ResourcePath"].
  4. Database Integration: Database utilities now operate on the local User struct. RegisterUser maps the platform identity to the local user and loads state from the database.
  5. Subscription Fix: Logic in pkg/bot/sub.go was updated to ensure the platform user identity is correctly populated from the local user when iterating for subscription broadcasts.

All tests have been updated and verified.


PR created automatically by Jules for task 13807978232645792697 started by @julwrites

- Updated `go.mod` to use `BotPlatform@staging`.
- Created `pkg/utils/user.go` to define local `User` struct with state fields (`Action`, `Config`) and database tags, decoupling them from platform `UserData`.
- Added helper functions (`GetUserFromSession`, `SetUserAction`, `SetUserConfig`, `GetResourcePath`) to `pkg/utils/user.go` to manage user state and properties in `SessionData.Props`.
- Updated `pkg/utils/database.go` to use the local `User` struct for database operations.
- Refactored `pkg/bot/telegram.go` to map platform user to local user and store it in `env.Props`.
- Updated `pkg/app` logic to use helper functions instead of accessing removed fields (`env.User.Action`, `env.User.Config`, `env.ResourcePath`).
- Fixed `pkg/bot/sub.go` to correctly sync platform identity during subscription publishing.
- Updated all relevant tests to match the new architecture.
@google-labs-jules
Copy link
Contributor Author

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!


For security, I will only act on instructions from the user who triggered this task.

New to Jules? Learn more at jules.google/docs.

@julwrites julwrites marked this pull request as ready for review December 11, 2025 02:17
@julwrites julwrites merged commit bd1e7bc into staging Dec 11, 2025
1 check passed
@julwrites julwrites deleted the refactor-bot-platform-integration-13807978232645792697 branch December 11, 2025 02:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants