Skip to content

v4#597

Draft
Sayrix wants to merge 68 commits intomainfrom
v4
Draft

v4#597
Sayrix wants to merge 68 commits intomainfrom
v4

Conversation

@Sayrix
Copy link
Copy Markdown
Owner

@Sayrix Sayrix commented Apr 29, 2026

v4 is a major update that replaces the v3 Discord.js/Prisma-based implementation with a new modular runtime built around @discordjs/core, @discordjs/rest, @discordjs/ws, Drizzle, libSQL/SQLite, and Bun-first tooling.

The goal of this release is to make Ticket-Bot easier to maintain, easier to configure, and more flexible for server owners while keeping migration paths available for existing v3 installs.

Runtime and Architecture

  • Replaced the old discord.js client structure with a lower-level @discordjs/core / REST / WS runtime.
  • Replaced the old ExtendedClient, BaseCommand, and BaseEvent structure with a modular app lifecycle.
  • Added automatic discovery for commands, events, and feature modules.
  • Added a centralized interaction router for commands, buttons, selects, and modals.
  • Added typed helper APIs for commands, events, features, custom IDs, responses, logging, and app context.
  • Added multi-runtime support so the project can be built for Node while running source-first with Bun.

Database Layer

  • Replaced Prisma with Drizzle ORM and libSQL/SQLite.
  • Added a new v4 database schema for:
    • tickets
    • panel messages
    • app metadata
  • Added persistent panel message tracking so v4 can manage multiple ticket panels reliably.
  • Added migration tooling for existing v3 installs:
    • bun run migrate:v3:config
    • bun run migrate:v3
    • bun run migrate:v3:test

Configuration

  • Replaced the v3 JSONC config format with a typed TypeScript config file.
  • Added defineConfig() for better type safety and editor autocomplete.
  • Added config versioning support (so that users can only replace the src folder without having to change their config).
  • Added config/example.env for runtime secrets and database configuration instead of a .env in the root folder.
  • Added support for multiple independently configured ticket panels.
  • Added richer ticket type definitions, including per-type message templates, close-message overrides, and structured open-form question keys.
  • Added configurable claim modes:
    • soft
    • strict
    • display-only
  • Added configurable claim takeover behavior.

Ticket Panels

  • Replaced the single v3 open-ticket panel model with a multi-panel system.
  • Added support for multiple opener layouts:
    • inline select menu
    • button that opens a select menu
    • direct ticket buttons
  • Added panel synchronization on startup.
  • Added select-menu refresh handling so selected options are cleared after workflows or errors.

Message Templates

  • Replaced v3’s JSON locale/embed message approach with dynamic TypeScript message templates.
  • Added reusable message templates for:
    • ticket panels
    • ticket opened messages
    • ticket closed channel messages
    • ticket closed DM messages
    • ticket audit logs
  • Added per-ticket-type close message overrides.
  • Added support for Discord Components v2-style message templates where needed.

Ticket Workflow Changes

  • Added /unclaim.
  • Added claim takeover logic.
  • Added strict claim mode, allowing servers to require a ticket to be claimed before it can be closed.
  • Added better state handling around ticket open flows, especially for select menus and modal workflows.
  • Added improved permission handling when tickets are claimed, closed, moved, or updated.
  • Added ticket rename audit logging.
  • Added unclaim audit logging.
  • Improved /mass_add behavior with validation, deduplication, skipped-user reporting, and limit handling.
  • Added authenticated ticket.pm transcript upload support through TICKETPM_PASSKEY.

Localization

  • Replaced the old JSON locale files with a typed typesafe-i18n setup.
  • Added typed translation functions for runtime messages.
  • Added localized slash command descriptions.
  • Current v4 locale set is en and fr.

Tooling

  • Switched package management from npm lockfile to Bun lockfile.
  • Replaced ESLint and Prettier config with Biome.
  • Added a dedicated TypeScript build config.
  • Added path alias resolution after build through resolve-tspaths.
  • Updated scripts for the new runtime:
    • bun run start
    • bun run build
    • bun run node:start
    • bun run drizzle:push

Docker

  • Reworked Docker support around the Bun runtime.
  • Updated docker-compose.yml for the new config, messages, and .data volume layout.
  • Added .dockerignore.

Documentation and Project Metadata

  • Moved documentation links to the GitHub Wiki.
  • Updated CODEOWNERS.
  • Changed the project license to AGPL-3.0-only.

Telemetry Changes

  • Moved telemetry into its own module.
  • Telemetry is now fully anonymized as it is no longer reporting the Guild ID or User ID of the bot.

Breaking Changes

  • The config format changed from config.jsonc to config/config.ts.
  • Prisma has been removed in favor of Drizzle/libSQL.
  • The old JSON locale system has been replaced with typed i18n files.
  • The massadd command has been renamed to mass_add.

Migration Notes

Existing v3 users should migrate their config and database before running v4 in production.

bun run migrate:v3:config
bun run migrate:v3

Migration verification is available with:

bun run migrate:v3:test

Closes #166
Closes #458

