@@ -72,34 +72,29 @@ refreshHelpGistId =
7272 cmapR (const " Scheduled to refresh the Help Gist Page" ) $
7373 Reaction replyMessage
7474
75- gistRenderBuiltinCommand :: (T. Text , BuiltinCommand ) -> T. Text
76- gistRenderBuiltinCommand (name, command) =
77- [qms ||{name}|{bcDescription command}|{bcGitHubLocation command}||]
78-
79- gistRenderCustomCommand :: CustomCommand -> T. Text
80- gistRenderCustomCommand (CustomCommand name message times) =
81- [qms ||{name}|{message}|{times}||]
82-
8375gistRenderCommandTable :: CommandTable -> T. Text
8476gistRenderCommandTable =
85- (" * Builtin Commands \n " <> ) .
86- T. unlines . map gistRenderBuiltinCommand . M. toList
77+ (" * Builtin Commands \n " <> ) . T. unlines . map renderRow . M. toList
78+ where
79+ renderRow (name, command) =
80+ [qms ||{name}|{bcDescription command}|{bcGitHubLocation command}||]
81+
82+ gistRenderCustomCommandsTable :: [Entity CustomCommand ] -> T. Text
83+ gistRenderCustomCommandsTable =
84+ (" * Custom commands \n " <> ) . T. unlines . map (renderRow . entityPayload)
85+ where
86+ renderRow (CustomCommand name message times) =
87+ [qms ||{name}|{message}|{times}||]
8788
88- -- TODO(#649): Help Gist Page does not include CustomCommands
8989refreshHelpGist :: CommandTable -> GistId -> Effect ()
9090refreshHelpGist commandTable gistId = do
91- customsList <- getCustomCommands
92- let customCommands =
93- T. unlines $ gistRenderCustomCommand . entityPayload <$> customsList
91+ customsList <- selectEntities Proxy All
9492 updateGistFile
9593 helpGistFileName
96- (FileContent (gistText <> " \n * Custom commands \n " <> customCommands))
94+ (FileContent
95+ (gistRenderCommandTable commandTable <> " \n " <>
96+ gistRenderCustomCommandsTable customsList))
9797 gistId
98- where
99- gistText = gistRenderCommandTable commandTable
100-
101- getCustomCommands :: Effect [Entity CustomCommand ]
102- getCustomCommands = selectEntities Proxy All
10398
10499startRefreshHelpGistTimer :: CommandTable -> Effect ()
105100startRefreshHelpGistTimer commandTable =
0 commit comments