From ccd152572c6dec241c71bd5050f8908fbd084b51 Mon Sep 17 00:00:00 2001 From: Core <64542347+coredev-uk@users.noreply.github.com> Date: Fri, 3 Jun 2022 12:38:51 +0100 Subject: [PATCH] Reload function --- src/main/plugins/discordrpc.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/main/plugins/discordrpc.ts b/src/main/plugins/discordrpc.ts index fe933903..99fa506c 100644 --- a/src/main/plugins/discordrpc.ts +++ b/src/main/plugins/discordrpc.ts @@ -70,6 +70,7 @@ export default class DiscordRPC { }) } }) + ipcMain.on("reloadRPC", () => this.reload()) } /** @@ -257,4 +258,14 @@ export default class DiscordRPC { } return activity } + + /** + * Reloads DiscordRPC + */ + private reload() { + if (this._client) { + this._client.destroy() + } + this.connect() + } }