add dynamic beatmap images to presence #12
|
@ -2,7 +2,10 @@ const DiscordRPC = require("discord-auto-rpc");
|
||||||
const { appName, appVersion } = require("./appInfo.js");
|
const { appName, appVersion } = require("./appInfo.js");
|
||||||
|
|
||||||
const clientId = "1032772293220384808";
|
const clientId = "1032772293220384808";
|
||||||
|
|
||||||
|
/** @type {DiscordRPC.AutoClient} */
|
||||||
let richPresence;
|
let richPresence;
|
||||||
|
|
||||||
let intervalId;
|
let intervalId;
|
||||||
|
|
||||||
let currentStatus = {
|
let currentStatus = {
|
||||||
|
@ -32,6 +35,7 @@ module.exports = {
|
||||||
richPresence = new DiscordRPC.AutoClient({ transport: "ipc" });
|
richPresence = new DiscordRPC.AutoClient({ transport: "ipc" });
|
||||||
richPresence.endlessLogin({ clientId });
|
richPresence.endlessLogin({ clientId });
|
||||||
richPresence.once("ready", () => {
|
richPresence.once("ready", () => {
|
||||||
|
console.log("connected presence with user " + richPresence.user.username);
|
||||||
richPresence.setActivity(currentStatus);
|
richPresence.setActivity(currentStatus);
|
||||||
intervalId = setInterval(() => {
|
intervalId = setInterval(() => {
|
||||||
richPresence.setActivity(currentStatus);
|
richPresence.setActivity(currentStatus);
|
||||||
|
@ -56,7 +60,7 @@ module.exports = {
|
||||||
currentStatus.smallImageText = osuVersion ? `osu! ${osuVersion}` : " ";
|
currentStatus.smallImageText = osuVersion ? `osu! ${osuVersion}` : " ";
|
||||||
},
|
},
|
||||||
update: () => {
|
update: () => {
|
||||||
if (richPresence) {
|
if (richPresence && richPresence.user) {
|
||||||
richPresence.setActivity(currentStatus);
|
richPresence.setActivity(currentStatus);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue
Block a user