summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLawnCable <git@lawncable.net>2021-03-01 04:42:42 +0100
committerLawnCable <git@lawncable.net>2021-03-01 04:42:42 +0100
commit99d05fa2005020836de7dd03fc5870534d34c3ec (patch)
treea349d0a8c33eea2bfd7063e379ce5f87787f13f3
parent2ac20473ce59620f8348f4e5abe2141e6cc41b34 (diff)
downloadelectron-99d05fa2005020836de7dd03fc5870534d34c3ec.tar.gz
electron-99d05fa2005020836de7dd03fc5870534d34c3ec.tar.bz2
electron-99d05fa2005020836de7dd03fc5870534d34c3ec.tar.xz
electron-99d05fa2005020836de7dd03fc5870534d34c3ec.zip
fix-formatting
-rw-r--r--src/main.ts29
-rw-r--r--src/main/richpresence.ts17
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<void>{
- register(ClientId)
- DiscordRPC_Client = await (new Client({transport: 'ipc'})).connect(ClientId)
+export async function setup(): Promise<void> {
+ 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<void>{
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<void>{
// });
}
-
export function quit() {
DiscordRPC_Client?.destroy();
console.log("Shutting down Discord RPC integration");