Skip to content

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

License

Notifications You must be signed in to change notification settings

SITCommunity/discord-rpc

Repository files navigation

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

// 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 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

License

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

Credits

About

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

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published