Alinxus/tryhard-esports

discord bot for tryhad esport

★ 0Forks 0JavaScriptGitHub ↗Compare

README

Tryhard Esports Discord Bot

A branded Discord bot starter for a CODM clan with slash commands, modal join applications, roster management, scrim reminders, stat tracking, and a highlight board.

What it does

  • Posts polished embedded responses themed for Tryhard Esports
  • Registers slash commands with Discord
  • Includes clan-focused commands:
    • /about
    • /roster
    • /rosteradd
    • /rosterupdate
    • /rosterremove
    • /syncroles
    • /schedule
    • /scrimschedule
    • /scrimedit
    • /scrimcancel
    • /scrims
    • /tryout
    • /tryoutpanel
    • /claimtryout
    • /reviewtryout
    • /closeticket
    • /rules
    • /announce
    • /match
    • /result
    • /record
    • /playercard
    • /playerstats
    • /addpoints
    • /leaderboard
    • /mvpleaderboard
    • /statleaderboard
    • /dashboardpost
    • /starboard
    • /ping
  • Awards 1 activity point per message automatically
  • Creates private application channels from a modal-based join form
  • Lets staff claim, review, and close tryout tickets
  • Schedules scrims with automatic countdown reminders
  • Lets staff edit or cancel scrims without touching code
  • Sends starred community highlights to a configured starboard channel
  • Tracks team wins, losses, recent results, MVP awards, lineup attendance, and player stat lines
  • Supports a live dashboard post that refreshes when roster, scrims, or results change

Setup

  1. Copy .env.example to .env
  2. Fill in your Discord bot token and application IDs
  3. Optional: change the clan info in .env
  4. Optional: set STAFF_ROLE_ID, TRYOUT_CATEGORY_ID, TRIAL_ROLE_ID, MEMBER_ROLE_ID, and ANNOUNCEMENTS_CHANNEL_ID
  5. Deploy commands:
npm run deploy
  1. Start the bot:
npm start

Important notes

  • DISCORD_GUILD_ID is recommended while testing because guild commands update quickly.
  • The /announce command requires Manage Guild.
  • The bot now uses message and reaction events, so enable the Message Content intent in the Discord Developer Portal if Discord prompts for it.
  • Social links in .env.example are placeholders right now.

Staff workflow

  1. Run /tryoutpanel in your applications channel
  2. Applicants click the button and get a private ticket
  3. Staff uses /claimtryout inside that ticket
  4. Staff uses /reviewtryout with trial, accept, or deny
  5. Staff uses /closeticket when finished

If TRIAL_ROLE_ID and MEMBER_ROLE_ID are filled in, the bot will assign roles automatically during review.

Scrim workflow

  1. Run /scrimschedule
  2. Use a parseable time like 2026-04-05 20:00
  3. The bot will post countdown reminders at the chosen minute marks
  4. Log the result after the match with /result

Hands-free setup

  1. Run /dashboardpost in your main info or announcements channel
  2. Use /syncroles after building the roster the first time
  3. Use /scrimschedule, /scrimedit, and /scrimcancel for match ops
  4. The dashboard will refresh automatically after roster changes and results

PM2

For an always-on bot on a VPS or your own server, PM2 is the easiest option.

  1. Install PM2 globally:
npm install -g pm2
  1. Start the bot:
npm run pm2:start
  1. Check logs:
npm run pm2:logs
  1. Restart after code changes:
npm run pm2:restart
  1. Save the process list:
pm2 save
  1. Generate startup config for your server:
pm2 startup

Cloudflare note:

  • Regular Cloudflare Workers are not a good fit for this discord.js gateway bot.
  • Cloudflare Containers can work because they run a persistent containerized app.
  • PM2 is for a VPS or dedicated host, not for Cloudflare Workers.

Cloudflare Containers

This repo now includes:

What you need locally before deploy:

  1. Docker installed and running
  2. Cloudflare Wrangler login:
npx wrangler login
  1. Install dependencies:
npm install
  1. Set required Cloudflare Worker secrets:
npx wrangler secret put DISCORD_TOKEN
npx wrangler secret put DISCORD_CLIENT_SECRET
  1. Edit wrangler.jsonc vars for your real channel and role IDs

  2. Deploy:

npm run cf:deploy

Useful Cloudflare commands:

npm run cf:list
npm run cf:logs

After deploy, your Worker URL will respond on:

  • /
  • /health
  • /boot

No Docker on your machine

You can still deploy this project by using GitHub Actions so Docker runs on GitHub's runner instead of your PC.

  1. Push this project to a GitHub repository
  2. Add these GitHub repository secrets:
    • CLOUDFLARE_API_TOKEN
    • CLOUDFLARE_ACCOUNT_ID
  3. Keep wrangler.jsonc in the repo
  4. Push to main or run the workflow manually

The workflow file is:

Cloudflare docs I used:

Next customizations

  • Replace placeholder leader, region, and social links
  • Add a real roster and scrim schedule
  • Connect a database if you want persistent player applications or match history

Issues