Skip to content

Commit bd71ceb

Browse files
committed
:%s/DiscordRPC/discordSdk/g
1 parent 4a4099c commit bd71ceb

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

docs/activities/Development_Guides.mdx

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -819,7 +819,7 @@ Here's a basic example for retrieving a user's avatar and username
819819

820820
```javascript
821821
// We'll be referencing the user object returned from authenticate
822-
const {user} = await DiscordRPC.commands.authenticate({
822+
const {user} = await discordSdk.commands.authenticate({
823823
access_token: accessToken,
824824
});
825825

@@ -846,13 +846,13 @@ Here's an example of how to retrieve the user's guild-specific avatar and nickna
846846
847847
```javascript
848848
// We'll be referencing the user object returned from authenticate
849-
const {user} = await DiscordRPC.commands.authenticate({
849+
const {user} = await discordSdk.commands.authenticate({
850850
access_token: accessToken,
851851
});
852852

853853
// When using the proxy, you may instead replace `https://discord.com` with `/discord`
854854
// or whatever url mapping you have chosen via the developer portal
855-
fetch(`https://discord.com/api/users/@me/guilds/${DiscordRPC.guildId}/member`, {
855+
fetch(`https://discord.com/api/users/@me/guilds/${discordSdk.guildId}/member`, {
856856
method: 'GET',
857857
headers: {
858858
Authorization: `Bearer ${accessToken}`,
@@ -865,7 +865,7 @@ fetch(`https://discord.com/api/users/@me/guilds/${DiscordRPC.guildId}/member`, {
865865
let guildAvatarSrc = '';
866866
// Retrieve the guild-specific avatar, and fallback to the user's avatar
867867
if (guildsMembersRead?.avatar) {
868-
guildAvatarSrc = `https://cdn.discordapp.com/guilds/${DiscordRPC.guildId}/users/${user.id}/avatars/${guildsMembersRead.avatar}.png?size=256`;
868+
guildAvatarSrc = `https://cdn.discordapp.com/guilds/${discordSdk.guildId}/users/${user.id}/avatars/${guildsMembersRead.avatar}.png?size=256`;
869869
} else if (user.avatar) {
870870
guildAvatarSrc = `https://cdn.discordapp.com/avatars/${user.id}/${user.avatar}.png?size=256`;
871871
} else {
@@ -907,7 +907,7 @@ When implementing sharing, you'll need to:
907907
const customId = await createPromotionalCustomId();
908908

909909
try {
910-
const { success } = await DiscordRPC.commands.shareLink({
910+
const { success } = await discordSdk.commands.shareLink({
911911
message: 'Click this link to redeem 5 free coins!',
912912
custom_id: customId,
913913
// referrer_id is optional - if omitted, the current user's ID is used
@@ -930,28 +930,28 @@ When a user clicks a shared link, your activity will launch with referral data a
930930
// Early in your activity's initialization
931931
async function handleReferral() {
932932
// Validate the referral data
933-
if (!DiscordRPC.customId || !DiscordRPC.referrerId) {
933+
if (!discordSdk.customId || !discordSdk.referrerId) {
934934
return;
935935
}
936936

937937
try {
938938
// Verify this is a valid promotion and hasn't expired
939-
const promotion = await validatePromotion(DiscordRPC.customId);
939+
const promotion = await validatePromotion(discordSdk.customId);
940940
if (!promotion) {
941941
console.log('Invalid or expired promotion');
942942
return;
943943
}
944944

945945
// Prevent self-referrals
946-
if (DiscordRPC.referrerId === currentUserId) {
946+
if (discordSdk.referrerId === currentUserId) {
947947
console.log('Self-referrals not allowed');
948948
return;
949949
}
950950

951951
// Grant rewards to both users
952952
await grantRewards({
953-
promotionId: DiscordRPC.customId,
954-
referrerId: DiscordRPC.referrerId,
953+
promotionId: discordSdk.customId,
954+
referrerId: discordSdk.referrerId,
955955
newUserId: currentUserId
956956
});
957957
} catch (error) {

0 commit comments

Comments
 (0)