Skip to content

Commit 80f5902

Browse files
committed
(#817) Port Bot.Friday gist rendering to OrgMode
1 parent 40fff41 commit 80f5902

File tree

1 file changed

+16
-14
lines changed

1 file changed

+16
-14
lines changed

src/Bot/Friday.hs

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ import Regexp
3838
import Safe
3939
import Text.InterpolatedString.QM
4040
import Transport (Message(..), Sender(..), authorityRoles)
41+
import OrgMode
4142

4243
data FridayVideo = FridayVideo
4344
{ fridayVideoName :: T.Text
@@ -240,20 +241,21 @@ videoCountCommand =
240241

241242
renderQueue :: [FridayVideo] -> T.Text
242243
renderQueue queue@(FridayVideo {fridayVideoAuthor = user}:_) =
243-
T.unlines $
244-
([qmb|** {user}
245-
246-
Video Count {length queue}
247-
248-
|] :) $
249-
map
250-
(\video ->
251-
let ytId = fromMaybe "dQw4w9WgXcQ" $ ytLinkId $ fridayVideoName video
252-
in [qms||{fridayVideoDate video}
253-
|{fridayVideoAuthor video}
254-
|{fridayVideoName video}
255-
|[[https://img.youtube.com/vi/{ytId}/default.jpg]]||])
256-
queue
244+
[qmb|** {user}
245+
246+
Video Count {length queue}\n\n
247+
|] <>
248+
renderTable
249+
["Date", "Submitter", "Video", "Thumbnail"]
250+
(map
251+
(\video ->
252+
let ytId = fromMaybe "dQw4w9WgXcQ" $ ytLinkId $ fridayVideoName video
253+
in [ [qms|{fridayVideoDate video}|]
254+
, [qms|{fridayVideoAuthor video}|]
255+
, [qms|{fridayVideoName video}|]
256+
, [qms|[[https://img.youtube.com/vi/{ytId}/default.jpg]]|]
257+
])
258+
queue)
257259
renderQueue [] = ""
258260

259261
renderQueues :: Maybe T.Text -> VideoQueues -> T.Text

0 commit comments

Comments
 (0)