add dynamic beatmap images to presence #12

Merged
HorizonCode merged 8 commits from dev into master 2024-03-11 17:55:54 +00:00
Showing only changes of commit 8d2024aa0a - Show all commits

View File

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