Discord Social Demo¶
Sample scene demonstrating the full Discord Social SDK integration — account linking, rich presence, friends, DMs, lobbies, voice chat, invites, and moderation.
Scene Overview¶
Location: Assets/_IntelliVerseXSDK/Demos/IVXDiscordSocialDemo.cs
This sample demonstrates:
- Discord account linking & OAuth2 (desktop + mobile)
- Rich Presence (activity, party, timers, buttons)
- Friends list with online/in-game status
- Direct messages (send, history, summaries)
- Lobby creation, chat, and voice channels
- Game invites (send, receive, accept/decline)
- Content moderation with Discord metadata
Scene Hierarchy¶
Canvas (Screen Space — Overlay, 1920×1080 reference)
├── Background
├── DiscordSocialRoot
│ ├── Header ("DISCORD SOCIAL SDK")
│ ├── TabBar
│ │ ├── Account
│ │ ├── Presence
│ │ ├── Friends
│ │ ├── DMs
│ │ ├── Lobby/Voice
│ │ ├── Invites
│ │ └── Moderation
│ ├── ContentArea
│ │ ├── Panel_0 (Account)
│ │ ├── Panel_1 (Presence)
│ │ ├── Panel_2 (Friends)
│ │ ├── Panel_3 (DMs)
│ │ ├── Panel_4 (Lobby/Voice)
│ │ ├── Panel_5 (Invites)
│ │ └── Panel_6 (Moderation)
│ └── Footer (status bar)
Key Components¶
Account Linking¶
var mgr = IVXDiscordManager.Instance;
mgr.Initialize();
mgr.LinkAccount();
// Mobile OAuth2 flow
mgr.StartMobileOAuth2Flow("mygame://", ok =>
Debug.Log($"Mobile OAuth2: {ok}"));
// Listen for account events
mgr.OnAccountLinked += (userId, username) =>
Debug.Log($"Linked: {username} ({userId})");
mgr.OnAccountUnlinked += () =>
Debug.Log("Account unlinked.");
Rich Presence¶
var pr = IVXDiscordPresence.Instance;
pr.SetActivity("Ranked Match", "In Queue");
pr.StartTimer();
pr.SetParty("party_id", currentSize: 2, maxSize: 4, "join_secret");
pr.AddButton("Discord", "https://discord.com");
pr.SetStatusDisplayType(IVXStatusDisplayType.Details);
Friends & Relationships¶
var friends = IVXDiscordFriends.Instance;
friends.Refresh();
friends.OnFriendsUpdated += (list) =>
{
foreach (var f in list)
Debug.Log($"{f.DisplayName} online={f.IsOnline} inGame={f.IsInGame}");
};
friends.SendGameFriendRequest("username", ok => Debug.Log($"Sent: {ok}"));
friends.BlockUser(userId, ok => Debug.Log($"Blocked: {ok}"));
Lobby & Voice¶
var lobby = IVXDiscordLobby.Instance;
lobby.CreateOrJoinLobby("secret", "{\"demo\":true}");
lobby.SendMessage("Hello lobby!");
lobby.OnMessageReceived += (sender, message) =>
Debug.Log($"{sender}: {message}");
var voice = IVXDiscordVoice.Instance;
voice.JoinCall(lobby.CurrentLobbyId);
voice.SetSelfMute(true);
voice.SetInputVolume(150f);
voice.SetVADThreshold(true, -35f);
Game Invites¶
var invites = IVXDiscordInvites.Instance;
invites.SendInvite(targetUserId, "Join my session!");
invites.OnInviteReceived += (invite) =>
{
Debug.Log($"From: {invite.InviterName}, Party: {invite.PartyCurrentSize}/{invite.PartyMaxSize}");
invites.AcceptInvite(invite);
};
Moderation¶
var mod = IVXDiscordModeration.Instance;
mod.ProcessModerationMetadata(messageId, metadata);
mod.StartVoiceModerationCapture(lobbyId);
mod.ReportUser(userId, "Reason", ok => Debug.Log($"Reported: {ok}"));
mod.OnModerationDecisionReceived += (decision) =>
Debug.Log($"Action={decision.Action} Severity={decision.Severity}");
How to Use¶
Running the Sample¶
- Add
IVXDiscordSocialDemoto any GameObject - Ensure
IVXDiscordManager,IVXDiscordPresence,IVXDiscordFriends,IVXDiscordLobby,IVXDiscordVoice,IVXDiscordInvites, andIVXDiscordModerationare in the scene - Configure
IVXDiscordConfigwith your Discord Application ID - Press Play
Testing Account Linking¶
- Click the Account tab
- Click "Initialize SDK" then "Link Discord Account"
- Complete the OAuth2 flow in the browser
- Observe the account status update in the panel
Testing Rich Presence¶
- Switch to the Presence tab
- Enter details and state text
- Click "Set Activity" — check your Discord profile for the activity
- Try "Start Timer", "Set Party", and "Add Buttons"
Testing Voice Chat¶
- Switch to Lobby/Voice tab
- Click "Create/Join Lobby" with a secret
- Click "Join Voice" to connect to the voice channel
- Use Mute/Deafen toggles and volume sliders
Customization¶
Adding More Tabs¶
Edit IVXDiscordSocialDemo.cs — add entries to the tab labels array and implement a new BuildPanel case.
Changing the Theme¶
Modify the color constants at the top of the script (COL_BG, COL_PANEL, COL_ACCENT, COL_HIGHLIGHT).