Loading app/Main.hs +5 −4 Original line number Diff line number Diff line Loading @@ -25,7 +25,7 @@ data Model = Model deriving (Show) data Action = NoAction -- ^ Perform no action. | Reply Text -- ^ Reply some text. | InlineReply (Text, Text) | InlineReply [(Text, Text)] | SendHelp -- ^Send help text. deriving (Show) Loading Loading @@ -56,7 +56,7 @@ replyToInline = UpdateParser f where f update = do inlineQuery <- Telegram.updateInlineQuery update let txt = Telegram.inlineQueryQuery inlineQuery return $ InlineReply ("Random", mockRandom txt) return $ InlineReply $ map (\(name, f) -> (name, f txt)) styles -- |Concatenates a list of Maybe functions. Execution goes from left to right. Loading @@ -79,8 +79,9 @@ handleAction NoAction model = pure model handleAction (Reply message) model = model <# do replyText message pure NoAction handleAction (InlineReply (title,message)) model = model <# do answerInlineQuery [Telegram.InlineQueryResultArticle "article" (title <> "\n" <> message) title (Telegram.InputTextMessageContent message) message] handleAction (InlineReply msgs) model = model <# do let results = map (\(title, message) -> Telegram.InlineQueryResultArticle "article" (title <> "\n" <> message) title (Telegram.InputTextMessageContent message) message) msgs answerInlineQuery results pure NoAction handleAction SendHelp model = model <# do reply $ (toReplyMessage help) {replyMessageParseMode = Just Telegram.Markdown, replyMessageDisableWebPagePreview = Just True} Loading Loading
app/Main.hs +5 −4 Original line number Diff line number Diff line Loading @@ -25,7 +25,7 @@ data Model = Model deriving (Show) data Action = NoAction -- ^ Perform no action. | Reply Text -- ^ Reply some text. | InlineReply (Text, Text) | InlineReply [(Text, Text)] | SendHelp -- ^Send help text. deriving (Show) Loading Loading @@ -56,7 +56,7 @@ replyToInline = UpdateParser f where f update = do inlineQuery <- Telegram.updateInlineQuery update let txt = Telegram.inlineQueryQuery inlineQuery return $ InlineReply ("Random", mockRandom txt) return $ InlineReply $ map (\(name, f) -> (name, f txt)) styles -- |Concatenates a list of Maybe functions. Execution goes from left to right. Loading @@ -79,8 +79,9 @@ handleAction NoAction model = pure model handleAction (Reply message) model = model <# do replyText message pure NoAction handleAction (InlineReply (title,message)) model = model <# do answerInlineQuery [Telegram.InlineQueryResultArticle "article" (title <> "\n" <> message) title (Telegram.InputTextMessageContent message) message] handleAction (InlineReply msgs) model = model <# do let results = map (\(title, message) -> Telegram.InlineQueryResultArticle "article" (title <> "\n" <> message) title (Telegram.InputTextMessageContent message) message) msgs answerInlineQuery results pure NoAction handleAction SendHelp model = model <# do reply $ (toReplyMessage help) {replyMessageParseMode = Just Telegram.Markdown, replyMessageDisableWebPagePreview = Just True} Loading