Sayrix added 30 commits April 9, 2026 14:55
* Add @discordjs/core, rest, ws
* Add discord-api-types
* Configure deploy and typecheck scripts
* Update spell checker settings
* Implement file-based module discovery
* Create event and command registry
* Build central interaction router
* Add custom-id encoding utilities
* Establish core application types
* Add response and logger helpers
* Extract start logic to createBotApp
* Connect gateway and interaction router
* Handle graceful process shutdowns
* Add script to deploy commands
* Register core interaction and ready events
* Add @ticketpm and libsql client dependencies
* Configure tsgo, typesafe-i18n, biome formating scripts
* Define typings for discordjs rest client
* Add workspace words to cSpell dictionary
* Enable standalone slash command discovery and parsing
* Support deferred and editable interaction responses
* Introduce versioned config schemas for ticket panels
* Add database bootstrapping logic for dynamic schema migrations
* Inject versioned config and app instances into execution context
* Sync visually generated panels dynamically upon startup
* Route modal and select interactions for customizable ticket questions
* Define /claim, /massadd, and /close slash command controls
* Create comprehensive transcript backups synchronously on close
* Enforce 25 user limitation upon ticket channels
* Export deployApplicationCommands from deploy-commands file.
* Call deployment function directly in the ready event.
* Remove old deploy:commands script from package.json.
* Pin the main welcome message immediately upon channel creation.
* Attempt cleanup of the system pin notification message.
* Add TICKETPM_PASSKEY environment variable for authorized uploads.
* Introduce UUID style configuration for transcripts.
* Relax ProcessEnv types to handle undefined values correctly.
* Change massadd command identifier and file structure to mass_add.
* Standardize import sorting across command files.
* Introduce status block in configuration schema.
* Apply presence during ready event with a refresh interval.
* Document new available tokens for ticket channel and message templates.
* Introduce tokens for individual open form answers ({reasonN}).
* Add runtime text slots for modular template rendering.
* Refactor staff mentions to utilize specific message slots.
* Serialize ticket open reasons securely with backward compatibility.
* Add close configuration to ticket types schema

* Resolve correct template files for DMs and channel closures

* Pass ticketType properties down the messaging pipeline
* Add open and close templates for billing tickets

* Add open and close templates for general support

* Add open and close templates for report tickets
* Extract write logic to reduce logger memory overhead.
* Use colored ANSI codes for INFO, WARN, ERROR.
* Route logs to appropriate console streams.
* Validate guildId and bot membership on boot.
* Check Administrator permissions and text channel configurations.
* Announce bot startup and sponsor list from GitHub.
* Introduce version.ts for runtime tracking.
* Add ASCII art banner on startup.
* Implement update polling from GitHub API tags.
* Replace generic console.error with logger.
* Add logs configuration to config.example.ts and internal typings
* Create enqueueTicketLog service and logging utility functions
* Add Discord message templates for audited ticket events
* Fix Component V2 text display handling in messages util
* Send audit logs on ticket creation, claim, and unclaim
* Send audit logs when a ticket is closed or deleted
* Send audit logs on user additions or removals
* Send audit logs on ticket channel rename
- Merge multiple text block strings into single components.

- Utilize markdown subtext for close actions.

- Condense padding in ticket opened messages.
- Replace unsafe unknown recursive traversals with strict interfaces.

- Support mapping over nested container structures for action rows.

- Safely clone button arrays without mutating references.
* Include DOM and DOM.Iterable in tsconfig lib for WebSocket support

* Add ticketbot to cSpell workspace dictionary
* Introduce telemetry connection via WebSocket on ticket.pm

* Store privacy notice state in new appMetaTable

* Add minimalTracking and showWSLog configuration variables

* Trigger telemetry start in client ready event
* Add typesafe-i18n configuration and generated locales
* Implement BotApp locale context injection
* Expand config schemas to accommodate language settings
* Update core registries and interaction responders to use locales
Sayrix added 8 commits April 25, 2026 11:43
- Implemented `migrate-v3-config.ts` to handle migration of v3 JSONC configuration to v4 TypeScript format.
- Added `migrate-v3-db.ts` for migrating v3 SQLite database to v4 schema, including ticket and panel message handling.
- Introduced command-line interface for both migration scripts with options for source, target, panel key, type mapping, and overwrite functionality.
- Included error handling and validation for migration processes to ensure data integrity and user guidance.
* Acknowledge panel select menu component with empty update.

* Send ephemeral error messages via follow-up.
* Reset string select menu state before validating ticket access.

* Re-render source message components sequentially on modal forms.

* Strip lingering default choices inside \clearActionRowDefaults\.

* Encapsulate reply methodology into \
espondToTicketOpen\.
…nute and 30 seconds

Helps us avoiingd the idle timeout from Cloudflare
* Remove custom build.mjs and run-entry.mjs scripts

* Use tsc and resolve-tspaths for the build process

* Update bun.lockb and package.json accordingly
* This script is no longer used by the build or deployment process
@Sayrix Sayrix requested a review from zhiyan114 as a code owner April 29, 2026 12:24
@Sayrix Sayrix marked this pull request as draft April 29, 2026 12:29
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.

Potentially use dropdown menu already instead of pressing the button to show that dropdown menu Multiple panels with multiple buttons/options

1 participant