From 681d1ff924653bf618e0b7bada80fc8dc631733c Mon Sep 17 00:00:00 2001 From: Joe Rayhawk Date: Sun, 3 Jul 2022 23:04:18 -0700 Subject: crystal/eventsub.cr: use proper type for cumulative_months --- crystal/eventsub.cr | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'crystal/eventsub.cr') 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 ) -- cgit v1.2.3