summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLLLL Colonq <llll@colonq>2025-10-05 20:08:41 -0400
committerLLLL Colonq <llll@colonq>2025-10-05 20:08:41 -0400
commitd2843a83668ad965cd75f4539407f805fc5c4f57 (patch)
treee3b2cffb9f28915f6b568b61b0c2bc082e2a00d5
parent8f67f0c55b845c80973fcec0fbaef9879f677b91 (diff)
Rename event names
-rw-r--r--fig-monitor-twitch/src/Fig/Monitor/Twitch.hs60
-rw-r--r--fig-web/src/Fig/Web/Module/Redeem.hs2
2 files changed, 31 insertions, 31 deletions
diff --git a/fig-monitor-twitch/src/Fig/Monitor/Twitch.hs b/fig-monitor-twitch/src/Fig/Monitor/Twitch.hs
index 3183256..7e36e93 100644
--- a/fig-monitor-twitch/src/Fig/Monitor/Twitch.hs
+++ b/fig-monitor-twitch/src/Fig/Monitor/Twitch.hs
@@ -285,12 +285,12 @@ twitchEventClient cfg busAddr = do
subscribeRaids sessionId user
busClient busAddr
(\cmds -> do
- cmds.subscribe "monitor twitch poll create"
- cmds.subscribe "monitor twitch prediction create"
- cmds.subscribe "monitor twitch prediction finish"
- cmds.subscribe "monitor twitch vip add"
- cmds.subscribe "monitor twitch vip remove"
- cmds.subscribe "monitor twitch shoutout"
+ cmds.subscribe "fig monitor twitch poll create"
+ cmds.subscribe "fig monitor twitch prediction create"
+ cmds.subscribe "fig monitor twitch prediction finish"
+ cmds.subscribe "fig monitor twitch vip add"
+ cmds.subscribe "fig monitor twitch vip remove"
+ cmds.subscribe "fig monitor twitch shoutout"
forever do
resp <- WS.receiveData conn
case Aeson.eitherDecodeStrict resp of
@@ -309,8 +309,8 @@ twitchEventClient cfg busAddr = do
case Aeson.parseMaybe parseEvent res of
Just (nm, title, minput) -> do
log $ "Channel point reward \"" <> title <> "\" redeemed by: " <> nm
- cmds.publish "monitor twitch redeem incoming"
- . encodeUtf8 . Text.unwords $
+ cmds.publish "fig monitor twitch redeem incoming"
+ . encodeUtf8 . Text.intercalate "\t" $
[nm, title] <> Maybe.maybeToList minput
_else -> log "Failed to extract payload from channel point redeem event"
Just ("channel.prediction.begin" :: Text) -> do
@@ -327,13 +327,13 @@ twitchEventClient cfg busAddr = do
case Aeson.parseMaybe parseEvent res of
Just (pid, oids) -> do
log $ "Prediction begin: " <> pid
- cmds.publish "monitor twitch prediction begin"
+ cmds.publish "fig monitor twitch prediction begin"
. encodeUtf8 . Text.unwords $
[ pid ] <> ((\(title, oid) -> title <> "," <> oid) <$> toList oids)
_else -> log "Failed to extract ID from payload for prediction begin event"
Just ("channel.prediction.end" :: Text) -> do
log "Prediction end"
- cmds.publish "monitor twitch prediction end" ""
+ cmds.publish "fig monitor twitch prediction end" ""
Just ("channel.raid" :: Text) -> do
let parseEvent o = do
payload <- o .: "payload"
@@ -342,7 +342,7 @@ twitchEventClient cfg busAddr = do
case Aeson.parseMaybe parseEvent res of
Just nm -> do
log $ "Incoming raid from: " <> nm
- cmds.publish "monitor twitch raid" $ encodeUtf8 nm
+ cmds.publish "fig monitor twitch raid" $ encodeUtf8 nm
_else -> log "Failed to extract user from raid event"
Just ("channel.follow" :: Text) -> do
let parseEvent o = do
@@ -352,7 +352,7 @@ twitchEventClient cfg busAddr = do
case Aeson.parseMaybe parseEvent res of
Just nm -> do
log $ "New follower: " <> nm
- cmds.publish "monitor twitch follow" $ encodeUtf8 nm
+ cmds.publish "fig monitor twitch follow" $ encodeUtf8 nm
_else -> log "Failed to extract user from follow event"
Just ("channel.subscribe" :: Text) -> do
let parseEvent o = do
@@ -364,7 +364,7 @@ twitchEventClient cfg busAddr = do
case Aeson.parseMaybe parseEvent res of
Just (nm, False) -> do
log $ "New subscriber: " <> nm
- cmds.publish "monitor twitch subscribe" $ encodeUtf8 nm
+ cmds.publish "fig monitor twitch subscribe" $ encodeUtf8 nm
Just _ -> log "Skipping gifted subscription"
_else -> log "Failed to extract user from subscribe event"
Just ("channel.cheer" :: Text) -> do
@@ -377,7 +377,7 @@ twitchEventClient cfg busAddr = do
case Aeson.parseMaybe parseEvent res of
Just (nm, bits) -> do
log $ "New cheer: " <> nm <> " " <> tshow bits
- cmds.publish "monitor twitch cheer"
+ cmds.publish "fig monitor twitch cheer"
. encodeUtf8 . Text.unwords $
[nm, bits]
_else -> log "Failed to extract user from cheer event"
@@ -391,7 +391,7 @@ twitchEventClient cfg busAddr = do
case Aeson.parseMaybe parseEvent res of
Just (nm, num) -> do
log $ "User " <> nm <> " gifted subs: " <> tshow num
- cmds.publish "monitor twitch gift"
+ cmds.publish "fig monitor twitch gift"
. encodeUtf8 . Text.unwords $
[nm, num]
_else -> log "Failed to extract user from gift sub event"
@@ -403,7 +403,7 @@ twitchEventClient cfg busAddr = do
case Aeson.parseMaybe parseEvent res of
Just pollid -> do
log $ "Poll begin: " <> pollid
- cmds.publish "monitor twitch poll begin" $ encodeUtf8 pollid
+ cmds.publish "fig monitor twitch poll begin" $ encodeUtf8 pollid
_else -> log "Failed to extract ID from payload for poll begin event"
Just ("channel.poll.end" :: Text) -> do
let parseEvent o = do
@@ -424,7 +424,7 @@ twitchEventClient cfg busAddr = do
Just (pollid, choices) -> do
let schoices = (\(t, v) -> t <> "," <> v) <$> choices
log $ "Poll end: " <> pollid
- cmds.publish "monitor twitch poll end" . encodeUtf8 . Text.unwords $ [pollid] <> schoices
+ cmds.publish "fig monitor twitch poll end" . encodeUtf8 . Text.unwords $ [pollid] <> schoices
_else -> log $ "Failed to extract ID from payload for poll end event: " <> tshow res
_else -> log $ "Received unknown notification event: " <> tshow resp
Just "session_keepalive" -> pure ()
@@ -433,33 +433,33 @@ twitchEventClient cfg busAddr = do
(\_cmds ev d -> do
let args = Text.splitOn " " $ decodeUtf8 d
case (ev, args) of
- ("monitor twitch poll create", [title, schoices]) -> do
+ ("fig monitor twitch poll create", [title, schoices]) -> do
let choices = Text.splitOn "," schoices
runAuthed cfg do
user <- loginToUserId cfg.userLogin
poll title choices user
- ("monitor twitch prediction create", [title, schoices]) -> do
+ ("fig monitor twitch prediction create", [title, schoices]) -> do
let choices = Text.splitOn "," schoices
runAuthed cfg do
user <- loginToUserId cfg.userLogin
createPrediction title choices user
- ("monitor twitch prediction finish", [pid, oid]) -> do
+ ("fig monitor twitch prediction finish", [pid, oid]) -> do
runAuthed cfg do
user <- loginToUserId cfg.userLogin
finishPrediction pid oid user
- ("monitor twitch vip add", [u]) -> do
+ ("fig monitor twitch vip add", [u]) -> do
runAuthed cfg do
user <- loginToUserId cfg.userLogin
loginToMaybeUserId u >>= \case
Nothing -> pure ()
Just vipuser -> addVIP vipuser user
- ("monitor twitch vip remove", [u]) -> do
+ ("fig monitor twitch vip remove", [u]) -> do
runAuthed cfg do
user <- loginToUserId cfg.userLogin
loginToMaybeUserId u >>= \case
Nothing -> pure ()
Just vipuser -> removeVIP vipuser user
- ("monitor twitch vip shoutout", [u]) -> do
+ ("fig monitor twitch vip shoutout", [u]) -> do
runAuthed cfg do
user <- loginToUserId cfg.userLogin
loginToMaybeUserId u >>= \case
@@ -481,7 +481,7 @@ twitchChannelLiveMonitor cfg busAddr = do
if null live
then log "Update complete! No users live"
else log $ "Update complete! Live users: " <> Text.unwords (Set.toList live)
- cmds.publish "monitor twitch stream online" . encodeUtf8 . Text.unwords $ Set.toList live
+ cmds.publish "fig monitor twitch stream online" . encodeUtf8 . Text.unwords $ Set.toList live
threadDelay $ 5 * 60 * 1000000 -- wait 5 minutes
loop
loop
@@ -534,7 +534,7 @@ twitchChatClient cfg busAddr = do
-- WS.sendTextData conn ("PRIVMSG #lcolonq :test the other direction" :: Text)
busClient busAddr
(\cmds -> do
- cmds.subscribe "monitor twitch chat outgoing"
+ cmds.subscribe "fig monitor twitch chat outgoing"
forever do
resp <- WS.receiveData conn
forM (Text.lines resp) $ \line -> do
@@ -545,18 +545,18 @@ twitchChatClient cfg busAddr = do
WS.sendTextData conn $ "PONG :" <> mconcat msg.params
"CLEARCHAT" -> do
log "Received CLEARCHAT"
- cmds.publish "monitor twitch chat clear-chat" . encodeUtf8 $ Text.unwords msg.params
+ cmds.publish "fig monitor twitch chat clear-chat" . encodeUtf8 $ Text.unwords msg.params
"NOTICE" -> do
log "Received NOTICE"
- cmds.publish "monitor twitch chat notice" . encodeUtf8 $ Text.unwords msg.params
+ cmds.publish "fig monitor twitch chat notice" . encodeUtf8 $ Text.unwords msg.params
"USERNOTICE" -> do
log "Received USERNOTICE"
- cmds.publish "monitor twitch chat user-notice" . encodeUtf8 $ Text.unwords msg.params
+ cmds.publish "fig monitor twitch chat user-notice" . encodeUtf8 $ Text.unwords msg.params
"PRIVMSG"
| Just displaynm <- Map.lookup "display-name" msg.tags
, Nothing <- Map.lookup "custom-reward-id" msg.tags -> do
log $ "Received chat message from: " <> displaynm
- cmds.publish "monitor twitch chat incoming" . encodeUtf8 . Text.unwords $
+ cmds.publish "fig monitor twitch chat incoming" . encodeUtf8 . Text.unwords $
[ displaynm
, Text.intercalate "\n" $ (\(key, v) -> key <> "\t" <> v) <$> Map.toList msg.tags
] <> drop 1 msg.params
@@ -564,7 +564,7 @@ twitchChatClient cfg busAddr = do
)
(\_cmds ev d -> do
case ev of
- "monitor twitch chat outgoing" -> do
+ "fig monitor twitch chat outgoing" -> do
let msg = decodeUtf8 d
log $ "Sending chat message: " <> msg
WS.sendTextData conn $ mconcat
diff --git a/fig-web/src/Fig/Web/Module/Redeem.hs b/fig-web/src/Fig/Web/Module/Redeem.hs
index 1b5fbaa..6f3d88b 100644
--- a/fig-web/src/Fig/Web/Module/Redeem.hs
+++ b/fig-web/src/Fig/Web/Module/Redeem.hs
@@ -19,7 +19,7 @@ secure a = do
name <- formParam "name"
input <- formParamMaybe "input"
log $ creds.user <> " redeemed: " <> name
- liftIO . a.cmds.publish "frontend redeem incoming"
+ liftIO . a.cmds.publish "fig web redeem incoming"
. encodeUtf8 . Text.intercalate "\t" $
[ creds.user
, name