mirror of
https://github.com/burrow-dev/burrow-client.git
synced 2026-11-19 17:37:50 -05:00
feat: discord rich presence
Client 1.3.0 shows "Playing Burrow" on the player's Discord profile while the game is open: where they are (the game's ajPresence, dens and player parties never named), the time since they started and a button to the download page. It goes through the Discord app's local IPC socket (no packages; Windows pipe, Linux and macOS sockets, Flatpak and Snap too) and retries quietly while Discord is not running. The server names its Discord application in its flashvars (discordAppId); none, no presence.
This commit is contained in:
1 parent
164e2e8adc
commit
92c5042c5e
5 files changed
+218
No files matched your search
@@ -4,6 +4,7 @@ const {app, BrowserWindow, ipcMain, net, session, shell, webContents} = require(
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
const device = require("./device.js");
|
||||
const discord = require("./discord.js");
|
||||
const relay = require("./relay.js");
|
||||
const updater = require("./updater.js");
|
||||
|
||||
@@ -426,6 +427,12 @@ ipcMain.on("openPage", (event, url) => {
|
||||
}
|
||||
});
|
||||
|
||||
// Discord rich presence (discord.js): {appId, state, start, url} while the
|
||||
// game is open, null when it is not.
|
||||
ipcMain.on("presence", (event, info) => {
|
||||
discord.set(info && typeof info === "object" ? info : null);
|
||||
});
|
||||
|
||||
ipcMain.on("toggleFullscreen", () => {
|
||||
if (win) {
|
||||
win.setFullScreen(!win.isFullScreen());
|
||||
|
||||
Reference in new issue
Block a user