From d46cdbd61e633da6c32a63e29df70c4f3fd45682 Mon Sep 17 00:00:00 2001 From: Jameson Allen Date: Sat, 2 Mar 2024 22:03:13 -0600 Subject: [PATCH] feat(new): [TP-1] Adding in states for camera and screenshare --- base/entry.tp | 22 ++++++++++++++++++++++ discord-rpc | 2 +- src/index.js | 8 ++++++++ 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/base/entry.tp b/base/entry.tp index 51ca901..922a4b2 100644 --- a/base/entry.tp +++ b/base/entry.tp @@ -378,6 +378,28 @@ "On" ] }, + { + "id": "discord_camera_status", + "type":"choice", + "desc":" Discord Camera", + "default": "Off", + "valueChoices": [ + "Off", + "On" + ] + + }, + { + "id": "discord_screenshare_status", + "type":"choice", + "desc":" Discord Screen Share", + "default": "Off", + "valueChoices": [ + "Off", + "On" + ] + + }, { "id": "discord_voice_channel_connected", "type": "choice", diff --git a/discord-rpc b/discord-rpc index 23fe6fd..5a73591 160000 --- a/discord-rpc +++ b/discord-rpc @@ -1 +1 @@ -Subproject commit 23fe6fd0f78013bfd8e7ae4957f6c9f2a84daf84 +Subproject commit 5a73591662efdbd79dca01b7b63a7beeca04c145 diff --git a/src/index.js b/src/index.js index 9ea253e..84a5396 100644 --- a/src/index.js +++ b/src/index.js @@ -667,6 +667,8 @@ const connectToDiscord = function () { await DiscordClient.subscribe("CHANNEL_CREATE").catch((err) => {logIt("ERROR",err)}); await DiscordClient.subscribe("VOICE_CHANNEL_SELECT").catch((err) => {logIt("ERROR",err)}); await DiscordClient.subscribe("VOICE_CONNECTION_STATUS").catch((err) => {logIt("ERROR",err)}); + await DiscordClient.subscribe("VIDEO_STATE_UPDATE").catch((err) => {logIt("ERROR",err)}); + await DiscordClient.subscribe("SCREENSHARE_STATE_UPDATE").catch((err) => {logIt("ERROR",err)}); DiscordClient.on("VOICE_STATE_CREATE", (data) => {voiceState('create',data);}) DiscordClient.on("VOICE_STATE_UPDATE", (data) => {voiceState('update',data);}) @@ -716,6 +718,12 @@ const connectToDiscord = function () { DiscordClient.on('VOICE_CONNECTION_STATUS', (data) => { voiceConnectionStatus(data); }) + DiscordClient.on('VIDEO_STATE_UPDATE', (data) => { + TPClient.stateUpdate("discord_camera_status",data.active? "On" : "Off") + }) + DiscordClient.on('SCREENSHARE_STATE_UPDATE', (data) => { + TPClient.stateUpdate("discord_screenshare_status",data.active? "On" : "Off") + }) DiscordClient.on("disconnected", () => { logIt("WARN","discord connection closed, will attempt reconnect, once process detected");