diff options
author | Joe Rayhawk <jrayhawk+git@omgwallhack.org> | 2022-04-09 22:50:58 -0700 |
---|---|---|
committer | Joe Rayhawk <jrayhawk+git@omgwallhack.org> | 2022-04-09 22:50:58 -0700 |
commit | 262f2edc5d2ece0fd283fefa3606450bfef628d7 (patch) | |
tree | ca8fbb78800741091935af9944f3d3a7137331ee /crystal/irc.cr | |
parent | 8a7e4ec6a0e737058251ae4b8d1c1eaf4b712d8d (diff) | |
download | twitchtools-262f2edc5d2ece0fd283fefa3606450bfef628d7.tar.gz twitchtools-262f2edc5d2ece0fd283fefa3606450bfef628d7.zip |
crystal/irc.cr: obs: minor improvements to exception and reporting logic
Diffstat (limited to 'crystal/irc.cr')
-rw-r--r-- | crystal/irc.cr | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/crystal/irc.cr b/crystal/irc.cr index 391f2c8..5d2283c 100644 --- a/crystal/irc.cr +++ b/crystal/irc.cr @@ -142,7 +142,7 @@ end lastvoice = Array(String).new -# OBS +# obs-websocket spawn do loop do begin @@ -179,6 +179,8 @@ spawn do obsipc.send( request.to_json ) when "SourceFilterVisibilityChanged" ircipc.send( { "##{settings["channel"]}", "| obs: source #{json["sourceName"]} filter #{json["filterName"]} visibility is now #{json["filterEnabled"]}" } ) + when "SceneItemVisibilityChanged" + ircipc.send( { "##{settings["channel"]}", "| obs: source #{json["item-name"]} visibility is now #{json["item-visible"].as_bool}" } ) end print( "RECEIVED: ") print( json.to_pretty_json ) @@ -204,12 +206,15 @@ spawn do end end obs_pubsub.run + rescue ex : IO::Error + pp ex + ircipc.send( { "#" + settings["channel"], "obs.cr:obs: " + ex.to_s.gsub(/\r|\n/, ' ') + ": Maybe try again in 10 seconds?" } ) rescue ex : Socket::ConnectError # these are a bit noisy pp ex obs_pubsub && obs_pubsub.close rescue ex - ircmsg( settings["home"], settings["channel"], "irc.cr: " + ex.to_s.gsub(/\r|\n/, ' ') ) + ircmsg( settings["home"], settings["channel"], "irc.cr:obs: " + ex.to_s.gsub(/\r|\n/, ' ') ) puts ex obs_pubsub && obs_pubsub.close end |