4.0.6 • Published 5 months ago
@t_bot-team/discord-rpc v4.0.6
SoundRPC
Overview
SoundRPC is a fork of the popular discord-rpc package, tailored to assist internal projects with a focus on voice-related functions. By removing unwanted features, it reduces bloat and enhances performance.
Rich Presence Example
Importing the Package
ES5
const rpc = require("@t_bot-team/discord-rpc");
const client = new rpc.Client({ transport: "ipc" });
ES6
import rpc from "@t_bot-team/discord-rpc";
const client = new rpc.Client({ transport: "ipc" });
Examples
Browser Example
const clientId = '287406016902594560';
const scopes = ['rpc', 'messages.read'];
const client = new rpc.Client({ transport: 'websocket' });
client.on('ready', () => {
console.log('Logged in as', client.application.name);
console.log('Authed for user', client.user.username);
client.selectVoiceChannel('81384788862181376');
});
// Log in to RPC with client id
client.login({ clientId, scopes });
IPC Example
const clientId = '287406016902594560';
const scopes = ['rpc']; // For scopes, you will need to specify the clientSecret in the login options
const client = new rpc.Client({ transport: 'ipc' });
client.on('ready', () => {
console.log('Logged in as', client.application.name);
console.log('Authed for user', client.user.username);
});
// Log in to RPC with client id
client.login({ clientId, scopes });