Discord Game SDK
This is node.js module for Electron to integrate with Discord.
Requirements
- Node.js 11+
- Electron 6.0+
Windows Setup
The Windows is required to add dll
to project root, please copy sdk\{ARCH}\discord_game_sdk.dll
to your project folder to ensure your Electron can access SDK correctly.
Usage
Before using this module, you have to go to Discord Developer to create an application.
Discord
create()
Initialize Discord.
const Discord = ; const isRequireDiscord = true;Discord;// => true
version
Get Discord Game SDK Version
runCallback()
Resolve Discord's async behavior and call the callback;
const Discord = ; const isRequireDiscord = true;Discord;
Application
locale
Get the current locale
branch
Get the current branch
getOAuth2Token()
Get the user OAuth2 Token.
const Discord = ; const isRequireDiscord = true;Discord; DiscordApplication ;
Activity (aka Rich Presence)
update
Update user's rich presence.
const Discord = ; const isRequireDiscord = true;Discord; // All property are optionalconst activity = details: 'Details' state: 'State' assets: largeImage: 'large' largeText: 'Large' samllImage: 'small' smallText: 'Small' timestamps: startAt: endAt: secrets: match: 'match' join: 'join' spectate: 'spectate' party: id: 'id' currentSize: 1 maxSize: 5 const start_at = ;DiscordActivity ;