telegram-api 0.4.3.0 → 0.4.3.1
raw patch · 6 files changed
+44/−17 lines, 6 files
Files
- CHANGELOG.md +12/−0
- README.md +1/−1
- src/Web/Telegram/API/Bot.hs +5/−8
- src/Web/Telegram/API/Bot/Data.hs +23/−5
- src/Web/Telegram/API/Bot/Requests.hs +1/−1
- telegram-api.cabal +2/−2
CHANGELOG.md view
@@ -1,3 +1,15 @@+## 0.4.3.1++Bugfixes:++* Exposed `MessageEntity`++## 0.4.3.0++Features:++* Added Inline Keyboard to messages+ ## 0.4.2.0 Features:
README.md view
@@ -129,7 +129,7 @@ ``` stack test --test-arguments "-h"-stack test --test-arguments "--integration -t BOT_TOKEN -c CHAT_ID -v BOT_NAME -- -h"+stack test --test-arguments "--integration -t BOT_TOKEN -c CHAT_ID -b BOT_NAME -- -h" ``` Note: Inline Spec is disabled for now...
src/Web/Telegram/API/Bot.hs view
@@ -1,13 +1,10 @@ -- | This module provides Telegram Bot API module Web.Telegram.API.Bot (- module Web.Telegram.API.Bot.API- , module Web.Telegram.API.Bot.Data- , module Web.Telegram.API.Bot.Responses- , module Web.Telegram.API.Bot.Requests+ module TAPI ) where -import Web.Telegram.API.Bot.API-import Web.Telegram.API.Bot.Data-import Web.Telegram.API.Bot.Responses-import Web.Telegram.API.Bot.Requests+import Web.Telegram.API.Bot.API as TAPI+import Web.Telegram.API.Bot.Data as TAPI+import Web.Telegram.API.Bot.Responses as TAPI+import Web.Telegram.API.Bot.Requests as TAPI
src/Web/Telegram/API/Bot/Data.hs view
@@ -9,6 +9,7 @@ , ChatMember (..) , Chat (..) , Message (..)+ , MessageEntity (..) , PhotoSize (..) , Audio (..) , Document (..)@@ -57,6 +58,7 @@ ) where import Data.Aeson+import Data.Maybe import Data.Aeson.Types import Data.Text (Text) import qualified Data.Char as Char@@ -138,8 +140,8 @@ toJSON HTML = "HTML" instance FromJSON ParseMode where- parseJSON "Markdown" = pure $ Markdown- parseJSON "HTML" = pure $ HTML+ parseJSON "Markdown" = pure Markdown+ parseJSON "HTML" = pure HTML parseJSON _ = fail "Failed to parse ParseMode" -- | This object represents one size of a photo or a 'File' / 'Sticker' thumbnail.@@ -305,7 +307,23 @@ } deriving (Show, Generic) instance ToJSON InputMessageContent where- toJSON = toJsonDrop 4+ toJSON (InputTextMessageContent txt mode preview) = object $+ ("message_text" .= txt) : catMaybes [+ ("parse_mode" .=) <$> mode,+ ("disable_web_page_preview" .=) <$> preview]+ toJSON (InputLocationMessageContent lat lon) = object [+ "latitude" .= lat,+ "longitude" .= lon ]+ toJSON (InputVenueMessageContent lat lon title addr fsq_id) = object $ [+ "latitude" .= lat,+ "longitude" .= lon,+ "title" .= title,+ "address" .= addr ] ++ maybeToList+ (("foursquare_id" .=) <$> fsq_id)+ toJSON (InputContactMessageContent phone fName lName) = object $ [+ "phone_number" .= phone,+ "first_name" .= fName] ++ maybeToList+ (("last_name" .=) <$> lName) instance FromJSON InputMessageContent where parseJSON = parseJsonDrop 4@@ -538,12 +556,12 @@ } deriving (Show, Generic) dropCached :: String -> String-dropCached name = if isPrefixOf "Cached" name then drop 6 name else name+dropCached name = if "Cached" `isPrefixOf` name then drop 6 name else name tagModifier :: String -> String tagModifier "InlineQueryResultMpeg4Gif" = "mpeg4_gif" tagModifier "InlineQueryResultCachedMpeg4Gif" = "mpeg4_gif"-tagModifier x = ((fmap Char.toLower) . dropCached . (drop 17)) x+tagModifier x = (fmap Char.toLower . dropCached . drop 17) x inlineQueryJSONOptions :: Options inlineQueryJSONOptions = defaultOptions {
src/Web/Telegram/API/Bot/Requests.hs view
@@ -463,7 +463,7 @@ parseJSON = parseJsonDrop 7 sendChatActionRequest :: Text -> ChatAction -> SendChatActionRequest-sendChatActionRequest chatId action = SendChatActionRequest chatId action+sendChatActionRequest = SendChatActionRequest data AnswerInlineQueryRequest = AnswerInlineQueryRequest {
telegram-api.cabal view
@@ -1,5 +1,5 @@ name: telegram-api-version: 0.4.3.0+version: 0.4.3.1 synopsis: Telegram Bot API bindings description: High-level bindings to the Telegram Bot API homepage: http://github.com/klappvisor/haskell-telegram-api#readme@@ -47,7 +47,7 @@ , bytestring , string-conversions default-language: Haskell2010- ghc-options: -O2 -Wall -fno-warn-name-shadowing -fno-warn-unused-binds+ ghc-options: -Wall -fno-warn-name-shadowing -fno-warn-unused-binds test-suite telegram-api-test type: exitcode-stdio-1.0