discordjs / RPC

A simple RPC client for Discord
MIT License
466 stars 191 forks source link

I can't use 'rpc.api' #101

Closed Taimoor-Tariq closed 3 years ago

Taimoor-Tariq commented 3 years ago
const { Client } = require('discord-rpc');

const clientId = '';
const clientSecret = '';
const scopes = ['rpc', 'rpc.api'];

const client = new Client({ transport: 'websocket' });

client.on('ready', () => {
    console.log('Logged in as', client.application.name);
    console.log('Authed for user', client.user.username);

    client.getVoiceSettings().then(vc => {
        console.log(vc)
    })
});

client.login({ clientId, clientSecret, scopes }).catch(e => console.error(e));

Error

Error: connection closed
    at WebSocketTransport.<anonymous> (C:\Users\taimo\Desktop\Taimoor\iDevs\DiscordRPC\TEST\node_modules\discord-rpc\src\client.js:118:16)
    at Object.onceWrapper (events.js:421:26)
    at WebSocketTransport.emit (events.js:314:20)
    at WebSocketTransport.onClose (C:\Users\taimo\Desktop\Taimoor\iDevs\DiscordRPC\TEST\node_modules\discord-rpc\src\transports\websocket.js:67:12)
    at WebSocket.onClose (C:\Users\taimo\Desktop\Taimoor\iDevs\DiscordRPC\TEST\node_modules\ws\lib\event-target.js:129:16)
    at WebSocket.emit (events.js:314:20)
    at WebSocket.emitClose (C:\Users\taimo\Desktop\Taimoor\iDevs\DiscordRPC\TEST\node_modules\ws\lib\websocket.js:191:10)
    at Socket.socketOnClose (C:\Users\taimo\Desktop\Taimoor\iDevs\DiscordRPC\TEST\node_modules\ws\lib\websocket.js:858:15)
    at Socket.emit (events.js:314:20)
    at TCP.<anonymous> (net.js:672:12)
devsnek commented 3 years ago

That is a whitelisted scope, you will need permission from discord for it.

Taimoor-Tariq commented 3 years ago

Is there a link to docs for it?

advaith1 commented 3 years ago

the scope has been deleted and no longer exists