Made embeds brandable for selfhosted versions#18
Conversation
|
Warning Review limit reached
Next review available in: 44 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe PR adds cached guild-based color resolution and shared asynchronous Discord embed/container factories, migrates several commands to them, makes role responses await component construction, and updates startup, command registration, npm startup, and Prisma dependency configuration. ChangesDiscord builder and command flow
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant Command as Discord command
participant Container as Container
participant resolveColor as resolveColor
participant Guild as Discord guild
Command->>Container: request asynchronous container
Container->>resolveColor: resolve default color
resolveColor->>Guild: fetch guild and bot member
Guild-->>resolveColor: return display color
resolveColor-->>Container: return ColorResolvable
Container-->>Command: return configured container
Possibly related PRs
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (2)
src/commands/booster.ts (1)
130-131: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winPass color directly to builder factories to avoid redundant overriding.
The
EmbedandContainerhelpers accept an optionalcolorparameter. Manually overriding the color after initialization is redundant. When no argument is passed, it also unnecessarily resolves the default guild color before immediately discarding it.
src/commands/booster.ts#L130-L131: Pass the color directly during initialization (await Container(0xe642a4)) and remove the.setAccentColor()call.src/commands/booster.ts#L187-L188: Pass the conditional color directly (await Embed(booster.active ? 0xf47fff : 0x99aab5)) and remove the.setColor()call.src/commands/help.ts#L586-L587:Container(Colors.Red)already applies the color internally. Remove the redundant.setAccentColor(Colors.Red)call.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/commands/booster.ts` around lines 130 - 131, Pass the fixed color directly to Container in src/commands/booster.ts lines 130-131 and remove setAccentColor; pass the conditional color directly to Embed in src/commands/booster.ts lines 187-188 and remove setColor; in src/commands/help.ts lines 586-587, remove the redundant setAccentColor call because Container(Colors.Red) already applies it.package.json (1)
23-24: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick winAlign Prisma CLI with the 7.9.0 Prisma packages.
package.jsonstill pinsprismato^7.8.0while@prisma/clientand@prisma/adapter-pgare^7.9.0, and the lockfile mirrors that split. Bumpprismato^7.9.0and regenerate the lockfile.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@package.json` around lines 23 - 24, Update the prisma dependency in package.json from ^7.8.0 to ^7.9.0 to match `@prisma/client` and `@prisma/adapter-pg`, then regenerate the lockfile so all Prisma package entries resolve consistently to 7.9.0.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@package.json`:
- Line 9: Update the package.json start script so it builds the project before
launching the entrypoint that resolves to dist/index.js, using a prestart script
or an equivalent build-first command. Ensure a clean checkout can run npm start
successfully.
In `@src/base/functions/color-resolve.ts`:
- Around line 11-15: Update the guild ID resolution in the color-resolve flow
before the cachedColors lookup and any guild fetch: when neither GUILD_ID nor
MASTER_GUILD is configured, return early without calling client.guilds.fetch.
Preserve the existing cache and fetch behavior when a valid guild ID is
available.
In `@src/libs/loadCommands.ts`:
- Around line 49-52: The guard in the masterLock handling of loadCommands should
require only MASTER_GUILD before retaining master-locked commands; do not skip
them when GUILD_ID is absent in public mode. Preserve the existing skip behavior
when MASTER_GUILD is unconfigured, and ensure the later master-guild
registration can still receive commands such as reload.
---
Nitpick comments:
In `@package.json`:
- Around line 23-24: Update the prisma dependency in package.json from ^7.8.0 to
^7.9.0 to match `@prisma/client` and `@prisma/adapter-pg`, then regenerate the
lockfile so all Prisma package entries resolve consistently to 7.9.0.
In `@src/commands/booster.ts`:
- Around line 130-131: Pass the fixed color directly to Container in
src/commands/booster.ts lines 130-131 and remove setAccentColor; pass the
conditional color directly to Embed in src/commands/booster.ts lines 187-188 and
remove setColor; in src/commands/help.ts lines 586-587, remove the redundant
setAccentColor call because Container(Colors.Red) already applies it.
🪄 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: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: cfc0d930-16b5-4324-ae65-5dad7d9aadba
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (9)
package.jsonsrc/base/functions/color-resolve.tssrc/base/functions/embed.tssrc/commands/booster.tssrc/commands/help.tssrc/commands/info.tssrc/commands/role.tssrc/index.tssrc/libs/loadCommands.ts
| "scripts": { | ||
| "build": "tsc", | ||
| "start": "node --env-file=.env dist/index.js", | ||
| "start": "node --env-file=.env .", |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
entry=$(node -p "require('./package.json').main || 'index.js'")
case "$entry" in
*.ts) echo "Package root resolves to TypeScript: $entry"; exit 1 ;;
esac
test -f "$entry" || { echo "Entrypoint missing: $entry"; exit 1; }Repository: teamboostify/boostify
Length of output: 193
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== package.json =="
cat -n package.json | sed -n '1,120p'
echo
echo "== files matching dist/index.js or index.js =="
git ls-files | rg '(^|/)(dist/index\.js|index\.js)$' || true
echo
echo "== prisma-related package versions =="
node - <<'PY'
import json
from pathlib import Path
pkg = json.loads(Path('package.json').read_text())
for section in ('dependencies','devDependencies','peerDependencies','optionalDependencies'):
for name in ('prisma','`@prisma/client`','`@prisma/adapter-pg`'):
if name in pkg.get(section, {}):
print(section, name, pkg[section][name])
PYRepository: teamboostify/boostify
Length of output: 2075
🏁 Script executed:
#!/bin/bash
set -euo pipefail
python3 - <<'PY'
import json
from pathlib import Path
pkg = json.loads(Path('package.json').read_text())
print(json.dumps({
"scripts": pkg.get("scripts", {}),
"main": pkg.get("main"),
"dependencies": {k: v for k, v in pkg.get("dependencies", {}).items() if k in ("prisma", "`@prisma/client`", "`@prisma/adapter-pg`")},
"devDependencies": {k: v for k, v in pkg.get("devDependencies", {}).items() if k in ("prisma", "`@prisma/client`", "`@prisma/adapter-pg`")},
}, indent=2))
PY
echo
echo "Tracked entrypoint files:"
git ls-files | rg '(^|/)(dist/index\.js|index\.js|src/index\.(js|ts))$' || trueRepository: teamboostify/boostify
Length of output: 539
Build before start start resolves to dist/index.js, but the repo doesn’t provide that file on a clean checkout. Add a prestart build step or make start run npm run build first.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@package.json` at line 9, Update the package.json start script so it builds
the project before launching the entrypoint that resolves to dist/index.js,
using a prestart script or an equivalent build-first command. Ensure a clean
checkout can run npm start successfully.
| if (command?.masterLock) { | ||
| if (!process.env.MASTER_GUILD) { | ||
| if (!process.env.MASTER_GUILD || !process.env.GUILD_ID) { | ||
| logger.warn(`Skipping ${file} - missing ${chalk.bold('MASTER_GUILD')} on environmental variables.`); | ||
| continue; |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Do not exclude master-locked commands when only MASTER_GUILD is configured.
In public mode, GUILD_ID is intentionally absent, but the later registration path tries to publish reload to MASTER_GUILD. This guard removes it from commandData first, so the master guild receives no reload command. Either require only MASTER_GUILD here or split global and master-guild registration lists.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/libs/loadCommands.ts` around lines 49 - 52, The guard in the masterLock
handling of loadCommands should require only MASTER_GUILD before retaining
master-locked commands; do not skip them when GUILD_ID is absent in public mode.
Preserve the existing skip behavior when MASTER_GUILD is unconfigured, and
ensure the later master-guild registration can still receive commands such as
reload.
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
🚀 Summary
✨ Features
Embed()andContainer()builders.♻️ Improvements
GUILD_IDfor master-locked command loading.