telegram-bot-api 7.4.2 → 7.4.3
raw patch · 25 files changed
+55/−83 lines, 25 filesdep −aeson-prettydep −bytestringdep −cron
Dependencies removed: aeson-pretty, bytestring, cron, monad-control, pretty-show, profunctors, split, stm, transformers, unordered-containers, warp, warp-tls
Files
- CHANGELOG.md +6/−0
- src/Telegram/Bot/API/Forum.hs +4/−4
- src/Telegram/Bot/API/Internal/TH.hs +1/−1
- src/Telegram/Bot/API/Internal/Utils.hs +1/−2
- src/Telegram/Bot/API/Methods.hs +1/−9
- src/Telegram/Bot/API/Methods/GetChatMenuButton.hs +1/−1
- src/Telegram/Bot/API/Methods/SendDocument.hs +13/−13
- src/Telegram/Bot/API/Methods/SendPhoto.hs +13/−13
- src/Telegram/Bot/API/Methods/SetStickerSetTitle.hs +0/−1
- src/Telegram/Bot/API/Passport.hs +0/−1
- src/Telegram/Bot/API/Stickers.hs +1/−1
- src/Telegram/Bot/API/Types.hs +2/−9
- src/Telegram/Bot/API/Types/Birthdate.hs +0/−1
- src/Telegram/Bot/API/Types/BotCommandScope.hs +0/−1
- src/Telegram/Bot/API/Types/BotShortDescription.hs +1/−1
- src/Telegram/Bot/API/Types/ChatBackground.hs +1/−1
- src/Telegram/Bot/API/Types/ChatBoostAdded.hs +1/−1
- src/Telegram/Bot/API/Types/Common.hs +0/−1
- src/Telegram/Bot/API/Types/CopyMessageId.hs +1/−1
- src/Telegram/Bot/API/Types/InlineKeyboardMarkup.hs +2/−2
- src/Telegram/Bot/API/Types/MessageAutoDeleteTimerChanged.hs +1/−1
- src/Telegram/Bot/API/Types/ReactionType.hs +1/−2
- src/Telegram/Bot/API/Types/VideoChatEnded.hs +2/−2
- src/Telegram/Bot/API/Types/VideoChatScheduled.hs +1/−1
- telegram-bot-api.cabal +1/−13
CHANGELOG.md view
@@ -1,5 +1,11 @@ # telegram-bot-api +## 7.4.3 -- 2024-11-07++- Remove unused packages (see [#194](https://github.com/fizruk/telegram-bot-simple/pull/194)).+- Remove unused pragmas and apply other hlint suggestions (see [#195](https://github.com/fizruk/telegram-bot-simple/pull/195)).++ ## 7.4.2 -- 2024-10-31 - Fix `ChatFullInfo` type `active_usernames` attribute (see [#192](https://github.com/fizruk/telegram-bot-simple/pull/192)).
src/Telegram/Bot/API/Forum.hs view
@@ -188,7 +188,7 @@ -- ** 'closeGeneralForumTopic' -data CloseGeneralForumTopicRequest = CloseGeneralForumTopicRequest+newtype CloseGeneralForumTopicRequest = CloseGeneralForumTopicRequest { closeGeneralForumTopicChatId :: SomeChatId -- ^ Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername). } deriving Generic@@ -206,7 +206,7 @@ -- ** 'reopenGeneralForumTopic' -data ReopenGeneralForumTopicRequest = ReopenGeneralForumTopicRequest+newtype ReopenGeneralForumTopicRequest = ReopenGeneralForumTopicRequest { reopenGeneralForumTopicRequestChatId :: SomeChatId -- ^ Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername). } deriving Generic@@ -224,7 +224,7 @@ -- ** 'hideGeneralForumTopic' -data HideGeneralForumTopicRequest = HideGeneralForumTopicRequest+newtype HideGeneralForumTopicRequest = HideGeneralForumTopicRequest { hideGeneralForumTopicChatId :: SomeChatId -- ^ Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername). } deriving Generic@@ -242,7 +242,7 @@ -- ** 'unhideGeneralForumTopic' -data UnhideGeneralForumTopicRequest = UnhideGeneralForumTopicRequest+newtype UnhideGeneralForumTopicRequest = UnhideGeneralForumTopicRequest { unhideGeneralForumTopicChatId :: SomeChatId -- ^ Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) } deriving Generic
src/Telegram/Bot/API/Internal/TH.hs view
@@ -63,7 +63,7 @@ constructType typeN tys = foldr arrAp baseTy (filter (not . isMaybeTy) tys) where baseTy = conT typeN- arrAp a b = appT (appT arrowT (pure a)) b+ arrAp a = appT (appT arrowT (pure a)) -- Predicates over TH
src/Telegram/Bot/API/Internal/Utils.hs view
@@ -4,7 +4,6 @@ {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeOperators #-}-{-# LANGUAGE TypeSynonymInstances #-} {-# LANGUAGE CPP #-} module Telegram.Bot.API.Internal.Utils where @@ -95,7 +94,7 @@ instance (ToJSON a, FromJSON a) => GSomeJSON (C1 c (S1 s (K1 i a))) where gsomeToJSON (M1 (M1 (K1 x))) = toJSON x- gsomeParseJSON js = (M1 . M1 . K1) <$> parseJSON js+ gsomeParseJSON js = M1 . M1 . K1 <$> parseJSON js instance (GSomeJSON f, GSomeJSON g) => GSomeJSON (f :+: g) where gsomeToJSON (L1 x) = gsomeToJSON x
src/Telegram/Bot/API/Methods.hs view
@@ -1,18 +1,10 @@-{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE DataKinds #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE TypeApplications #-}-{-# LANGUAGE RecordWildCards #-} {-# LANGUAGE MultiParamTypeClasses #-}-{-# LANGUAGE TypeOperators #-} {-# LANGUAGE DerivingStrategies #-}-{-# LANGUAGE PatternSynonyms #-}-{-# LANGUAGE GeneralizedNewtypeDeriving #-}-{-# LANGUAGE TemplateHaskell #-} module Telegram.Bot.API.Methods ( module Telegram.Bot.API.Types.ParseMode , module Telegram.Bot.API.Types.SomeReplyMarkup- + , module Telegram.Bot.API.Methods.AnswerCallbackQuery , module Telegram.Bot.API.Methods.ApproveChatJoinRequest , module Telegram.Bot.API.Methods.BanChatMember
src/Telegram/Bot/API/Methods/GetChatMenuButton.hs view
@@ -18,7 +18,7 @@ -- ** 'getChatMenuButton' -- | Request parameters for 'getChatMenuButton'.-data GetChatMenuButtonRequest = GetChatMenuButtonRequest+newtype GetChatMenuButtonRequest = GetChatMenuButtonRequest { getChatMenuButtonRequestChatId :: Maybe ChatId -- ^ Unique identifier for the target private chat. If not specified, default bot's menu button will be returned. } deriving Generic
src/Telegram/Bot/API/Methods/SendDocument.hs view
@@ -94,25 +94,25 @@ instance ToMultipart Tmp SendDocumentRequest where toMultipart SendDocumentRequest{..} = MultipartData fields files where fields =- [ Input "document" $ T.pack $ "attach://file"+ [ Input "document" "attach://file" , Input "chat_id" $ case sendDocumentChatId of SomeChatId (ChatId chat_id) -> T.pack $ show chat_id SomeChatUsername txt -> txt ] <>- ( (maybe id (\t -> ((Input "message_thread_id") (T.pack $ show t):)) sendDocumentMessageThreadId)- $ (maybe id (\_ -> ((Input "thumbnail" "attach://thumbnail"):)) sendDocumentThumbnail)- $ (maybe id (\t -> ((Input "caption" t):)) sendDocumentCaption)- $ (maybe id (\t -> ((Input "parse_mode" (TL.toStrict $ encodeToLazyText t)):)) sendDocumentParseMode)- $ (maybe id (\t -> ((Input "caption_entities" (TL.toStrict $ encodeToLazyText t)):)) sendDocumentCaptionEntities)- $ (maybe id (\t -> ((Input "disable_notification" (bool "false" "true" t)):)) sendDocumentDisableNotification)- $ (maybe id (\t -> ((Input "disable_content_type_detection" (bool "false" "true" t)):)) sendDocumentDisableContentTypeDetection)- $ (maybe id (\t -> ((Input "protect_content" (bool "false" "true" t)):)) sendDocumentProtectContent)- $ (maybe id (\t -> ((Input "reply_to_message_id" (TL.toStrict $ encodeToLazyText t)):)) sendDocumentReplyToMessageId)- $ (maybe id (\t -> ((Input "reply_parameters" (TL.toStrict $ encodeToLazyText t)):)) sendDocumentReplyParameters)- $ (maybe id (\t -> ((Input "reply_markup" (TL.toStrict $ encodeToLazyText t)):)) sendDocumentReplyMarkup)+ maybe id (\t -> (Input "message_thread_id" (T.pack $ show t) :)) sendDocumentMessageThreadId+ ( maybe id (const (Input "thumbnail" "attach://thumbnail" :)) sendDocumentThumbnail+ $ maybe id (\t -> (Input "caption" t :)) sendDocumentCaption+ $ maybe id (\t -> (Input "parse_mode" (TL.toStrict $ encodeToLazyText t) :)) sendDocumentParseMode+ $ maybe id (\t -> (Input "caption_entities" (TL.toStrict $ encodeToLazyText t) :)) sendDocumentCaptionEntities+ $ maybe id (\t -> (Input "disable_notification" (bool "false" "true" t) :)) sendDocumentDisableNotification+ $ maybe id (\t -> (Input "disable_content_type_detection" (bool "false" "true" t) :)) sendDocumentDisableContentTypeDetection+ $ maybe id (\t -> (Input "protect_content" (bool "false" "true" t) :)) sendDocumentProtectContent+ $ maybe id (\t -> (Input "reply_to_message_id" (TL.toStrict $ encodeToLazyText t) :)) sendDocumentReplyToMessageId+ $ maybe id (\t -> (Input "reply_parameters" (TL.toStrict $ encodeToLazyText t) :)) sendDocumentReplyParameters+ $ maybe id (\t -> (Input "reply_markup" (TL.toStrict $ encodeToLazyText t) :)) sendDocumentReplyMarkup []) files- = (FileData "file" (T.pack $ takeFileName path) ct path)+ = FileData "file" (T.pack $ takeFileName path) ct path : maybe [] (\t -> [FileData "thumbnail" (T.pack $ takeFileName t) "image/jpeg" t]) sendDocumentThumbnail (path, ct) = case sendDocumentDocument of
src/Telegram/Bot/API/Methods/SendPhoto.hs view
@@ -83,25 +83,25 @@ instance ToMultipart Tmp SendPhotoRequest where toMultipart SendPhotoRequest{..} = MultipartData fields files where fields =- [ Input "photo" $ T.pack $ "attach://file"+ [ Input "photo" "attach://file" , Input "chat_id" $ case sendPhotoChatId of SomeChatId (ChatId chat_id) -> T.pack $ show chat_id SomeChatUsername txt -> txt ] <>- ( (maybe id (\t -> ((Input "message_thread_id" (T.pack $ show t)):)) sendPhotoMessageThreadId)- $ (maybe id (\_ -> ((Input "thumb" "attach://thumb"):)) sendPhotoThumb)- $ (maybe id (\t -> ((Input "caption" t):)) sendPhotoCaption)- $ (maybe id (\t -> ((Input "parse_mode" (TL.toStrict . TL.replace "\"" "" $ encodeToLazyText t)):)) sendPhotoParseMode)- $ (maybe id (\t -> ((Input "caption_entities" (TL.toStrict $ encodeToLazyText t)):)) sendPhotoCaptionEntities)- $ (maybe id (\t -> ((Input "has_spoiler" (bool "false" "true" t)):)) sendPhotoHasSpoiler)- $ (maybe id (\t -> ((Input "disable_notification" (bool "false" "true" t)):)) sendPhotoDisableNotification)- $ (maybe id (\t -> ((Input "protect_content" (bool "false" "true" t)):)) sendPhotoProtectContent)- $ (maybe id (\t -> ((Input "reply_to_message_id" (TL.toStrict $ encodeToLazyText t)):)) sendPhotoReplyToMessageId)- $ (maybe id (\t -> ((Input "reply_parameters" (TL.toStrict $ encodeToLazyText t)):)) sendPhotoReplyParameters)- $ (maybe id (\t -> ((Input "reply_markup" (TL.toStrict $ encodeToLazyText t)):)) sendPhotoReplyMarkup)+ maybe id (\t -> (Input "message_thread_id" (T.pack $ show t) :)) sendPhotoMessageThreadId+ ( maybe id (const (Input "thumb" "attach://thumb" :)) sendPhotoThumb+ $ maybe id (\t -> (Input "caption" t :)) sendPhotoCaption+ $ maybe id (\t -> (Input "parse_mode" (TL.toStrict . TL.replace "\"" "" $ encodeToLazyText t) :)) sendPhotoParseMode+ $ maybe id (\t -> (Input "caption_entities" (TL.toStrict $ encodeToLazyText t) :)) sendPhotoCaptionEntities+ $ maybe id (\t -> (Input "has_spoiler" (bool "false" "true" t) :)) sendPhotoHasSpoiler+ $ maybe id (\t -> (Input "disable_notification" (bool "false" "true" t) :)) sendPhotoDisableNotification+ $ maybe id (\t -> (Input "protect_content" (bool "false" "true" t) :)) sendPhotoProtectContent+ $ maybe id (\t -> (Input "reply_to_message_id" (TL.toStrict $ encodeToLazyText t) :)) sendPhotoReplyToMessageId+ $ maybe id (\t -> (Input "reply_parameters" (TL.toStrict $ encodeToLazyText t) :)) sendPhotoReplyParameters+ $ maybe id (\t -> (Input "reply_markup" (TL.toStrict $ encodeToLazyText t) :)) sendPhotoReplyMarkup []) files- = (FileData "file" (T.pack $ takeFileName path) ct path)+ = FileData "file" (T.pack $ takeFileName path) ct path : maybe [] (\t -> [FileData "thumb" (T.pack $ takeFileName t) "image/jpeg" t]) sendPhotoThumb (path, ct) = case sendPhotoPhoto of
src/Telegram/Bot/API/Methods/SetStickerSetTitle.hs view
@@ -1,5 +1,4 @@ {-# LANGUAGE DataKinds #-}-{-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE TypeApplications #-} {-# LANGUAGE TypeOperators #-} module Telegram.Bot.API.Methods.SetStickerSetTitle where
src/Telegram/Bot/API/Passport.hs view
@@ -1,6 +1,5 @@ {-# LANGUAGE TypeApplications #-} {-# LANGUAGE TypeOperators #-}-{-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE DataKinds #-} module Telegram.Bot.API.Passport where
src/Telegram/Bot/API/Stickers.hs view
@@ -106,7 +106,7 @@ -- ** 'getCustomEmojiStickers' -- | Request parameters for 'getCustomEmojiStickers'.-data GetCustomEmojiStickersRequest = GetCustomEmojiStickersRequest+newtype GetCustomEmojiStickersRequest = GetCustomEmojiStickersRequest { getCustomEmojiStickersRequestCustomEmojiIds :: [Text] -- ^ List of custom emoji identifiers. At most 200 custom emoji identifiers can be specified. } deriving Generic
src/Telegram/Bot/API/Types.hs view
@@ -1,18 +1,11 @@ {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE DuplicateRecordFields #-} {-# LANGUAGE DataKinds #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE GeneralizedNewtypeDeriving #-}-{-# LANGUAGE OverloadedStrings #-}-{-# LANGUAGE TemplateHaskell #-}-{-# LANGUAGE TypeApplications #-}-{-# LANGUAGE LambdaCase #-} {-# LANGUAGE BlockArguments #-} {-# LANGUAGE ScopedTypeVariables #-}-{-# LANGUAGE RecordWildCards #-} {-# LANGUAGE MultiParamTypeClasses #-} module Telegram.Bot.API.Types- ( RequiredQueryParam + ( RequiredQueryParam , module Telegram.Bot.API.Types.Animation , module Telegram.Bot.API.Types.Audio , module Telegram.Bot.API.Types.BotCommand@@ -268,7 +261,7 @@ -- * Games -- | Your bot can offer users HTML5 games to play solo or to compete against each other in groups and one-on-one chats. Create games via @BotFather using the /newgame command. Please note that this kind of power requires responsibility: you will need to accept the terms for each game that your bots will be offering.--- +-- -- Games are a new type of content on Telegram, represented by the Game and InlineQueryResultGame objects. -- Once you've created a game via BotFather, you can send games to chats as regular messages using the sendGame method, or use inline mode with InlineQueryResultGame. -- If you send the game message without any buttons, it will automatically have a 'Play GameName' button. When this button is pressed, your bot gets a CallbackQuery with the game_short_name of the requested game. You provide the correct URL for this particular user and the app opens the game in the in-app browser.
src/Telegram/Bot/API/Types/Birthdate.hs view
@@ -1,5 +1,4 @@ {-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE GeneralizedNewtypeDeriving #-} module Telegram.Bot.API.Types.Birthdate where import Data.Aeson (FromJSON (..), ToJSON (..))
src/Telegram/Bot/API/Types/BotCommandScope.hs view
@@ -1,5 +1,4 @@ {-# LANGUAGE BlockArguments #-}-{-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE LambdaCase #-} {-# LANGUAGE OverloadedStrings #-} module Telegram.Bot.API.Types.BotCommandScope where
src/Telegram/Bot/API/Types/BotShortDescription.hs view
@@ -9,7 +9,7 @@ -- ** 'BotShortDescription' -- | This object represents the bot's short description.-data BotShortDescription = BotShortDescription+newtype BotShortDescription = BotShortDescription { botShortDescriptionShortDescription :: Text -- ^ The bot's short description. } deriving (Generic, Show)
src/Telegram/Bot/API/Types/ChatBackground.hs view
@@ -10,7 +10,7 @@ -- ** 'ChatBackground' -- | This object represents a chat background.-data ChatBackground = ChatBackground+newtype ChatBackground = ChatBackground { chatBackgroundType :: BackgroundType -- ^ Type of the background. } deriving (Generic, Show)
src/Telegram/Bot/API/Types/ChatBoostAdded.hs view
@@ -9,7 +9,7 @@ -- ** 'ChatBoostAdded' -- | This object represents a boost added to a chat or changed.-data ChatBoostAdded = ChatBoostAdded+newtype ChatBoostAdded = ChatBoostAdded { chatBoostAddedBoostCount :: Int -- ^ Number of boosts added by the user. } deriving (Generic, Show)
src/Telegram/Bot/API/Types/Common.hs view
@@ -2,7 +2,6 @@ {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE OverloadedStrings #-}-{-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE TypeApplications #-} module Telegram.Bot.API.Types.Common where
src/Telegram/Bot/API/Types/CopyMessageId.hs view
@@ -10,7 +10,7 @@ -- ** 'CopyMessageId' -- | This object represents result of copyMessage request.-data CopyMessageId = CopyMessageId+newtype CopyMessageId = CopyMessageId { copyMessageIdMessageId :: MessageId -- ^ the MessageId of the sent message. } deriving (Generic, Show)
src/Telegram/Bot/API/Types/InlineKeyboardMarkup.hs view
@@ -11,12 +11,12 @@ -- | This object represents an inline keyboard that appears -- right next to the message it belongs to.-data InlineKeyboardMarkup = InlineKeyboardMarkup+newtype InlineKeyboardMarkup = InlineKeyboardMarkup { inlineKeyboardMarkupInlineKeyboard :: [[InlineKeyboardButton]] -- ^ Array of button rows, each represented by an Array of InlineKeyboardButton objects } deriving (Generic, Show) --- ^ +-- ^ -- **Note**: This will only work in Telegram versions released after 9 April, 2016. Older clients will display unsupported message. instance ToJSON InlineKeyboardMarkup where toJSON = gtoJSON
src/Telegram/Bot/API/Types/MessageAutoDeleteTimerChanged.hs view
@@ -10,7 +10,7 @@ -- ** 'MessageAutoDeleteTimerChanged' -- | This object represents a service message about a change in auto-delete timer settings.-data MessageAutoDeleteTimerChanged = MessageAutoDeleteTimerChanged+newtype MessageAutoDeleteTimerChanged = MessageAutoDeleteTimerChanged { messageAutoDeleteTimerChangedMessageAutoDeleteTime :: Seconds -- ^ New auto-delete time for messages in the chat; in seconds } deriving (Generic, Show)
src/Telegram/Bot/API/Types/ReactionType.hs view
@@ -1,5 +1,4 @@ {-# LANGUAGE BlockArguments #-}-{-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE LambdaCase #-} {-# LANGUAGE OverloadedStrings #-} module Telegram.Bot.API.Types.ReactionType where@@ -16,7 +15,7 @@ -- ** 'ReactionType' -- | This object describes the type of a reaction. Currently, it can be one of--- +-- -- * 'ReactionTypeEmoji', -- * 'ReactionTypeCustomEmoji'. --
src/Telegram/Bot/API/Types/VideoChatEnded.hs view
@@ -11,7 +11,7 @@ -- ** 'VideoChatEnded' -- | This object represents a service message about a video chat ended in the chat.-data VideoChatEnded = VideoChatEnded+newtype VideoChatEnded = VideoChatEnded { videoChatEndedDuration :: Seconds -- ^ Video chat duration in seconds. } deriving (Generic, Show)@@ -22,7 +22,7 @@ -- ** 'VideoChatParticipantsInvited' -data VideoChatParticipantsInvited = VideoChatParticipantsInvited+newtype VideoChatParticipantsInvited = VideoChatParticipantsInvited { videoChatParticipantsInvitedUsers :: Maybe [User] -- ^ New members that were invited to the video chat. } deriving (Generic, Show)
src/Telegram/Bot/API/Types/VideoChatScheduled.hs view
@@ -10,7 +10,7 @@ -- ** 'VideoChatScheduled' -- | This object represents a service message about a video chat scheduled in the chat.-data VideoChatScheduled = VideoChatScheduled+newtype VideoChatScheduled = VideoChatScheduled { videoChatScheduledStartDate :: POSIXTime -- ^ Point in time (Unix timestamp) when the video chat is supposed to be started by a chat administrator. } deriving (Generic, Show)
telegram-bot-api.cabal view
@@ -1,7 +1,7 @@ cabal-version: 1.12 name: telegram-bot-api-version: 7.4.2+version: 7.4.3 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> .@@ -252,33 +252,21 @@ ghc-options: -Wall build-depends: aeson- , aeson-pretty , base >=4.16 && <5- , bytestring- , cron >=0.7.0 , filepath , hashable , http-api-data , http-client , http-client-tls- , monad-control , mtl- , pretty-show- , profunctors , servant , servant-client , servant-multipart-api , servant-multipart-client , servant-server- , split- , stm , template-haskell , text , time- , transformers- , unordered-containers- , warp- , warp-tls default-language: Haskell2010 default-extensions: TemplateHaskell