discord-auto-rpc
v1.0.17
Published
Auto reconnecting discord rpc
Downloads
385
Readme
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