[Linux-only] basically bloxstap for sober
1import { getGameDetails } from "../api/roblox/GameInfo";
2import { registerPlugin } from "../api/Plugin";
3import { SendNotification } from "../api/linux";
4
5registerPlugin(
6 {
7 name: "Game Notifications",
8 id: "notif",
9 description: "Notifications upon game join and teleport",
10 forceEnable: true,
11 configPrio: -9e9
12 },
13 (plugin) => {
14 plugin.on("GAME_JOIN", async (a) => {
15 // console.log("GAME_JOIN", a);
16 const gameName = await getGameDetails(a.placeId);
17 if (!gameName) return;
18 await SendNotification(
19 "Roblox",
20 `${gameName}${a.ipAddrUdmux ? "\n(UDMUX Protected)" : ""}`,
21 3000
22 );
23 });
24 plugin.on("TELEPORT", async (a) => {
25 // console.log("TELEPORT", a);
26 const pi = plugin.currentState.getPlaceId();
27 if (!pi) return;
28 const gameName = await getGameDetails(pi);
29 if (!gameName) return;
30 await SendNotification(
31 "Roblox",
32 `${gameName} is teleporting you to another place (${a.serverType})`,
33 3000
34 );
35 });
36 // plugin.on("GAME_LEAVE", (a) => console.log("GAME_LEAVE", a));
37 // plugin.on("PLAYER_JOIN", (a) => console.log("PLAYER_JOIN", a));
38 // plugin.on("PLAYER_LEAVE", (a) => console.log("PLAYER_LEAVE", a));
39 // plugin.on("STATE_CHANGE", (a) => console.log("STATE_CHANGE", a));
40 // plugin.currentState.onStateChange((a) => {
41 // console.log("onStateChange", a);
42 // });
43 }
44);