From 75a8f1ca4bf2d8ab9c4703541d89b44105ed8636 Mon Sep 17 00:00:00 2001 From: enzomtp Date: Tue, 29 Oct 2024 22:53:52 +0100 Subject: [PATCH] Added support for dms and groupchats --- Program.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Program.cs b/Program.cs index 12ecc85..05a8bcc 100644 --- a/Program.cs +++ b/Program.cs @@ -275,7 +275,8 @@ private static void UpdateStreamkitDiscordOverlay(string guildId, string channel { if (!obs.IsConnected) return; - var streamkitUri = new UriBuilder($"https://streamkit.discord.com/overlay/voice/{guildId}/{channelId}?icon=true&online=true&logo=white&text_color=%23ffffff&text_size=14&text_outline_color=%23000000&text_outline_size=0&text_shadow_color=%23000000&text_shadow_size=0&bg_color=%231e2124&bg_opacity=0.95&bg_shadow_color=%23000000&bg_shadow_size=0&invite_code=&limit_speaking=true&small_avatars=true&hide_names=false&fade_chat=0"); + var effectiveGuildId = string.IsNullOrEmpty(guildId) ? channelId : guildId; + var streamkitUri = new UriBuilder($"https://streamkit.discord.com/overlay/voice/{effectiveGuildId}/{channelId}?icon=true&online=true&logo=white&text_color=%23ffffff&text_size=14&text_outline_color=%23000000&text_outline_size=0&text_shadow_color=%23000000&text_shadow_size=0&bg_color=%231e2124&bg_opacity=0.95&bg_shadow_color=%23000000&bg_shadow_size=0&invite_code=&limit_speaking=true&small_avatars=true&hide_names=false&fade_chat=0"); try { var sceneItemId = obs.GetSceneItemId(Config.SceneName, Config.SourceName, 0); @@ -287,11 +288,11 @@ private static void UpdateStreamkitDiscordOverlay(string guildId, string channel throw new Exception($"{Config.SourceName} is not a browser source. Unable to get and set URL... Doh!"); } - if (string.IsNullOrEmpty(guildId) || string.IsNullOrEmpty(channelId)) + if (string.IsNullOrEmpty(guildId) && string.IsNullOrEmpty(channelId)) { obs.SetSceneItemEnabled(Config.SceneName, sceneItemId, false); Log.Logger.Information("Elvis has left the building!"); - } + } else { // Be nice: Respect user's custom StreamKit parameters