1.5.8 • Published 9 days ago

dc-rpc v1.5.8

Weekly downloads
-
License
MIT
Repository
github
Last release
9 days ago

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

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

// Create an instance of Discord-RPC
const client = new RpcClient({ transport: 'ipc' }); // currently websocket not supported

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

// Your 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('Logged in as', client.application); // Console: Logged in as brokenedtz
  console.log('Authed for user', client.user);
  /** Console:
   * Authed for user {
   * id: 'user_id',
   * username: 'brokenedtz',
   * discriminator: '0',
   * global_name: 'リオ',
   * avatar: 'avatar_id',
   * avatar_decoration_data: null,
   * bot: false,
   * flags: flag_id,
   * premium_type: 0
   * }
   */

  // Set Activity (Example)
  client.setActivity({ state: 'it work!!!', details: 'Testing RPC', startTimestamp: Date.now() });
});

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

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

Join our Discord server here

Licence & Copyright

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

Credits

1.5.8

9 days ago

1.5.7

16 days ago

1.5.6

2 years ago

1.0.2

2 years ago