diff options
author | Joe Rayhawk <jrayhawk+git@omgwallhack.org> | 2022-07-03 23:04:18 -0700 |
---|---|---|
committer | Joe Rayhawk <jrayhawk+git@omgwallhack.org> | 2022-07-03 23:04:18 -0700 |
commit | 681d1ff924653bf618e0b7bada80fc8dc631733c (patch) | |
tree | d2ab54fc8024a348d014d1f134603907f376e5f7 | |
parent | 262f2edc5d2ece0fd283fefa3606450bfef628d7 (diff) | |
download | twitchtools-681d1ff924653bf618e0b7bada80fc8dc631733c.tar.gz twitchtools-681d1ff924653bf618e0b7bada80fc8dc631733c.zip |
crystal/eventsub.cr: use proper type for cumulative_months
-rw-r--r-- | crystal/eventsub.cr | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/crystal/eventsub.cr b/crystal/eventsub.cr index 328b639..1dc8e29 100644 --- a/crystal/eventsub.cr +++ b/crystal/eventsub.cr @@ -76,9 +76,9 @@ File.open("/tmp/eventsub.#{Process.pid}.txt", "w", 0o644 ) do |file| sub_recver = ( json["event"]["user_login"]?.as_s? || "anonymous" ) sub_broadcaster = ( json["event"]["broadcaster_user_login"]?.as_s? || "unknown" ) sub_plan = ( json["event"]["tier"]?.as_s? || "unknown" ) - sub_months = ( json["event"]["cumulative_months"]?.as_i? || 0 ) + #sub_months = ( json["event"]["cumulative_months"]?.as_i? || 0 ) effectsmsg( "overlay gltext 10 " + sub_recver + " subscribed!" ) - ircmsg( settings["channel"], sub_recver.to_s + " has subscribed for " + sub_months.to_s + " months at sub level #" + sub_plan.to_s + "" ) + ircmsg( settings["channel"], sub_recver.to_s + " has subscribed at sub level #" + sub_plan.to_s + " bungmoBlobDance bungmoBlobDance bungmoBlobDance bungmoBlobDance" ) when "channel.subscription.gift" sub_sender = ( json["event"]["user_login"]?.as_s? || "anonymous" ) sub_recver = ( json["event"]["broadcaster_user_login"]?.as_s? || sub_sender ) @@ -86,15 +86,14 @@ File.open("/tmp/eventsub.#{Process.pid}.txt", "w", 0o644 ) do |file| sub_total = ( json["event"]["total"]?.as_s? || "0" ) sub_cumulative = ( json["event"]["cumulative_total"]?.as_i? || 0 ) effectsmsg( "overlay gltext 10 " + sub_sender + " donated " + sub_total + " subs!" ) - ircmsg( settings["channel"], sub_recver.to_s + " has subscribed for " + sub_cumulative.to_s + " months at sub level #" + sub_plan.to_s ) + ircmsg( settings["channel"], "#{sub_sender} has gifted #{sub_total} tier #{sub_plan} subscription for a total of #{sub_cumulative}" ) when "channel.subscription.message" sub_sender = ( json["event"]["user_login"]?.as_s? || "anonymous" ) - sub_recver = ( json["event"]["broadcaster_user_login"]?.as_s? || sub_sender ) sub_plan = ( json["event"]["tier"]?.as_s? || "unknown" ) - sub_months = ( json["event"]["cumulative_months"]?.as_s? || "0" ) + sub_months = ( json["event"]["cumulative_months"]?.as_i? || 0 ) sub_msg = ( json["event"]["message"]["text"]?.as_s? || "" ) - effectsmsg( "overlay gltext 10 " + sub_recver + " subscribed!" ) - ircmsg( settings["channel"], sub_recver.to_s + " has subscribed for " + sub_months.to_s + " months at sub level #" + sub_plan.to_s + ": " + sub_msg.to_s ) + effectsmsg( "overlay gltext 10 " + sub_sender + " subscribed!" ) + ircmsg( settings["channel"], sub_sender.to_s + " has subscribed for " + sub_months.to_s + " months at sub level #" + sub_plan.to_s + ": " + sub_msg.to_s ) end else STDOUT.puts( json.pretty_inspect ) |