Skip to content

roblox api + random quote + some syntax errors saturn made#122

Merged
breadddevv merged 6 commits intoPlanetaryOrbit:mainfrom
infyieldtaker:main
Apr 8, 2026
Merged

roblox api + random quote + some syntax errors saturn made#122
breadddevv merged 6 commits intoPlanetaryOrbit:mainfrom
infyieldtaker:main

Conversation

@infyieldtaker
Copy link
Copy Markdown
Contributor

@infyieldtaker infyieldtaker commented Apr 7, 2026

What's changed

utils/userinfoEngine.ts + utils/roblox.ts — batched Roblox API calls

  • Introduced getRobloxUserInfo() which fetches username and display name in a single noblox.getUserInfo() call instead of two separate requests
  • Updated userinfoEngine.ts to use the batched fetch warming either getUsername or getDisplayName now primes both in cache simultaneously
  • Consolidated two separate NodeCache instances into one with a 5-minute TTL (previously cached forever)
  • Fixed cache miss check from truthiness to !== undefined, preventing false hits on empty strings
  • Removed unused noblox and getRobloxThumbnail imports
  • Kept getRobloxUsername and getRobloxDisplayName as shim exports for backwards compatibility

utils/randomText.ts — bug fixes + new quotes

  • Fixed missing commas after template literals in afternoonOnlyTexts and lateNightTexts that caused a runtime syntax error
  • Fixed double comma (,,) in lateNightTexts
  • Fixed missing closing }; on the randomText function
  • Added 2 new quotes:
    • Afternoon: Orbit is running smooth. Thanks for supporting our project, ${name} 🙌
    • Late night: Quiet hours are the best for deep management. Go get 'em, ${name}. ⌨️

Summary by CodeRabbit

  • Updates
    • Expanded variety of randomized messages displayed during afternoon and late-night hours.
    • Optimized user information caching for improved performance.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 7, 2026

📝 Walkthrough

Walkthrough

The changes refactor Roblox user information fetching and caching across utility modules. A new RobloxUserInfo interface is introduced alongside a consolidated getRobloxUserInfo function. The caching layer is unified into a single configurable NodeCache instance with namespaced key storage. Minor text additions and formatting adjustments are applied to random text generation utilities.

Changes

Cohort / File(s) Summary
Roblox API and Caching Refactoring
utils/roblox.ts, utils/userinfoEngine.ts
Consolidated user info fetching: new RobloxUserInfo interface and getRobloxUserInfo() function introduced in roblox.ts; getRobloxUsername and getRobloxDisplayName now derive values from this consolidated function. Caching unified: single NodeCache with stdTTL: 300 replaces separate instances; internal getCachedUserInfo() uses namespaced keys. Function signatures updated: getRobloxUserId no longer accepts optional origin parameter; getRobloxThumbnail now explicitly returns Promise<string>.
Text Content Updates
utils/randomText.ts, pages/welcome.tsx
Added string literals to afternoonOnlyTexts and lateNightTexts arrays; whitespace/formatting adjustments applied to string declarations. Removed trailing newline from pages/welcome.tsx.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 Twitching with delight!
Cache consolidated, keys now reside,
In one noble NodeCache, side by side,
Username and displayName, unified with pride,
The refactor hops along! 🌟

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title references 'roblox api + random quote + some syntax errors' which aligns with the three main areas of change: roblox.ts refactoring, randomText.ts additions, and syntax error fixes, though the phrasing 'saturn made' is informal and vague.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Nitpick comments (1)
utils/roblox.ts (1)

53-58: Shim exports cause duplicate API calls when both are used separately.

These shim functions each call getRobloxUserInfo() independently. If a caller uses both getRobloxUsername(id) and getRobloxDisplayName(id) directly (bypassing the caching layer in userinfoEngine.ts), they will make 2 API calls instead of 1.

Consider documenting that callers should prefer getRobloxUserInfo() directly when both values are needed, or use the cached getUsername/getDisplayName from userinfoEngine.ts.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@utils/roblox.ts` around lines 53 - 58, The two shim exports getRobloxUsername
and getRobloxDisplayName each call getRobloxUserInfo separately, causing
duplicate API calls when a caller needs both values; update the file to add a
clear documentation comment above these functions stating that callers who need
both username and displayName should call getRobloxUserInfo(id) directly or use
the cached helpers getUsername/getDisplayName from userinfoEngine.ts to avoid
double requests, and keep the shims as-is for single-field convenience.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@utils/randomText.ts`:
- Around line 82-84: Fix the spacing inconsistency in the template string "`Late
shift? Stay sharp, ${name}🦉`" by inserting a space between the ${name}
placeholder and the emoji so it matches the other entries (i.e., change to
"`Late shift? Stay sharp, ${name} 🦉`"); locate this string in the messages
array or function that returns random texts (e.g., in utils/randomText.ts) and
update the literal accordingly.

In `@utils/roblox.ts`:
- Around line 44-51: Callers are still passing an origin argument to
getRobloxUserId even though the parameter was removed, causing TS errors;
restore backwards compatibility by re-adding an optional origin?: string
parameter to the getRobloxUserId function in utils/roblox.ts (keep the existing
implementation and ignore or optionally log/use origin) so calls from
pages/api/auth/login.ts and pages/api/setupworkspace.ts compile, or
alternatively update those two call sites to stop passing
req.headers.origin—pick one approach and apply it consistently.

In `@utils/userinfoEngine.ts`:
- Around line 35-37: getThumbnail is synchronous but callers await it; change
its signature to async so it returns a Promise<string> for API consistency with
getUsername/getDisplayName and to allow callers to keep using await. Update the
function declaration getThumbnail(userId: number | bigint) to be async and
return the same URL string (e.g., use an async function or return
Promise.resolve(`/api/workspace/[id]/avatar/${userId}`)); no caller changes
required if you make this change. Ensure exported type remains compatible
(Promise<string>).

---

Nitpick comments:
In `@utils/roblox.ts`:
- Around line 53-58: The two shim exports getRobloxUsername and
getRobloxDisplayName each call getRobloxUserInfo separately, causing duplicate
API calls when a caller needs both values; update the file to add a clear
documentation comment above these functions stating that callers who need both
username and displayName should call getRobloxUserInfo(id) directly or use the
cached helpers getUsername/getDisplayName from userinfoEngine.ts to avoid double
requests, and keep the shims as-is for single-field convenience.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: c53225f5-06b5-4ff3-9c27-ab71f2a0c300

📥 Commits

Reviewing files that changed from the base of the PR and between 24bb98e and db40721.

📒 Files selected for processing (4)
  • pages/welcome.tsx
  • utils/randomText.ts
  • utils/roblox.ts
  • utils/userinfoEngine.ts

Comment thread utils/randomText.ts
Comment thread utils/roblox.ts
Comment thread utils/userinfoEngine.ts
@breadddevv breadddevv merged commit 570d3fa into PlanetaryOrbit:main Apr 8, 2026
1 check passed
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