Skip to content

Commands Reference

Julian Speckmann edited this page Jan 27, 2026 · 3 revisions

Commands Reference

Complete reference for all available bot commands.

Slash Commands

All commands use Discord's slash command system. Type / to see available commands.


/products

Description: Display all products you own on SourceXchange.

Permissions Required:

  • None (any user can use this command)

Usage:

/products

Response:

Success:

**Purchased Products:** SourceXChange Sync Bot

No products:

You haven't purchased any products yet.

Error:

Failed to fetch products. Make sure your Discord is linked.

Example Use Cases:

  • Check which products you own
  • Verify a purchase went through
  • Debug role sync issues

Notes:

  • Requires Discord account to be linked on SourceXchange
  • Shows all products, not just the one configured for role sync
  • Product IDs are displayed for reference

/sync

Description: Sync your Discord role based on your SourceXchange product purchases.

Permissions Required:

  • None (any user can use this command)

Usage:

/sync

Response:

Role granted:

Role **[Role Name]** has been added!

Role removed:

Role **[Role Name]** has been removed.

Role already correct:

You already have the **[Role Name]** role.

Possible Errors:

Discord not linked:

Failed to sync roles. Make sure your Discord is linked.

Role not found:

Role not found in this server.

Example Use Cases:

  • After purchasing a product on SourceXchange
  • When joining a new server
  • After linking your Discord account
  • When you believe your role is out of sync

Notes:

  • Checks if you own the product configured in PRODUCT_ID
  • Adds the role if you own the product
  • Removes the role if you don't own the product
  • Safe to run multiple times

Rate Limiting:

  • No built-in rate limit
  • SourceXchange API may have rate limits
  • Don't spam the command

Command Behavior

How Commands Work

  1. User runs command → Discord sends the interaction
  2. Bot receives interaction → Defers reply (shows "Bot is thinking...")
  3. Bot makes API request → Calls SourceXchange API with user's Discord ID
  4. Bot processes response → Checks product ownership
  5. Bot takes action → Grants/removes role or displays products
  6. Bot sends reply → User receives confirmation message

Response Times

  • Typical: 1-3 seconds
  • Slow API: 5-10 seconds
  • Timeout: 15 seconds (Discord limit)

If a command times out, it failed but you can try again.

Error Handling

The bot gracefully handles:

  • SourceXchange API errors
  • Discord permission errors
  • Network timeouts
  • Invalid configurations
  • Missing roles

API Endpoints Used

/products Command

GET https://sourcexchange.net/api/users/discord
Authorization: Bearer {API_TOKEN}
Query: id={USER_DISCORD_ID}

/sync Command

GET https://sourcexchange.net/api/users/discord
Authorization: Bearer {API_TOKEN}
Query: id={USER_DISCORD_ID}

Then manages Discord roles via Discord API.

Permissions the Bot Needs

For commands to work properly, the bot requires:

  • Use Slash Commands (to be able to use commands)
  • Send Messages (to respond)
  • Manage Roles (for /sync)

Command Feedback

If you have suggestions for new commands or improvements:

Related Pages

Clone this wiki locally