Skip to main content
The Answer Overflow Discord bot provides commands for managing questions, solutions, and community settings.

Command Registration

Commands are registered globally or per-guild using Discord’s application commands API. The registration happens in /apps/discord-bot/src/commands/register.ts.

Global Commands

Available in all servers where the bot is installed.

Guild Commands

Restricted to specific servers (currently the Answer Overflow debug server).

Solution Management

✅ Mark Solution

Context menu command to mark a message as the solution to a question. Type: Message Context Menu Command
Permission Check: Must be question author OR have ManageThreads, ManageChannels, ManageGuild, or Administrator permission
How to Use:
  1. Right-click a message in a thread
  2. Select “Apps” > ”✅ Mark Solution”
  3. The message will be marked as the solution
What Happens:
  • Message is marked as solution in database
  • Checkmark (✅) reaction added to both question and solution messages
  • Solution tag added to forum thread (if configured)
  • Question tag removed from forum thread (if configured)
  • Thread archived (if server settings enable auto-archive)
  • Thread locked (if server settings enable auto-lock)
  • Leaderboard points awarded to solution author
  • Analytics event tracked
Requirements:
  • Must be used in a thread
  • Channel must have mark solution enabled
  • Cannot mark the question message as its own solution
Implementation: /apps/discord-bot/src/commands/mark-solution.ts:36

✅ Mark Solution & Archive

Same as “Mark Solution” but always archives the thread after marking, regardless of server settings. Type: Message Context Menu Command
Permission Check: Same as “Mark Solution”
Response: Ephemeral (only visible to you)

Community Commands

/leaderboard

Display the server leaderboard showing who has solved the most questions. Type: Slash Command
Permission Check: None
Options:
ephemeral
boolean
Show the leaderboard only to you (default: false)
Response: Displays an embed with:
  • Top 10 users by solutions marked
  • Each user’s solution count
  • User avatars and names
  • Link to full leaderboard on web
Example:
/leaderboard ephemeral:true
Implementation: /apps/discord-bot/src/commands/leaderboard.ts

/export

Export a channel or thread’s messages to a file. Type: Slash Command
Permission Check: None
Options:
format
choice
Export format. Choices:
  • markdown - Export as Markdown file (default)
  • json - Export as JSON file
ephemeral
boolean
Only show the export to you (default: true)
Response: Generates and uploads a file containing all messages in the current channel/thread. Markdown Format:
# Channel Name

## Thread: Question Title

**@username** - 2024-01-15 10:30 AM
Message content here...

**@otheruser** - 2024-01-15 10:35 AM  
Reply content here...
JSON Format:
{
  "channel": {
    "id": "123456789",
    "name": "help"
  },
  "messages": [
    {
      "id": "987654321",
      "author": { "id": "111222333", "name": "username" },
      "content": "Message text",
      "timestamp": "2024-01-15T10:30:00Z",
      "attachments": []
    }
  ]
}
Example:
/export format:markdown ephemeral:false
Implementation: /apps/discord-bot/src/commands/export.ts

Server Management

/channel-settings

Open the Answer Overflow dashboard to configure channel settings. Type: Slash Command
Permission Check: Requires ManageGuild permission
Response: Sends an ephemeral message with a link to the dashboard settings page for the server. Example:
/channel-settings
Settings Available in Dashboard:
  • Enable/disable indexing per channel
  • Enable/disable mark solution feature
  • Configure solution tag for forum channels
  • Set tags to remove when solution is marked
  • Configure auto-archive on solution
  • Configure auto-lock on solution
Implementation: /apps/discord-bot/src/commands/channel-settings.ts

/manage-account

Manage how Answer Overflow interacts with your Discord account. Type: Slash Command
Permission Check: None
Response: Sends an ephemeral message with options to:
  • View your privacy settings
  • Hide your messages from public indexing
  • Opt out of leaderboards
  • Delete your Answer Overflow data
  • Link to privacy policy
Example:
/manage-account

Feedback & Support

/feedback

Send feedback about Answer Overflow to the development team. Type: Slash Command
Permission Check: None
Context: Works in servers and DMs
Response: Opens a modal dialog where you can enter feedback text. Submissions are sent to the Answer Overflow team. Example:
/feedback
Implementation: /apps/discord-bot/src/commands/feedback.ts

/bug-report

Report a bug with Answer Overflow. Type: Slash Command
Permission Check: None
Context: Works in servers and DMs
Response: Opens a modal dialog for submitting bug reports with fields for:
  • Bug title
  • Description
  • Steps to reproduce
  • Expected vs actual behavior
Example:
/bug-report
Implementation: /apps/discord-bot/src/commands/bug-report.ts

Developer Commands

These commands are only available in the Answer Overflow debug server (Guild ID: 1037547185492996207).

/debug

Test bot latency and API status. Type: Slash Command
Permission Check: Rhys only
Availability: Debug server only
Response: Displays:
  • Bot WebSocket latency
  • API response time
  • Database connection status
  • Current bot version
Example:
/debug
Implementation: /apps/discord-bot/src/commands/debug.ts

Context Menu Commands

Quick Action

Multi-purpose context menu for common actions. Type: Message Context Menu Command
Permission Check: Varies by action
Available Actions:
  • Delete message (if you’re the author or have permissions)
  • Report message
  • Bookmark message
  • Copy message link
How to Use:
  1. Right-click a message
  2. Select “Apps” > “Quick Action”
  3. Choose an action from the menu
Implementation: /apps/discord-bot/src/interactions/quick-action.ts

Create GitHub Issue

Create a GitHub issue from a Discord thread. Type: Message Context Menu Command
Permission Check: Requires GitHub integration to be configured for the server
How to Use:
  1. Right-click the first message in a thread
  2. Select “Apps” > “Create GitHub Issue”
  3. Fill in the issue details in the modal
What Happens:
  • Creates a GitHub issue with the thread content
  • Links the Discord thread to the GitHub issue
  • Posts a message in the thread with the issue link
Requirements:
  • Server must have GitHub integration enabled
  • User must have connected their GitHub account
  • Server must have a configured GitHub repository
Implementation: /apps/discord-bot/src/commands/github-issue-utils.ts

Command Error Handling

All commands implement comprehensive error handling:

Command Timeouts

Commands have a 25-second timeout to prevent hung interactions:
const commandWithTimeout = handleCommand(interaction).pipe(
  Effect.timeoutFail({
    duration: Duration.seconds(25),
    onTimeout: () => new CommandTimeoutError()
  })
);
If a command times out:
  1. An error is logged with context (guild, channel, user)
  2. The user sees an error message
  3. The interaction is cleaned up

Permissions Reference

Discord Permissions Used

  • ManageThreads - Close/archive threads, mark solutions in any thread
  • ManageChannels - Mark solutions in any thread
  • ManageGuild - Access channel settings, server configuration
  • Administrator - Full access to all bot features

Permission Checking

const memberPermissions = channel.permissionsFor(guildMember);
const hasPermission = 
  memberPermissions?.has("ManageThreads") ||
  memberPermissions?.has("ManageChannels") ||
  memberPermissions?.has("ManageGuild") ||
  memberPermissions?.has("Administrator") ||
  false;

Analytics & Tracking

Commands fire analytics events for:
  • Command usage (which command was used)
  • Success/failure outcomes
  • Solution marking events
  • Export format preferences
  • Error occurrences
Events are tracked using:
  • PostHog for user behavior analytics
  • Custom Convex functions for database events
  • Discord audit log for moderation actions
Example:
import { trackMarkSolutionCommandUsed } from "../utils/analytics";

await trackMarkSolutionCommandUsed(guildMember, "Success");