Debug & Log
Enable logging and install debugging symbols to troubleshoot SDK issues.
Use with Discord APIs
Combine the SDK with Discord’s REST APIs for server-side operations.
Integrate Moderation
Implement content moderation for text and audio in your game.
Handle Special Characters
Properly render Unicode characters in Discord display names.
Debug and Log
Debugging symbols
Debugging symbols are hosted athttps://storage.googleapis.com/discord-public-symbols. In Visual Studio, add this URL under Tools → Options → Debugging → Symbols.
Logging
UseClient::AddLogCallback to receive log messages. Use Client::SetLogDir to write logs to a directory.
For production builds use
ERROR (4) or WARN (3). For development use INFO (2) or VERBOSE (1) for more detail.Audio logging
UseClient::SetAecDump to enable diagnostic recording of audio input/output for troubleshooting echo cancellation (AEC) issues.
Use with Discord APIs
The SDK handles client-side functionality. Use Discord’s REST API from your game backend for server-side operations.Authentication
- Bot token
- Bearer token
OAuth2 token exchange
Using the OpenAPI spec
Use the Discord OpenAPI Spec with a code generator like openapi-generator.tech to generate a typed client for your backend language. Best practices:- Never expose bot tokens in client-side code
- Respect Discord’s rate limits and implement exponential backoff
- Cache responses when appropriate
Integrate Moderation
Effective moderation is required under the Discord Social SDK Terms.Your responsibilities
- On Discord: Discord’s Community Guidelines and Terms of Service apply to content rendered on Discord (including lobby/DM messages from your game). Discord can take platform-level actions on Discord accounts.
- In your game: You are responsible for your own content policies, in-game moderation, and providing players a way to report violations.
Server-side chat moderation
Discord’s moderation metadata API lets your backend attachmoderation_metadata to messages. The metadata is delivered to active game sessions via GAME_DIRECT_MESSAGE_UPDATE or LOBBY_MESSAGE_UPDATE webhook events — no polling required.
Client-side audio moderation
UseClient::SetAudioModerationCallback to receive callbacks when audio content requires moderation review.
Handling banned Discord accounts
A Discord account ban does not affect the player’s separate game account. However, a banned Discord account loses access to SDK features that require an account connection (such as voice chat and lobbies).Handle Special Characters in Display Names
Discord display names can contain Unicode characters including emoji, CJK characters, RTL text, and combining diacritics.Rendering guidelines
- Use a Unicode-aware font and text rendering library
- Normalize strings using NFC (canonical decomposition + canonical composition) before display
- Sanitize display names before inserting into HTML contexts to prevent XSS
Truncation
Truncate on grapheme cluster boundaries rather than byte or code point boundaries to avoid splitting multi-byte characters.Sorting and comparison
Use locale-aware collation for sorting friend lists. Avoid byte-by-byte string comparison for user-visible ordering.Discord display names may contain zero-width characters. Strip zero-width joiners/non-joiners if you use display names as keys in data structures.
Next steps
Managing Lobbies
Create lobbies and manage voice chat for multiplayer games.
Social SDK Overview
Return to the Social SDK overview for a full feature summary.