Skip to content

saucesteals/discord-auto-rpc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


NPM version NPM downloads Dependencies

NPM info

Discord Auto RPC

Extends the discord-rpc library to automatically reconnect on disconnect/error

Example

import { AutoClient } from "discord-auto-rpc";
// import * as DiscordRPC from "discord-auto-rpc"
// const AutoClient = DiscordRPC.AutoClient

const client = new AutoClient({ transport: "ipc" });

const setActivity = () => {
  client.setActivity({
    details: "Hello",
    state: ":)",
    startTimestamp: new Date(),
    buttons: [{ label: "Example", url: "https://example.com" }],
  });
};

client.once("ready", () => {
  setActivity();
  setInterval(setActivity, 15e3);
});

client.endlessLogin({ clientId: "797173289616801862" });

// client.endlessLogin() will keep retrying to login until it is successful (ex. wait until discord is open if its not)

// if you want to attempt to login once - client.login()
// client.login() is still able to reconnect

Note that the auto reconnecting feature is only present when using IPC as the transport

About

discord-rpc with auto-reconnect

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published