mirror of
https://github.com/SolitudeSF/discord_rpc
synced 2026-01-14 11:16:46 +00:00
No description
| src | ||
| .gitignore | ||
| discord_rpc.nimble | ||
| LICENSE | ||
| README.md | ||
discord_rpc
Client library for synchronous part of Discord RPC, which includes Rich Presence.
Installation
nimble install discord_rpc
Example settings Rich Presence/Activity
let
applicationId = WHATEVER
discord = newDiscordRPC(applicationId)
discard discord.connect
discord.setActivity Activity(
details: "Epic Application",
state: "Doing nothing",
assets: some ActivityAssets(
largeImage: "icon-name",
largeText: "yep, thats it"
)
)
Example using other RPC facilities
Needs to be compiled with -d:ssl.
let
id = WHATEVER
secret = VERY_CONFIDENTIAL
scopes = [oasIdentify, oasRpc] # You need at least these two to do anything
discord = newDiscordRPC(id)
_ = discord.connect
authorizationCode = d.authorize scopes
(authenticationToken, _) =
getOAuth2Token(authorizationCode, discord.client, secret, scopes)
_ = discord.authenticate token
# Now we're set to do whatever
guilds = discord.getGuilds
voiceSettings = discord.getVoiceSettings
_ = d.selectTextChannel some channelId