packages feed

telegram-bot-api 7.3 → 7.3.1

raw patch · 6 files changed

+43/−38 lines, 6 files

Files

CHANGELOG.md view
@@ -1,5 +1,9 @@ # telegram-bot-api +## 7.3.1 -- 2024-05-26++- Fix parsers for `InlineQueryResult`, `BackgroundType`, `ChatBoostSource`, `MessageOrigin`.+ ## 7.3 -- 2024-05-25  - Drop support GHC 8.10, 9.0, add support GHC 9.8, 9.10 (see [#182](https://github.com/fizruk/telegram-bot-simple/pull/182)).
src/Telegram/Bot/API/InlineMode/InlineQueryResult.hs view
@@ -321,30 +321,30 @@     (o .: "type" :: Parser Text) >>= \case     "article" -> InlineQueryResultArticle       <$> parseJSON (Object o)-      <*> o .: "url"-      <*> o .: "hide_url"+      <*> o .:? "url"+      <*> o .:? "hide_url"     "photo" -> parseFileId o "photo_file_id" >>= \case       Nothing -> InlineQueryResultPhoto         <$> parseJSON (Object o) -- generic thumbnail         <*> o .: "photo_url"-        <*> o .: "photo_width"-        <*> o .: "photo_height"+        <*> o .:? "photo_width"+        <*> o .:? "photo_height"       Just fileId -> InlineQueryResultCachedPhoto <$> parseJSON (Object o) <*> pure fileId     "gif" -> parseFileId o "gif_file_id" >>= \case       Nothing -> InlineQueryResultGif         <$> parseJSON (Object o) -- generic thumbnail         <*> o .: "gif_url"-        <*> o .: "gif_width"-        <*> o .: "gif_height"-        <*> o .: "gif_duration"+        <*> o .:? "gif_width"+        <*> o .:? "gif_height"+        <*> o .:? "gif_duration"       Just fileId -> InlineQueryResultCachedGif <$> parseJSON (Object o) <*> pure fileId     "mpeg4_gif" -> parseFileId o "mpeg4_file_id" >>= \case       Nothing -> InlineQueryResultMpeg4Gif         <$> parseJSON (Object o) -- generic thumbnail         <*> o .: "mpeg4_url"-        <*> o .: "mpeg4_width"-        <*> o .: "mpeg4_height"-        <*> o .: "mpeg4_duration"+        <*> o .:? "mpeg4_width"+        <*> o .:? "mpeg4_height"+        <*> o .:? "mpeg4_duration"       Just fileId -> InlineQueryResultCachedMpeg4Gif         <$> parseJSON (Object o)         <*> pure fileId@@ -353,9 +353,9 @@         <$> parseJSON (Object o)         <*> o .: "video_url"         <*> o .: "mime_type"-        <*> o .: "video_width"-        <*> o .: "video_height"-        <*> o .: "video_duration"+        <*> o .:? "video_width"+        <*> o .:? "video_height"+        <*> o .:? "video_duration"       Just fileId -> InlineQueryResultCachedVideo         <$> parseJSON (Object o)         <*> pure fileId@@ -363,14 +363,14 @@       Nothing -> InlineQueryResultAudio         <$> parseJSON (Object o)         <*> o .: "audio_url"-        <*> o .: "performer"-        <*> o .: "duration"+        <*> o .:? "performer"+        <*> o .:? "duration"       Just fileId -> InlineQueryResultCachedAudio <$> parseJSON (Object o) <*> pure fileId     "voice" -> parseFileId o "voice_file_id" >>= \case       Nothing -> InlineQueryResultVoice         <$> parseJSON (Object o)         <*> o .: "voice_url"-        <*> o .: "voice_duration"+        <*> o .:? "voice_duration"       Just fileId -> InlineQueryResultCachedVoice <$> parseJSON (Object o) <*> pure fileId     "document" -> parseFileId o "document_file_id" >>= \case       Nothing -> InlineQueryResultDocument@@ -382,25 +382,25 @@       <$> parseJSON (Object o)       <*> o .: "latitude"       <*> o .: "longitude"-      <*> o .: "horizontal_accuracy"-      <*> o .: "live_period"-      <*> o .: "heading"-      <*> o .: "proximity_alert_radius"+      <*> o .:? "horizontal_accuracy"+      <*> o .:? "live_period"+      <*> o .:? "heading"+      <*> o .:? "proximity_alert_radius"     "venue" -> InlineQueryResultVenue       <$> parseJSON (Object o)       <*> o .: "latitude"       <*> o .: "longitude"       <*> o .: "address"-      <*> o .: "foursquare_id"-      <*> o .: "foursquare_type"-      <*> o .: "google_place_id"-      <*> o .: "google_place_type"+      <*> o .:? "foursquare_id"+      <*> o .:? "foursquare_type"+      <*> o .:? "google_place_id"+      <*> o .:? "google_place_type"     "contact" -> InlineQueryResultContact       <$> parseJSON (Object o)       <*> o .: "phone_number"       <*> o .: "first_name"-      <*> o .: "last_name"-      <*> o .: "vcard"+      <*> o .:? "last_name"+      <*> o .:? "vcard"     "game" -> InlineQueryResultGame       <$> parseJSON (Object o)       <*> o .: "game_short_name"
src/Telegram/Bot/API/Types/BackgroundType.hs view
@@ -4,7 +4,7 @@ {-# LANGUAGE OverloadedStrings #-} module Telegram.Bot.API.Types.BackgroundType where -import Data.Aeson (FromJSON (..), ToJSON (..), Value (..), (.=), (.:), withObject)+import Data.Aeson (FromJSON (..), ToJSON (..), Value (..), (.=), (.:), (.:?), withObject) import Data.Aeson.Types (Parser) import Data.Text (Text) import GHC.Generics (Generic)@@ -82,15 +82,15 @@       <$> o .: "type"       <*> o .: "document"       <*> o .: "dark_theme_dimming"-      <*> o .: "is_blurred"-      <*> o .: "is_moving"+      <*> o .:? "is_blurred"+      <*> o .:? "is_moving"     "pattern" -> BackgroundTypePattern       <$> o .: "type"       <*> o .: "document"       <*> o .: "fill"       <*> o .: "intensity"-      <*> o .: "is_inverted"-      <*> o .: "is_moving"+      <*> o .:? "is_inverted"+      <*> o .:? "is_moving"     "chat_theme" -> BackgroundTypeChatTheme       <$> o .: "type"       <*> o .: "theme_name"
src/Telegram/Bot/API/Types/ChatBoostSource.hs view
@@ -4,7 +4,7 @@ {-# LANGUAGE OverloadedStrings #-} module Telegram.Bot.API.Types.ChatBoostSource where -import Data.Aeson (FromJSON (..), ToJSON (..), KeyValue ((.=)), Value (..), withObject, (.:))+import Data.Aeson (FromJSON (..), ToJSON (..), KeyValue ((.=)), Value (..), withObject, (.:), (.:?)) import Data.Aeson.Types (Parser) import Data.Text (Text) import GHC.Generics (Generic)@@ -22,6 +22,7 @@ -- * ChatBoostSourcePremium -- * ChatBoostSourceGiftCode -- * ChatBoostSourceGiveaway+-- data ChatBoostSource   -- | The boost was obtained by subscribing to Telegram Premium or by gifting a Telegram Premium subscription to another user.   = ChatBoostSourcePremium@@ -68,6 +69,6 @@     "giveaway" -> ChatBoostSourceGiveaway       <$> o .: "source"       <*> o .: "giveaway_message_id"-      <*> o .: "user"-      <*> o .: "is_unclaimed"+      <*> o .:? "user"+      <*> o .:? "is_unclaimed"     t -> fail $ Text.unpack ("Unknown source: " <> t)
src/Telegram/Bot/API/Types/MessageOrigin.hs view
@@ -4,7 +4,7 @@ {-# LANGUAGE OverloadedStrings #-} module Telegram.Bot.API.Types.MessageOrigin where -import Data.Aeson (FromJSON (..), ToJSON (..), Value (..), (.=), (.:), withObject)+import Data.Aeson (FromJSON (..), ToJSON (..), Value (..), (.=), (.:), (.:?), withObject) import Data.Aeson.Types (Parser) import Data.Text (Text) import Data.Time.Clock.POSIX (POSIXTime)@@ -86,12 +86,12 @@       <$> o .: "type"       <*> o .: "date"       <*> o .: "sender_chat"-      <*> o .: "author_signature"+      <*> o .:? "author_signature"     "channel" -> MessageOriginChannel       <$> o .: "type"       <*> o .: "date"       <*> o .: "chat"       <*> o .: "message_id"-      <*> o .: "author_signature"+      <*> o .:? "author_signature"     t -> fail $ Text.unpack ("Unknown type: " <> t) 
telegram-bot-api.cabal view
@@ -1,7 +1,7 @@ cabal-version: 1.12  name:           telegram-bot-api-version:        7.3+version:        7.3.1 synopsis:       Easy to use library for building Telegram bots. Exports Telegram Bot API. description:    Please see the README on Github at <https://github.com/fizruk/telegram-bot-simple#readme>                 .