An open API service indexing awesome lists of open source software.

https://github.com/strivo-dev/discord-rpc

discord-rpc is a powerful library created by Discord, allowing developers to integrate Rich Presence functionality into their Discord applications smoothly.
https://github.com/strivo-dev/discord-rpc

dc-rpc discord discord-rpc rpc

Last synced: about 1 month ago
JSON representation

discord-rpc is a powerful library created by Discord, allowing developers to integrate Rich Presence functionality into their Discord applications smoothly.

Awesome Lists containing this project

README

          






node-current
npm
npm latest
GitHub Repo stars
Discord
Discord
Visitor
Issues
Commit
Build
Build


# Discord RPC

- **[Discord-RPC] is a powerful library developed by SITCommunity that enables developers to seamlessly integrate Rich Presence functionality into Discord applications or from Client ID**

## Install

- NPM

```
npm i dc-rpc
```

## Quick example

```js
// Importing Discord-RPC
const { RpcClient } = require('dc-rpc');

// Create an instance of Discord-RPC
const client = new RpcClient(); // removed websocket

// ================================================================

// Your Applications Client ID
const Id = 'client_id';

// Login To Discord RPC
await client.login({ clientId: Id });

// ================================================================

// Function When Client Is Ready
client.on('ready', () => {
console.log('Authed for user:', client.user.username); // Console Output: Authed for user: [discord_username]

// Set Activity (Example)
client.setActivity({
state: 'it work!!!',
details: 'Testing RPC',
largeImageKey: 'icon_name', // From Discord Applications Rich Presence Assets
largeImageText: 'this is icon',
startTimestamp: Date.now(),
});
});

// ================================================================

// Destroying Or Disconnecting From RPC
client.destroy();
```

## Example Results

![presence](https://github.com/user-attachments/assets/a53e95ff-e9e5-4b86-8c52-7935cd23d469)

## License

```
This Project under MIT License
© 2019 - 2024 SITCommunity. All Rights Reserved
```

## Credits

- Original: [Senophyx]
- Maintainer: [brokenedtz]

[Discord-RPC]: https://www.npmjs.com/package/dc-rpc
[Senophyx]: https://github.com/Senophyx
[brokenedtz]: https://github.com/brokenedtzjs