Browse Source

Use custom bot lib version, use reply message

hide
Nicolas Lenz 8 months ago
parent
commit
4bce123ad0
2 changed files with 7 additions and 2 deletions
  1. 3
    2
      src/Main.hs
  2. 4
    0
      stack.yaml

+ 3
- 2
src/Main.hs View File

@@ -49,7 +49,7 @@ main = do
Telegram.defaultTelegramClientEnv (Telegram.Token token) >>= startBot_ (traceBotDefault $ bot config) where
Left exception -> putStrLn $ prettyPrintParseException exception

-- | How to handle Actions.
handleAction :: Action -> Model -> Eff Action Model
handleAction action model = case action of
NoAction -> pure model
@@ -62,8 +62,8 @@ handleAction action model = case action of
Execute cmd -> model <# do
(header, output) <- liftIO $ execute cmd
let r = SomeInlineKeyboardMarkup $ InlineKeyboardMarkup [[callbackButton "Refresh" (commandName cmd)]]
reply $ (toReplyMessage header) {replyMessageParseMode = Just Telegram.Markdown}
reply $ (toReplyMessage output) {replyMessageReplyMarkup = Just r}
headerMessage <- reply $ (toReplyMessage header) {replyMessageParseMode = Just Telegram.Markdown}
reply $ (toReplyMessage output) {replyMessageReplyMarkup = Just r, replyMessageReplyToMessageId = Just $ messageMessageId $ fromJust headerMessage}
pure NoAction
ExecuteReplace cmd -> model <# do
(_, output) <- liftIO $ execute cmd

+ 4
- 0
stack.yaml View File

@@ -2,3 +2,7 @@ resolver: lts-12.24

packages:
- .

extra-deps:
- git: https://github.com/Eisfunke/telegram-bot-simple
commit: 561688d3a56a2368896bd4491b48a58769f296a5

Loading…
Cancel
Save