Skip to content

Made embeds brandable for selfhosted versions#18

Merged
breadddevv merged 2 commits into
mainfrom
change/selfhost-brand
Jul 21, 2026
Merged

Made embeds brandable for selfhosted versions#18
breadddevv merged 2 commits into
mainfrom
change/selfhost-brand

Conversation

@breadddevv

@breadddevv breadddevv commented Jul 21, 2026

Copy link
Copy Markdown
Member

🚀 Summary

  • Added branded, guild-aware colors for embeds in self-hosted deployments.

✨ Features

  • Added shared asynchronous Embed() and Container() builders.
  • Resolved colors from the bot member’s guild display color with fallback handling and caching.

♻️ Improvements

  • Migrated booster, help, info, and role commands to shared embed helpers.
  • Awaited Discord client login errors through startup handling.
  • Required GUILD_ID for master-locked command loading.
  • Updated the npm start script and Prisma dependencies.

@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@breadddevv, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 44 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 68a8d928-dd63-4ca8-8372-e83a73f5016a

📥 Commits

Reviewing files that changed from the base of the PR and between 2baa2f3 and d125709.

📒 Files selected for processing (1)
  • src/base/functions/color-resolve.ts
📝 Walkthrough

Walkthrough

The 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.

Changes

Discord builder and command flow

Layer / File(s) Summary
Guild color resolution and shared builders
src/base/functions/color-resolve.ts, src/base/functions/embed.ts
Adds cached guild/member color resolution with fallbacks, plus asynchronous Embed() and Container() factories.
Command response builder migration
src/commands/booster.ts, src/commands/help.ts, src/commands/info.ts
Migrates booster, help, and info responses to the shared factories and updates embed content and color handling.
Role command async response flow
src/commands/role.ts
Makes component construction asynchronous and awaits it across role creation, editing, deletion, and validation paths.
Runtime startup and command registration
src/index.ts, src/libs/loadCommands.ts, package.json
Awaits client login, requires GUILD_ID for master-locked commands, changes the npm start entrypoint, and updates Prisma versions.

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
Loading

Possibly related PRs

  • teamboostify/boostify#10: Refactors /help responses to use the asynchronous Container() helper and red accent styling.

Suggested reviewers: vortexsinclair

Poem

I’m a rabbit with colors cached bright,
Builders now hop through async night.
Guild hues bloom in every reply,
Red errors wave as they pass by.
Login waits, commands align—
A tidy burrow, working fine!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title matches the main change: adding brandable embed styling for self-hosted versions.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch change/selfhost-brand

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

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 (2)
src/commands/booster.ts (1)

130-131: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Pass color directly to builder factories to avoid redundant overriding.

The Embed and Container helpers accept an optional color parameter. 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 win

Align Prisma CLI with the 7.9.0 Prisma packages. package.json still pins prisma to ^7.8.0 while @prisma/client and @prisma/adapter-pg are ^7.9.0, and the lockfile mirrors that split. Bump prisma to ^7.9.0 and 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

📥 Commits

Reviewing files that changed from the base of the PR and between acadd52 and 2baa2f3.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (9)
  • package.json
  • src/base/functions/color-resolve.ts
  • src/base/functions/embed.ts
  • src/commands/booster.ts
  • src/commands/help.ts
  • src/commands/info.ts
  • src/commands/role.ts
  • src/index.ts
  • src/libs/loadCommands.ts

Comment thread package.json
"scripts": {
"build": "tsc",
"start": "node --env-file=.env dist/index.js",
"start": "node --env-file=.env .",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🩺 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])
PY

Repository: 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))$' || true

Repository: 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.

Comment thread src/base/functions/color-resolve.ts
Comment thread src/libs/loadCommands.ts
Comment on lines 49 to 52
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;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎯 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>
@breadddevv
breadddevv merged commit 31087fc into main Jul 21, 2026
2 of 3 checks passed
@breadddevv
breadddevv deleted the change/selfhost-brand branch July 21, 2026 11:28
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.

1 participant