From 6a0676ae6b37b3d3033c404deeb329a911c7c957 Mon Sep 17 00:00:00 2001 From: Lucas Arenas Date: Fri, 10 Oct 2025 16:13:32 +0200 Subject: [PATCH 1/7] Update types.py Add new custom_id field --- rbrapi/types.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/rbrapi/types.py b/rbrapi/types.py index ebad76f..cd269af 100644 --- a/rbrapi/types.py +++ b/rbrapi/types.py @@ -161,6 +161,7 @@ class AccountResponse(APIResponse): wallet: Wallet email: str devices: list[dict[str, str]] + custom_id: str | None # Optional field, new in API def __init__( self: Self, @@ -169,9 +170,21 @@ def __init__( wallet: str, email: str, devices: list[dict[str, str]], + custom_id: str | None = None, ) -> None: - user["metadata"] = loads(user["metadata"]) - super().__init__(user=user, wallet=loads(wallet), email=email, devices=devices) + # Safely load user["metadata"] and wallet JSON + if isinstance(user.get("metadata"), str): + user["metadata"] = loads(user["metadata"]) + if isinstance(wallet, str): + wallet = loads(wallet) + + super().__init__( + user=user, + wallet=wallet, + email=email, + devices=devices, + custom_id=custom_id, # include new key + ) class LootBoxResponses(APIResponse): From 7b5bb59962480b7e126c46dd10248cf4c500d755 Mon Sep 17 00:00:00 2001 From: Lucas Arenas Date: Tue, 3 Mar 2026 23:42:36 +0100 Subject: [PATCH 2/7] docs: add CLAUDE.md for Claude Code guidance Co-Authored-By: Claude Sonnet 4.6 --- CLAUDE.md | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 CLAUDE.md diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..1026a58 --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,53 @@ +# CLAUDE.md + +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. + +## Project Overview + +`rbrapi` is an unofficial Python client library for the Rocket Bot Royale game API (built on Nakama backend at `https://dev-nakama.winterpixel.io/v2`). Version `0.7`, requires Python `>=3.8`, single dependency: `requests`. + +## Commands + +**Lint/format check (CI uses this):** +```bash +ruff format --check rbrapi +``` + +**Auto-format:** +```bash +ruff format rbrapi +``` + +**Build for distribution:** +```bash +python -m pip install build +python -m build +``` + +There is no test suite configured. + +## Architecture + +The library exposes a single `RocketBotRoyale` class (`rbrapi/__init__.py`) that authenticates on instantiation and wraps all API calls. + +**Module responsibilities:** +- `rbrapi/__init__.py` — Main client class. Defines `BASE_URL`, `BASE_HEADERS` (with hardcoded game credentials), and `CLIENT_VERSION = "9999999999"` (intentional, bypasses version checks). All public methods map to Nakama REST or RPC endpoints. +- `rbrapi/session.py` — Thread-local `requests.Session` cache with a 600-second TTL. `make_request()` handles POST/GET, JSON/form-data payloads, and raises custom exceptions on non-2xx responses. +- `rbrapi/types.py` — Response types. `APIResponse` base class provides JSON serialization. Typed response objects (`AuthenticateResponse`, `AccountResponse`, `LootBoxResponses`, etc.) and `TypedDict` definitions for nested structures (`UserStats`, `UserMetadata`, `Wallet`, etc.). +- `rbrapi/errors.py` — Six custom exceptions, one per API operation that can fail (`AuthenticationError`, `SignUpError`, `CollectTimedBonusError`, `FriendRequestError`, `LootBoxError`, `UnknownUserError`). + +**Request flow:** +``` +RocketBotRoyale(email, password) + └─> authenticate() ──> make_request() ──> thread-local requests.Session (TTL 600s) + +client.buy_crate() / account() / etc. + └─> make_request() ──> Response parsed into types.py objects +``` + +**RPC calls** (e.g., `collect_timed_bonus`, `send_friend_request`, `buy_crate`) POST to `/rpc/` as `application/x-www-form-urlencoded` with a JSON-encoded body string as the form value. + +## CI/CD + +- **`ruff.yml`**: Runs `ruff format --check rbrapi` on every push/PR. +- **`pypi.yml`**: Publishes to PyPI automatically when `rbrapi/__init__.py` changes on `main`. From 759e8c9962db11b2e16df7b1f07afd814737e119 Mon Sep 17 00:00:00 2001 From: Lucas Arenas Date: Tue, 3 Mar 2026 23:43:29 +0100 Subject: [PATCH 3/7] "Claude PR Assistant workflow" --- .github/workflows/claude.yml | 50 ++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 .github/workflows/claude.yml diff --git a/.github/workflows/claude.yml b/.github/workflows/claude.yml new file mode 100644 index 0000000..d300267 --- /dev/null +++ b/.github/workflows/claude.yml @@ -0,0 +1,50 @@ +name: Claude Code + +on: + issue_comment: + types: [created] + pull_request_review_comment: + types: [created] + issues: + types: [opened, assigned] + pull_request_review: + types: [submitted] + +jobs: + claude: + if: | + (github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) || + (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) || + (github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) || + (github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude'))) + runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: read + issues: read + id-token: write + actions: read # Required for Claude to read CI results on PRs + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 1 + + - name: Run Claude Code + id: claude + uses: anthropics/claude-code-action@v1 + with: + claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} + + # This is an optional setting that allows Claude to read CI results on PRs + additional_permissions: | + actions: read + + # Optional: Give a custom prompt to Claude. If this is not specified, Claude will perform the instructions specified in the comment that tagged it. + # prompt: 'Update the pull request description to include a summary of changes.' + + # Optional: Add claude_args to customize behavior and configuration + # See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md + # or https://code.claude.com/docs/en/cli-reference for available options + # claude_args: '--allowed-tools Bash(gh pr:*)' + From 4dace79f1e3760bc6aeac33d9cc72e4e55df06df Mon Sep 17 00:00:00 2001 From: Lucas Arenas Date: Tue, 3 Mar 2026 23:43:30 +0100 Subject: [PATCH 4/7] "Claude Code Review workflow" --- .github/workflows/claude-code-review.yml | 44 ++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 .github/workflows/claude-code-review.yml diff --git a/.github/workflows/claude-code-review.yml b/.github/workflows/claude-code-review.yml new file mode 100644 index 0000000..b5e8cfd --- /dev/null +++ b/.github/workflows/claude-code-review.yml @@ -0,0 +1,44 @@ +name: Claude Code Review + +on: + pull_request: + types: [opened, synchronize, ready_for_review, reopened] + # Optional: Only run on specific file changes + # paths: + # - "src/**/*.ts" + # - "src/**/*.tsx" + # - "src/**/*.js" + # - "src/**/*.jsx" + +jobs: + claude-review: + # Optional: Filter by PR author + # if: | + # github.event.pull_request.user.login == 'external-contributor' || + # github.event.pull_request.user.login == 'new-developer' || + # github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR' + + runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: read + issues: read + id-token: write + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 1 + + - name: Run Claude Code Review + id: claude-review + uses: anthropics/claude-code-action@v1 + with: + claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} + plugin_marketplaces: 'https://github.com/anthropics/claude-code.git' + plugins: 'code-review@claude-code-plugins' + prompt: '/code-review:code-review ${{ github.repository }}/pull/${{ github.event.pull_request.number }}' + # See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md + # or https://code.claude.com/docs/en/cli-reference for available options + From 9f6ad4bb4b6c7c581c0b33cb302f8780b781e9c7 Mon Sep 17 00:00:00 2001 From: Lucas Arenas Date: Tue, 3 Mar 2026 23:49:03 +0100 Subject: [PATCH 5/7] chore: bump to 0.7.1 Co-Authored-By: Claude Sonnet 4.6 --- pyproject.toml | 2 +- rbrapi/__init__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 0e34285..0b23042 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [project] name = "rbrapi" -version = "0.7" +version = "0.7.1" authors = [ { name="VWH", email="vwhe@proton.me" }, diff --git a/rbrapi/__init__.py b/rbrapi/__init__.py index ac2b2f8..187d19e 100644 --- a/rbrapi/__init__.py +++ b/rbrapi/__init__.py @@ -1,6 +1,6 @@ from __future__ import annotations -__version__ = "0.7" +__version__ = "0.7.1" from json import loads from typing import Optional, Self From b942cd56e345b62ae89adee4ed54c08be1d0b8b3 Mon Sep 17 00:00:00 2001 From: "claude[bot]" <41898282+claude[bot]@users.noreply.github.com> Date: Tue, 3 Mar 2026 23:49:59 +0000 Subject: [PATCH 6/7] fix: update repository URLs to point to fork Update pyproject.toml Homepage and Issues URLs from the original rocket-bot-royale/api repository to arenaslucas/rbr-api fork. Co-authored-by: Lucas Arenas --- pyproject.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 0b23042..7102afb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -29,8 +29,8 @@ dependencies = [ ] [project.urls] -Homepage = "https://github.com/rocket-bot-royale/api" -Issues = "https://github.com/rocket-bot-royale/api/issues" +Homepage = "https://github.com/arenaslucas/rbr-api" +Issues = "https://github.com/arenaslucas/rbr-api/issues" [tool.setuptools] include-package-data = false From c1c260ae30680ecb0fcbcb48fe0b493f25c1633e Mon Sep 17 00:00:00 2001 From: Lucas Arenas Date: Wed, 4 Mar 2026 10:30:36 +0100 Subject: [PATCH 7/7] Rename project from 'rbrapi' to 'rbr-api-fork' --- pyproject.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 7102afb..f06daa6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] -name = "rbrapi" +name = "rbr-api-fork" version = "0.7.1" authors = [ @@ -36,4 +36,4 @@ Issues = "https://github.com/arenaslucas/rbr-api/issues" include-package-data = false [tool.setuptools.packages.find] -exclude = ["examples"] \ No newline at end of file +exclude = ["examples"]