telegram-bot-simple 0.5.1 → 0.5.2
raw patch · 3 files changed
+18/−5 lines, 3 files
Files
- CHANGELOG.md +6/−1
- src/Telegram/Bot/Simple/UpdateParser.hs +11/−3
- telegram-bot-simple.cabal +1/−1
CHANGELOG.md view
@@ -1,7 +1,12 @@+0.5.2+---++- Helpers from `UpdateParser` module fixed, `commandWithBotName` added (see [#121](https://github.com/fizruk/telegram-bot-simple/pull/121));+ 0.5.1 --- -- Fix Haddock inconsistency around `ParseMode` (see [#114](https://github.com/fizruk/telegram-bot-simple/pull/114));+- Fix inconsistency around `ParseMode` (see [#114](https://github.com/fizruk/telegram-bot-simple/pull/114)); - Fix `copyMessage` method (see [#116](https://github.com/fizruk/telegram-bot-simple/pull/116)); - Add CI via GitHub Actions (see [#119](https://github.com/fizruk/telegram-bot-simple/pull/119)); - Fix GHC 9.0 compilation regression (see [#120](https://github.com/fizruk/telegram-bot-simple/pull/120));
src/Telegram/Bot/Simple/UpdateParser.hs view
@@ -48,7 +48,7 @@ parseUpdate = runUpdateParser text :: UpdateParser Text-text = UpdateParser (updateMessage >=> messageText)+text = UpdateParser (extractUpdateMessage >=> messageText) plainText :: UpdateParser Text plainText = do@@ -65,6 +65,14 @@ -> pure (Text.unwords ws) _ -> fail "not that command" +commandWithBotName :: Text -> Text -> UpdateParser Text+commandWithBotName botname commandname = do+ t <- text+ case Text.words t of+ (w:ws)| w `elem` ["/" <> commandname <> "@" <> botname, "/" <> commandname]+ -> pure (Text.unwords ws)+ _ -> fail "not that command"+ callbackQueryDataRead :: Read a => UpdateParser a callbackQueryDataRead = mkParser $ \update -> do query <- updateCallbackQuery update@@ -72,8 +80,8 @@ readMaybe (Text.unpack data_) updateMessageText :: Update -> Maybe Text-updateMessageText = updateMessage >=> messageText+updateMessageText = extractUpdateMessage >=> messageText updateMessageSticker :: Update -> Maybe Sticker-updateMessageSticker = updateMessage >=> messageSticker +updateMessageSticker = extractUpdateMessage >=> messageSticker
telegram-bot-simple.cabal view
@@ -5,7 +5,7 @@ -- see: https://github.com/sol/hpack name: telegram-bot-simple-version: 0.5.1+version: 0.5.2 synopsis: Easy to use library for building Telegram bots. description: Please see the README on Github at <https://github.com/fizruk/telegram-bot-simple#readme> category: Web