discord-rpc-revamp
TypeScript icon, indicating that this package has built-in type declarations

2.0.4 • Public • Published

Discord RPC Revamp

Note: This package is a revamp of @discordjs/rpc, because I felt like it didn't work very well - so I rewrote it.

The code is messy, but here are some useful tips:

  • The API is the same as in @discordjs/rpc, except login() is now connect() and does not take a client secret.
  • Calling subscribe() will subscribe the client instance to the event, to handle it use client.on('EVENT', function handler() {})
  • List of events, methods, general guide on RPC (outdated but mostly relevant): link

Example

let client = new (require('discord-rpc-revamp').Client)();
client.connect({ clientId: 'YOUR_CLIENT_ID_HERE' }).catch(console.error);

client.on('ready', _ => {
    client.setActivity({
        details: 'Discord Rich Presence',
        state: 'Hello there!',
        startTimestamp: Date.now()
    }).then(_ => console.log('set activity')).catch(console.error);

    client.subscribe('ACTIVITY_JOIN');
    client.subscribe('ACTIVITY_JOIN_REQUEST');

    client.on('ACTIVITY_JOIN', data => {
        console.log('ACTIVITY_JOIN', data);
    });
});

Enjoy!

Readme

Keywords

none

Package Sidebar

Install

npm i discord-rpc-revamp

Weekly Downloads

33

Version

2.0.4

License

MIT

Unpacked Size

21 kB

Total Files

5

Last publish

Collaborators

  • z3db0y