Skip to content

Commit 4b88b50

Browse files
committed
Message that doesn't lie
1 parent 7bbf2b8 commit 4b88b50

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

src/Bot/Dubtrack.hs

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -79,28 +79,30 @@ instance IsEntity RoomName where
7979
fromProperties = fmap RoomName . extractProperty "name"
8080

8181
getRoom :: Effect (Maybe (Entity RoomName))
82-
getRoom =
83-
listToMaybe <$> selectEntities P.Proxy (Take 1 All)
82+
getRoom = listToMaybe <$> selectEntities P.Proxy (Take 1 All)
8483

8584
setDubtrackRoom :: Reaction Message T.Text
8685
setDubtrackRoom =
8786
liftR
8887
(\msg -> do
8988
mayReply <- getRoom
9089
case mayReply of
91-
Just reply -> void $ updateEntityById $ (\a -> a {unName = msg}) <$> reply
92-
Nothing -> void $ createEntity P.Proxy $ RoomName msg
93-
) $ cmapR (const "Updated room for dubtrack") $ Reaction replyMessage
90+
Just reply ->
91+
void $ updateEntityById $ (\a -> a {unName = msg}) <$> reply
92+
Nothing -> void $ createEntity P.Proxy $ RoomName msg) $
93+
cmapR (const "Updated room for dubtrack") $ Reaction replyMessage
9494

9595
-- TODO(#221): Dubtrack room is hardcode
9696
currentSongCommand :: Reaction Message ()
9797
currentSongCommand =
9898
Reaction $ \Message {messageSender = sender} -> do
9999
mayRoom <- getRoom
100100
case mayRoom of
101-
Nothing -> replyToSender sender
102-
"Dubtrack room not set, a mod can run '!config room name' to set it"
103-
Just mahroom -> do
101+
Nothing ->
102+
replyToSender
103+
sender
104+
"Dubtrack room not set, a mod can run '!config dubtrack $ROOM_NAME' to set it"
105+
Just mahroom -> do
104106
request <-
105107
parseRequest $
106108
"https://api.dubtrack.fm/room/" <>
@@ -112,5 +114,5 @@ currentSongCommand =
112114
maybe
113115
(replyToSender sender "Nothing is playing right now")
114116
(\song ->
115-
replyToSender sender [qms|❝{songName song}❞: {songLink song}|])
117+
replyToSender sender [qms|❝{songName song}❞: {songLink song}|])
116118
(roomCurrentSong $ drData dubtrackResponse)

0 commit comments

Comments
 (0)