From 99d05fa2005020836de7dd03fc5870534d34c3ec Mon Sep 17 00:00:00 2001 From: LawnCable Date: Mon, 1 Mar 2021 04:42:42 +0100 Subject: fix-formatting --- src/main.ts | 29 ++++++++++++++++------------- src/main/richpresence.ts | 17 ++++++++--------- 2 files changed, 24 insertions(+), 22 deletions(-) diff --git a/src/main.ts b/src/main.ts index 70ceca5..e10f675 100644 --- a/src/main.ts +++ b/src/main.ts @@ -6,7 +6,7 @@ import { Tray, Menu, dialog, - protocol + protocol, } from "electron"; // Keep a global reference of the window object, if you don't, the window will @@ -42,8 +42,8 @@ const createWindow = () => { enableRemoteModule: true, contextIsolation: false, allowRunningInsecureContent: true, - nodeIntegration: true - } + nodeIntegration: true, + }, }); // and load the index.html of the app. @@ -100,15 +100,18 @@ ipcMain.on("debug", (event: any, arg: any) => { import { Status, EventEmitter } from "./main/status"; -import { quit as drpcQuit, setup as setupRichPresence } from "./main/richpresence"; +import { + quit as drpcQuit, + setup as setupRichPresence, +} from "./main/richpresence"; -app.on("ready", async ()=>{ +app.on("ready", async () => { try { - await setupRichPresence() + await setupRichPresence(); } catch (error) { - console.warn("could not connect to discord rich presence") + console.warn("could not connect to discord rich presence"); } -}) +}); app.on("quit", () => { drpcQuit(); @@ -135,7 +138,7 @@ function updateTrayIconMenue() { label: "Open screenshot folder", click: () => { EventEmitter.emit("Mana:openScreenshotDir"); - } + }, }); menue.push({ label: "Kill ManaPlus", @@ -144,20 +147,20 @@ function updateTrayIconMenue() { type: "warning", title: "Kill ManaPlus", message: "Are you sure?", - buttons: ["Yes", "No"] + buttons: ["Yes", "No"], }); if (response === 0) { EventEmitter.emit("Mana:killMana"); } - } + }, }); } else { menue.push({ label: "Close Tray Icon", click: () => { EventEmitter.emit("closeTray"); - } + }, }); } @@ -192,7 +195,7 @@ ipcMain.on("play", async (event: any, arg: any) => { ipcMain.on("dragFileOut", (event: any, filepath: any) => { event.sender.startDrag({ file: filepath, - icon: path.join(__dirname, "../assets/media/screenshot.png") + icon: path.join(__dirname, "../assets/media/screenshot.png"), }); }); diff --git a/src/main/richpresence.ts b/src/main/richpresence.ts index c50c84f..cb4e252 100644 --- a/src/main/richpresence.ts +++ b/src/main/richpresence.ts @@ -1,5 +1,5 @@ import { Status } from "./status"; -import { Client, register } from "discord-rpc" +import { Client, register } from "discord-rpc"; // Only for testing as of right now -> Experimental const ClientId = "551884486351126528"; @@ -33,7 +33,7 @@ const dataSet: { }, }; -let DiscordRPC_Client:Client = null; +let DiscordRPC_Client: Client = null; async function setActivity() { const status = Status.getStatus(); @@ -67,13 +67,13 @@ async function setActivity() { }).catch(console.error); } -export async function setup(): Promise{ - register(ClientId) - DiscordRPC_Client = await (new Client({transport: 'ipc'})).connect(ClientId) +export async function setup(): Promise { + register(ClientId); + DiscordRPC_Client = await new Client({ transport: "ipc" }).connect(ClientId); DiscordRPC_Client.on("ready", () => { setActivity(); - + // activity can only be set every 15 seconds setInterval(() => { setActivity(); @@ -83,11 +83,11 @@ export async function setup(): Promise{ DiscordRPC_Client.subscribe("ACTIVITY_JOIN", (secret: string) => { console.log("we should join with", secret); }); - + DiscordRPC_Client.subscribe("ACTIVITY_SPECTATE", (secret: string) => { console.log("we should spectate with", secret); }); - + // client.subscribe('ACTIVITY_JOIN_REQUEST', (user) => { // if (user.discriminator === '1337') { // client.sendJoinInvite(user); @@ -97,7 +97,6 @@ export async function setup(): Promise{ // }); } - export function quit() { DiscordRPC_Client?.destroy(); console.log("Shutting down Discord RPC integration"); -- cgit v1.2.3-60-g2f50