Skip to content

Instantly share code, notes, and snippets.

@Neodevils
Last active February 29, 2024 14:47
Show Gist options
  • Save Neodevils/8643c866d695aa920c3ed9218c35f608 to your computer and use it in GitHub Desktop.
Save Neodevils/8643c866d695aa920c3ed9218c35f608 to your computer and use it in GitHub Desktop.
This is for RPC on Discord User Profile
import discordRPC from "discord-rpc";
const { Client, register } = discordRPC;
const CLIENT_ID = "736561919292473454"; // Your Discord Bot ID
const RPC = new Client({ transport: "ipc" });
register(CLIENT_ID);
async function activity() {
if (!RPC) return;
RPC.setActivity({
details: "Feel free to support my Ita project!",
state: "Coding solo",
largeImageKey: "https://i.ibb.co/xMQ9XGy/ita-logo.webp",
largeImageText: 'Ita "Bluefire" Sun',
smallImageKey: "https://i.ibb.co/26J0BqS/cube20x.png",
smallImageText: "Minesa Hub",
instance: false,
startTimestamp: Date.now(),
buttons: [
{
label: `Invite Ita`,
url: `https://minesa.live/users/ita.html`,
},
{
label: `Join Minesa Hub`,
url: `https://discord.gg/XCwC2vKjpj`,
},
],
});
}
export function setRPC() {
RPC.on("ready", async () => {
console.log("RPC Presence up");
activity();
setInterval(() => {
activity();
}, 100000000);
});
RPC.login({ clientId: CLIENT_ID });
}
// run setRPC() on your main file (you probably named it "index.js")
// This only work on Discord Client, not web (maybe with plugins)
/*
import { setRPC } from "./rpc.js";
setRPC();
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment