Gwen Abalise
Gwen Abalise (hereinafter the “Application”) is a Discord bot that provides a private thread-based ticketing system for Discord communities. The bot enables users to create support tickets through a simple button interface, with tickets managed as private threads that include designated support staff roles.
1. User Documentation
Section titled “1. User Documentation”This section is for those interacting with a live instance of the Application.
Getting Started
Section titled “Getting Started”To use Gwen Abalise, add her to your Discord server.
Commands
Section titled “Commands”The bot provides three slash commands:
/about- Learn more about the bot, including version information and helpful links/start <channel>- Set up the ticket system in a specified text channel (requires MANAGE_GUILD permission)/role <role>- Configure which role should be pinged and added to new tickets (requires MANAGE_GUILD permission)
Ticket System
Section titled “Ticket System”The ticketing system works through a simple button interface:
- Administrators use
/startto place a “Create Ticket” button in a channel - Users click the button to open a private thread ticket
- The designated support role is automatically added to the thread
- Support staff can close tickets using the “Close Ticket” button within threads
Subscription Model
Section titled “Subscription Model”The bot operates on a subscription model with Discord’s premium features:
- Servers require an active subscription to use the ticketing functionality
- Entitled guilds (configured in the codebase) have access without subscription
- Non-subscribed servers receive prompts to subscribe with premium buttons
2. Technical Documentation
Section titled “2. Technical Documentation”This section is for those interested in running their own instance of the Application.
Architecture
Section titled “Architecture”The application is built with:
- Runtime: Node.js with TypeScript
- Discord Library: discord.js v14
- Database: MongoDB with Prisma ORM
- Web Server: Fastify (for health monitoring and landing page)
- Logging: Custom logger utility
Core Components
Section titled “Core Components”Commands (src/commands/)
Section titled “Commands (src/commands/)”Command definitions for Discord slash commands:
about.ts- Bot information commandrole.ts- Support role configuration commandstart.ts- Ticket system initialisation command
Modules (src/modules/)
Section titled “Modules (src/modules/)”Business logic implementations:
about.ts- Displays bot information with action buttonsclose.ts- Handles ticket closure and thread managementopen.ts- Creates new ticket threads and database recordsrole.ts- Manages support role configurationstart.ts- Sets up ticket creation interface in channels
Utilities (src/utils/)
Section titled “Utilities (src/utils/)”isSubscribed.ts- Validates server subscription statuslogger.ts- Logging functionalityreplyToError.ts- Error handling for interactions
Database Schema
Section titled “Database Schema”Two main models:
Tickets- Tracks ticket state (open/closed), thread IDs, and user associationsRoles- Maps server IDs to their designated support role IDs
Web Server (src/server/)
Section titled “Web Server (src/server/)”Provides health monitoring endpoint and informational landing page at port 5012.
Environment Requirements
Section titled “Environment Requirements”DISCORD_TOKEN- Bot token from Discord Developer PortalMONGO_URI- MongoDB connection stringnpm_package_version- Automatically set by npm for version display
Permissions
Section titled “Permissions”The bot requires these Discord permissions:
- Send Messages
- Create Private Threads
- Manage Threads
- Use Slash Commands
3. Legal Documentation
Section titled “3. Legal Documentation”This section is for expansions to our legal policies specific to the Application.
4. Contributing Documentation
Section titled “4. Contributing Documentation”This section is for documentation related to contributing to the Application’s codebase.
Development Setup
Section titled “Development Setup”The project uses:
- TypeScript with strict configuration
- ESLint with @nhcarrigan/eslint-config
- Prisma for database management
- Vitest for testing (tests not yet implemented)
- pnpm for package management
Build Process
Section titled “Build Process”pnpm build # Compiles TypeScript to prod/ directorypnpm lint # Runs ESLint with zero warnings policypnpm start # Runs the compiled application with 1Password secretsCode Structure
Section titled “Code Structure”The codebase follows a modular architecture with clear separation between:
- Command definitions (registration data)
- Command implementations (business logic)
- Utility functions (shared functionality)
- Database models (data persistence)
- Web server (health monitoring)