Skip to content

feat: Let hosts make the bot their own with testify.config.json, and greet whoever adds it - #228

Merged
Kkkermit merged 3 commits into
developfrom
testify/feature-29
Nov 19, 2026
Merged

Kkkermit merged 3 commits into
developfrom
testify/feature-29

Conversation

@Kkkermit

Copy link
Copy Markdown
Owner

What this changes

  • testify.config.json, an optional file beside .env. It holds what makes a copy someone's own without editing code: repository, supportServer (null hides Support), developer, operator (name plus an email or https contact), defaultPrefix and greetInviter. Every key defaults to the original's values, so a copy with no file behaves exactly as before. npm run dev and npm start read the same file.
    • A mistake stops start-up with a box listing every problem, including unknown keys.
    • testify.config.schema.json is generated by npm run config:schema, so editors check the file as it is typed.
    • npm run setup ends by offering to write one.
    • docker-compose.yml mounts the folder read-only, and the Dockerfile copies a committed file into /app, so hosts that build the image (Railway) pick it up. On the published image, a file goes on a volume and TESTIFY_CONFIG points at it.
  • Links no longer live in code. theme.ts loses author, repository and supportServer, and every reader goes through instanceConfig(). A test fails if the original's repository, support invite or DEFAULT_PREFIX is written anywhere else in src.
  • Operator card on the privacy notice and terms when operator is set. The contact becomes a link only for an email address or an https page.
  • Default prefix. A server's prefix is now stored only when it differs from the default, so changing defaultPrefix reaches every server that never chose its own.
  • A DM to whoever adds the bot, with /help, the server's prefix, the setup checklist link (or the setup commands when the dashboard is off), /prefix, and the project's links.
    • The adder is read from the BotAdd audit entry, which an invite link, the Add App button and the App Directory all write. It asks once more after 3 seconds, and only takes an entry under 10 minutes old.
    • Without View Audit Log it reads the bot's integration; failing that, it DMs the server owner.
    • Closed DMs are a debug line, and anything else a warn, so the greeting can never fail the join.
    • Bots, blacklisted accounts and greetInviter: false get nothing.
  • Docs: a new "Make it your own" guide (docs/customising.md), linked from the README, the docs index, the website's docs and hosting.md, which gains a "Your settings on Railway" section. AGENTS.md gains §14's config-file subsection and §21's greeting rules. The privacy notice mentions the greeting in all eight languages and its date moves to 18 Nov 2026.

Why

  • Every self-hosted copy sent its users to the original's support server, showed the original's repository on /source-code, and pointed bug reports at the original's issues. Nobody running the published image could change that.
  • The privacy notice told people to "contact the operator" but gave them no way to, and anyone hosting publicly under the GDPR has to be identifiable.
  • A server the bot joined got nothing, so whoever added it had no answer to "now what?".
  • A host couldn't change the default prefix without editing shared/src/settings.ts.

How to verify

  • npm run check.
  • Copy testify.config.example.json to testify.config.json, set "defaultPrefix": "!" and a bad key such as "supportserver": "x", then npm run dev. Start-up stops with a box naming the bad key. Remove that key: the Settings line reads read from .env.development and testify.config.json, and !help works in a server that never set a prefix.
  • Set operator and open /privacy: the card names you, with your contact as a link.
  • Add the bot to a test server: whoever added it gets the DM. With their DMs closed, the join logs a debug line and nothing else.

Verified here:

  • npm run check passes, and the full root suite passes against a real MongoDB with the database suites included.
  • Each new rule (12 in the first pass, then the Dockerfile copy and .dockerignore) was broken in turn and its test went red.
  • A clean build loads 96 commands, 53 buttons, 4 right-click actions and 107 aliases, with no unrewritten aliases in dist/.
  • The new COPY line was built on BuildKit and the legacy builder, with and without a config file.

Not verified:

  • The greeting against live Discord. The audit-log timing, the integration fallback and the closed-DM code are covered with mocks.
  • The full image build: apt-get is blocked in the sandbox it was built in.
  • The Railway volume steps in hosting.md.

Before you upgrade: a server whose prefix was saved before this change keeps t? until somebody presses Reset on the prefix panel, even if it never chose a prefix. The guide says so.

Checklist

  • The branch is cut from develop, and this pull request targets develop
  • npm run check passes
  • Tests cover the new logic
  • No read-modify-save() on numeric fields
  • Embeds come from the embed() factory
  • No raw console.*
  • Every promise is awaited
  • Timers are registered with the timer registry (no repeating timer is added; the greeting's 3-second retry is a one-off wait)
  • New custom IDs use the codec and a unique namespace (none added)
  • New environment variables are in src/config/env.ts and scripts/setupEnv.ts (TESTIFY_CONFIG is in env.ts, both .env templates and docker-compose.yml; the wizard doesn't prompt for it, because blank is right almost everywhere)
  • npm run docs:commands re-run if a command changed (no command's name, options or description changed)
  • Documentation updated if behaviour changed

Generated by Claude Code

@Kkkermit
Kkkermit merged commit 306cec8 into develop Nov 19, 2026
8 checks passed
@Kkkermit
Kkkermit deleted the testify/feature-29 branch November 19, 2026 11:16
@Kkkermit Kkkermit mentioned this pull request Nov 19, 2026
13 of 15 tasks
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