Git Product home page Git Product logo

Comments (10)

PLASMAchicken avatar PLASMAchicken commented on May 31, 2024

How do u give the rpc client the client id?

from rpc.

SgtBreadStick avatar SgtBreadStick commented on May 31, 2024

it detects 2 different games, ATS or ETS2, it switches to the game. We have the main index.js which goes to RichPresenceManager.js then the config.js which has the IDs,

The config.js shows

applications: {
ets2: '432559364772200479',
ats: '454028920107565107',
},

The RichPresenceManager.js shows

                    if (!instance.rpcReady) {

                        instance.rpcOnChangingState = true;

                        // getting application id (default ETS2)
                        var applicationID = config.applications.ets2;

                        // checking if playing ATS
                        if (instance.isAts(data)) {
                            applicationID = config.applications.ats;
                            instance.logger.info('Game detected: ATS');
                        } else
                            instance.logger.info('Game detected: ETS2');

                        instance.logger.info(`Using Discord Application ID ${applicationID}`);

                        // creating a new Discord RPC Client instance
                        instance.rpc = new DiscordRPC.Client({
                            transport: 'ipc'
                        });

                        // login to RPC
                        instance.rpc.login(applicationID).then(() => {
                            instance.logger.info('Discord RPC ready');
                            // cleaning up variables to save RPC Client state
                            instance.rpcReady = true;
                            instance.rpcOnChangingState = false;
                        }).catch(console.error);
                    }

The version on github is this
https://github.com/VirtualTruckerRPC/Virtual-Trucker-Rich-Presence

from rpc.

Lewdcario avatar Lewdcario commented on May 31, 2024

Here you go, the correct way to login as per the example.

from rpc.

SgtBreadStick avatar SgtBreadStick commented on May 31, 2024

I have gone and set it to the correct way to login and when the Discord-RPC destroy function is called it shows this error. It hasn't done this is previous versions either...

Discord RPC Client destroyed
MP Checker interval reset
Location Checker interval reset
(node:14760) UnhandledPromiseRejectionWarning: TypeError: (intermediate value).destroy is not a function
at RPCClient.destroy (C:\Users\supac\Desktop\Things\VT-RPC 2\node_modules\discord-rpc\src\Client.js:639:11)
at RichPresenceManager.destroyRPCClient (C:\Users\supac\Desktop\Things\VT-RPC 2\RichPresenceManager.js:324:22)
at ETCarsClient. (C:\Users\supac\Desktop\Things\VT-RPC 2\RichPresenceManager.js:139:22)
at ETCarsClient.emit (events.js:182:13)
at ETCarsClient.receiveError (C:\Users\supac\Desktop\Things\VT-RPC 2\node_modules\etcars-node-client\index.js:181:14)
at Socket.etcarsSocket.on (C:\Users\supac\Desktop\Things\VT-RPC 2\node_modules\etcars-node-client\index.js:88:26)
at Socket.emit (events.js:182:13)
at emitErrorNT (internal/streams/destroy.js:82:8)
at emitErrorAndCloseNT (internal/streams/destroy.js:50:3)
at process._tickCallback (internal/process/next_tick.js:63:19)
(node:14760) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:14760) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Discord RPC Client destroyed
(node:14760) UnhandledPromiseRejectionWarning: TypeError: (intermediate value).destroy is not a function
at RPCClient.destroy (C:\Users\supac\Desktop\Things\VT-RPC 2\node_modules\discord-rpc\src\Client.js:639:11)
at RichPresenceManager.destroyRPCClient (C:\Users\supac\Desktop\Things\VT-RPC 2\RichPresenceManager.js:324:22)
at ETCarsClient. (C:\Users\supac\Desktop\Things\VT-RPC 2\RichPresenceManager.js:139:22)
at ETCarsClient.emit (events.js:182:13)
at ETCarsClient.receiveError (C:\Users\supac\Desktop\Things\VT-RPC 2\node_modules\etcars-node-client\index.js:181:14)
at Socket.etcarsSocket.on (C:\Users\supac\Desktop\Things\VT-RPC 2\node_modules\etcars-node-client\index.js:88:26)
at Socket.emit (events.js:182:13)
at emitErrorNT (internal/streams/destroy.js:82:8)
at emitErrorAndCloseNT (internal/streams/destroy.js:50:3)
at process._tickCallback (internal/process/next_tick.js:63:19)
(node:14760) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 4)

from rpc.

devsnek avatar devsnek commented on May 31, 2024

@SgtBreadStick can you verify what version of rpc you're using

from rpc.

SgtBreadStick avatar SgtBreadStick commented on May 31, 2024

npm [email protected]

from rpc.

Hiyudev avatar Hiyudev commented on May 31, 2024

I dont know soo much about RPC.
But i think you need to use this:
rpc.login({ clientId: ClientId });

from rpc.

SgtBreadStick avatar SgtBreadStick commented on May 31, 2024

After many attempts it still shows the same error, i will keep the rpc downgraded to the previous version that worked, i tried literally everything and still same error everytime

from rpc.

devsnek avatar devsnek commented on May 31, 2024

@SgtBreadStick i think your RichPresenceManager.destroyRPCClient has some bugs.

i recommend using https://npmjs.org/discord-rich-presence. it will handle ratelimits and connections and everything for you.

from rpc.

SgtBreadStick avatar SgtBreadStick commented on May 31, 2024

i'll try that, see how it goes, thanks. I dont understand why it does this because it was fine before

EDIT:
i still keep getting error 4000 yet it is all correct

from rpc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.