From bc18d295497106b2dd23b4b45ac0e17b05949f9c Mon Sep 17 00:00:00 2001 From: LLLL Colonq Date: Tue, 8 Oct 2024 15:57:31 -0400 Subject: Fix gifted --- fig-monitor-twitch/src/Fig/Monitor/Twitch.hs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'fig-monitor-twitch/src/Fig/Monitor/Twitch.hs') diff --git a/fig-monitor-twitch/src/Fig/Monitor/Twitch.hs b/fig-monitor-twitch/src/Fig/Monitor/Twitch.hs index e72906c..8b11625 100644 --- a/fig-monitor-twitch/src/Fig/Monitor/Twitch.hs +++ b/fig-monitor-twitch/src/Fig/Monitor/Twitch.hs @@ -364,11 +364,14 @@ twitchEventClient cfg busAddr = do let parseEvent o = do payload <- o .: "payload" event <- payload .: "event" - event .: "user_login" + login <- event .: "user_login" + gift <- event .: "is_gift" + pure (login, gift) case Aeson.parseMaybe parseEvent res of - Just nm -> do + Just (nm, False) -> do log $ "New subscriber: " <> nm cmds.publish [sexp|(monitor twitch subscribe)|] [SExprString nm] + Just _ -> log "Skipping gifted subscription" _ -> log "Failed to extract user from subscribe event" Just ("channel.cheer" :: Text) -> do let parseEvent o = do -- cgit v1.2.3