Skip to main content

Overview

ScoreSaber Reloaded includes a Discord bot that provides administrative commands, monitoring channels, and automated notifications for various events. The bot enables server admins to manage the system and monitor its health in real-time.

What the Discord Bot Provides

  • Administrative Commands: Slash commands for system management
  • Monitoring Channels: Real-time logs for various system events
  • Score Feeds: Automated notifications for notable scores
  • Status Tracking: Live presence showing tracked score count
  • Error Logging: Centralized error reporting

Bot Setup

The Discord bot is initialized during backend startup:
From: backend/src/bot/bot.ts:65-94

Configuration

Required Environment Variables

Channel Configuration

The bot uses dedicated channels for different purposes:
From: backend/src/bot/bot.ts:23-33

Administrative Commands

Refresh Ranked Leaderboards

Force a refresh of all ranked leaderboards:
From: backend/src/bot/command/refresh-ranked-leaderboards.ts:11-27 Usage: /refresh-ranked-leaderboards

Available Commands

The bot includes several admin commands (all require owner permissions):
  • /refresh-ranked-leaderboards - Refresh ranked map data
  • /fetch-missing-player-scores - Fetch scores for tracked players
  • /force-track-player-statistics - Force track player statistics
  • /refresh-medal-scores - Refresh medal score data
  • /update-player-medals - Update player medal counts
From: backend/src/bot/bot.ts:17-21

Monitoring Channels

Tracked Player Logs

Logs when players are added or removed from tracking:

Player Score Refresh Logs

Tracks score refresh operations:

Backend Logs

General backend errors and important events:

BeatSaver Logs

BeatSaver API interactions and errors:
From: backend/src/bot/bot.ts:23-33

Score Feeds

Number One Feed

Notifies when players achieve rank 1 on leaderboards:

Top 50 Scores Feed

Tracks all top 50 global scores:

Score Floodgate Feed

High-volume feed for all tracked scores:

Medal Scores Feed

Notifies when players earn medal-worthy scores:
From: backend/src/bot/bot.ts:23-33

Sending Messages

Send Embed

Send rich embed messages to channels:
From: backend/src/bot/bot.ts:102-119

Send Text Message

Send plain text messages:
From: backend/src/bot/bot.ts:127-144

Send File

Send file attachments:
From: backend/src/bot/bot.ts:153-178

Bot Presence

The bot’s status displays the total number of tracked scores:
The presence updates every minute to show the current score count. From: backend/src/bot/bot.ts:76-85

Error Handling

The bot includes error handling for interaction failures:
From: backend/src/bot/bot.ts:51-63

Permissions

All administrative commands are protected by permission guards:
From: backend/src/bot/command/refresh-ranked-leaderboards.ts:7-10
Only users with the OwnerOnly permission can execute administrative commands. Configure this in your Discord server settings.

Use Cases

System Monitoring

Administrators can monitor system health through dedicated channels:
  • Track when players are added/removed
  • Monitor score refresh operations
  • Receive alerts for errors
  • Track BeatSaver API issues

Manual Interventions

When needed, admins can manually trigger:
  • Leaderboard refreshes
  • Player score fetches
  • Medal updates
  • Statistics tracking

Community Engagement

Score feed channels can be used for:
  • Celebrating top performances
  • Tracking rank 1 achievements
  • Monitoring medal-worthy scores

Bot Client Configuration

The bot is configured with necessary intents:
From: backend/src/bot/bot.ts:35-43

Ready Event

When the bot connects, it initializes application commands:
From: backend/src/bot/bot.ts:45-49

Best Practices

Set up separate Discord channels for different log types to keep monitoring organized and prevent channel spam.
The bot token should be kept secure and never committed to version control. Use environment variables for configuration.
High-volume feeds like SCORE_FLOODGATE_FEED can generate many messages. Consider using a dedicated channel with slower mode enabled.