Skip to content

Repository files navigation

TicketBot

CILicense: MITNode.js

A secure, bilingual support workflow for Discord communities. TicketBot turns a public support panel into private, permission-scoped ticket channels with staff access, duplicate prevention, notifications, and auditable closure.

Try the interactive workflow → · Leia em português

What it solves

Community support in public channels leaks context and becomes difficult to triage. TicketBot gives members one clear entry point and gives staff an isolated channel per request, without requiring a separate dashboard or database.

Engineering highlights

  • interaction-driven workflow using slash commands, buttons, and modals;
  • private Discord permission overwrites for requester and support role;
  • one active ticket per member plus an in-process creation lock;
  • deterministic sequential channel naming across restarts;
  • PT-BR and EN-US panels and support notices;
  • optional Discord webhook notifications and event log channel;
  • administrator authorization at command registration and runtime boundaries;
  • destructive actions restricted to canonical ticket-00000 channels;
  • reconnect backoff for gateway/session failures;
  • dependency audit, behavioral tests, public-boundary gate, and full-history Gitleaks.

Workflow

Admin publishes panel
→ member opens ticket
→ bot creates private channel
→ support conversation
→ admin closes canonical ticket channel

The public demo simulates this lifecycle without a Discord token or real server.

Quick start

git clone https://github.com/lippdev/ticketbot.git
cd ticketbot
npm ci
cp .env.example .env
# Add DISCORD_TOKEN and, ideally, DISCORD_GUILD_ID
npm start

Create the bot in the Discord Developer Portal. Never commit its token or a webhook URL.

Configuration

VariableRequiredPurpose
DISCORD_TOKENYesBot credential from Discord Developer Portal
DISCORD_GUILD_IDRecommendedRegisters commands immediately in one guild
DISCORD_TICKET_CATEGORY_IDNoParent category for ticket channels
DISCORD_TICKET_SUPPORT_ROLE_IDNoStaff role granted ticket access
DISCORD_TICKET_LOG_CHANNEL_IDNoTicket event audit channel
DISCORD_WEBHOOK_URLNoTicket-open notification endpoint
SUPPORT_EMAILNoContact shown in automatic notices
SUPPORT_HOURS_PT, SUPPORT_HOURS_ENNoLocalized availability text
BOT_PRESENCE_MESSAGESNoPipe-separated rotating activities

Required intents: Guilds, Guild Messages, and Message Content.

Commands

CommandAccessPurpose
/ticketpanelAdministratorConfigure and publish the PT-BR panel
/ticketpanel-enAdministratorPublish the EN-US panel
/ticketadminAdministratorOpen controls inside a ticket channel

Security model

Ticket channels deny ViewChannel to @everyone, then grant only the requester and optional support role. Administrative interactions are checked at both Discord command registration and execution time. Channel deletion rejects non-ticket names even for administrators.

State is intentionally in memory. Existing tickets survive restarts as Discord channels and are rediscovered by canonical name/permissions; ephemeral locks, panel edits, and first-reply markers reset. Add persistence only when operating multiple bot processes.

Development

npm ci
npm test
npm run audit:public
npm audit --omit=dev --audit-level=high

See architecture and contributing guide.

Author

Built by Filipe Moreira, full-stack software engineer — GitHub.

License

MIT

About

Secure bilingual Discord ticket workflow with private channels, admin controls, and interactive demo

Topics

Resources

Contributing

Stars

1 star

Watchers

0 watching

Forks

Contributors

Languages