Commit 7133b799 authored by Nicolas Lenz's avatar Nicolas Lenz

Show all styles

parent 0e5a8860
......@@ -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)
......@@ -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.
......@@ -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}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment