telegram-bot-simple 0.4.2 → 0.4.3
raw patch · 9 files changed
+33/−13 lines, 9 files
Files
- CHANGELOG.md +4/−0
- examples/EchoBot.hs +2/−1
- examples/GameBot.hs +2/−1
- src/Telegram/Bot/API/Games.hs +1/−0
- src/Telegram/Bot/API/Methods.hs +11/−6
- src/Telegram/Bot/API/Stickers.hs +4/−1
- src/Telegram/Bot/API/Types.hs +5/−2
- src/Telegram/Bot/Simple/Reply.hs +3/−1
- telegram-bot-simple.cabal +1/−1
CHANGELOG.md view
@@ -1,3 +1,7 @@+0.4.3++- Add support `spoiler` message type and `protect_content` field for various methods (see [#103](https://github.com/fizruk/telegram-bot-simple/pull/103));+ 0.4.2 ---
examples/EchoBot.hs view
@@ -62,7 +62,8 @@ (SendStickerRequest (SomeChatId chat) file - Nothing + Nothing+ Nothing Nothing Nothing Nothing))
examples/GameBot.hs view
@@ -95,7 +95,7 @@ AFeedback sourceChatId msgId -> model <# do let shouldNotify = Just True targetChatId = SomeChatId (ChatId (fromIntegral supportChatId))- fwdMsgRequest = ForwardMessageRequest targetChatId sourceChatId shouldNotify msgId+ fwdMsgRequest = ForwardMessageRequest targetChatId sourceChatId shouldNotify Nothing msgId _ <- liftClientM (forwardMessage fwdMsgRequest) return () @@ -125,6 +125,7 @@ { sendGameRequestChatId = coerce targetChatId , sendGameRequestGameShortName = gameId , sendGameRequestDisableNotification = Nothing+ , sendGameProtectContent = Nothing , sendGameRequestReplyToMessageId = Nothing , sendGameRequestAllowSendingWithoutReply = Nothing , sendGameRequestReplyMarkup = Nothing
src/Telegram/Bot/API/Games.hs view
@@ -25,6 +25,7 @@ { sendGameRequestChatId :: ChatId -- ^ Unique identifier for the target chat. , sendGameRequestGameShortName :: Text -- ^ Short name of the game, serves as the unique identifier for the game. Set up your games via Botfather. , sendGameRequestDisableNotification :: Maybe Bool -- ^ Sends the message silently. Users will receive a notification with no sound.+ , sendGameProtectContent :: Maybe Bool -- ^ Protects the contents of the sent message from forwarding and saving. , sendGameRequestReplyToMessageId :: Maybe MessageId -- ^ If the message is a reply, ID of the original message. , sendGameRequestAllowSendingWithoutReply :: Maybe Bool -- ^ Pass 'True', if the message should be sent even if the specified replied-to message is not found , sendGameRequestReplyMarkup :: Maybe InlineKeyboardMarkup -- ^ A JSON-serialized object for an inline keyboard. If empty, one 'Play game_title' button will be shown. If not empty, the first button must launch the game.
src/Telegram/Bot/API/Methods.hs view
@@ -107,6 +107,7 @@ , sendMessageEntities :: Maybe [MessageEntity] -- ^ A JSON-serialized list of special entities that appear in message text, which can be specified instead of /parse_mode/. , sendMessageDisableWebPagePreview :: Maybe Bool -- ^ Disables link previews for links in this message. , sendMessageDisableNotification :: Maybe Bool -- ^ Sends the message silently. Users will receive a notification with no sound.+ , sendMessageProtectContent :: Maybe Bool -- ^ Protects the contents of the sent message from forwarding and saving. , sendMessageReplyToMessageId :: Maybe MessageId -- ^ If the message is a reply, ID of the original message. , sendMessageAllowSendingWithoutReply :: Maybe Bool -- ^ Pass 'True', if the message should be sent even if the specified replied-to message is not found. , sendMessageReplyMarkup :: Maybe SomeReplyMarkup -- ^ Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user.@@ -118,9 +119,10 @@ -- | Request parameters for 'forwardMessage'. data ForwardMessageRequest = ForwardMessageRequest { forwardMessageChatId :: SomeChatId -- ^ Unique identifier for the target chat or username of the target channel (in the format @\@channelusername).- , forwardMessageFromChatId :: SomeChatId -- ^ Unique identifier for the chat where the original message was sent (or channel username in the format @\@channelusername)+ , forwardMessageFromChatId :: SomeChatId -- ^ Unique identifier for the chat where the original message was sent (or channel username in the format @\@channelusername). , forwardMessageDisableNotification :: Maybe Bool -- ^ Sends the message silently. Users will receive a notification with no sound.- , forwardMessageMessageId :: MessageId -- ^ Message identifier in the chat specified in from_chat_id+ , forwardMessageProtectContent :: Maybe Bool -- ^ Protects the contents of the sent message from forwarding and saving.+ , forwardMessageMessageId :: MessageId -- ^ Message identifier in the chat specified in from_chat_id. } deriving (Generic) instance ToJSON ForwardMessageRequest where toJSON = gtoJSON@@ -159,6 +161,7 @@ , sendDocumentCaptionEntities :: Maybe [MessageEntity] -- ^ A JSON-serialized list of special entities that appear in the caption, which can be specified instead of /parse_mode/. , sendDocumentDisableContentTypeDetection :: Maybe Bool -- ^ Disables automatic server-side content type detection for files uploaded using @multipart/form-data@. , sendDocumentDisableNotification :: Maybe Bool -- ^ Sends the message silently. Users will receive a notification with no sound.+ , sendDocumentProtectContent :: Maybe Bool -- ^ Protects the contents of the sent message from forwarding and saving. , sendDocumentReplyToMessageId :: Maybe MessageId -- ^ If the message is a reply, ID of the original message. , sendDocumentAllowSendingWithoutReply :: Maybe Bool -- ^ Pass 'True', if the message should be sent even if the specified replied-to message is not found. , sendDocumentReplyMarkup :: Maybe SomeReplyMarkup -- ^ Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user.@@ -217,6 +220,7 @@ , sendDocumentCaptionEntities = Nothing , sendDocumentDisableContentTypeDetection = Nothing , sendDocumentDisableNotification = Nothing+ , sendDocumentProtectContent = Nothing , sendDocumentReplyToMessageId = Nothing , sendDocumentAllowSendingWithoutReply = Nothing , sendDocumentReplyMarkup = Nothing@@ -266,6 +270,7 @@ , sendPhotoParseMode :: Maybe ParseMode -- ^ Mode for parsing entities in the Photo caption. , sendPhotoCaptionEntities :: Maybe [MessageEntity] -- ^ A JSON-serialized list of special entities that appear in the caption, which can be specified instead of /parse_mode/. , sendPhotoDisableNotification :: Maybe Bool -- ^ Sends the message silently. Users will receive a notification with no sound.+ , sendPhotoProtectContent :: Maybe Bool -- ^ Protects the contents of the sent message from forwarding and saving. , sendPhotoReplyToMessageId :: Maybe MessageId -- ^ If the message is a reply, ID of the original message. , sendPhotoAllowSendingWithoutReply :: Maybe Bool -- ^ Pass 'True', if the message should be sent even if the specified replied-to message is not found. , sendPhotoReplyMarkup :: Maybe SomeReplyMarkup -- ^ Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user.@@ -422,7 +427,7 @@ , sendVideoCaptionEntities :: Maybe [MessageEntity] -- ^ A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode , sendVideoSupportsStreaming :: Maybe Bool -- ^ Pass True, if the uploaded video is suitable for streaming , sendVideoDisableNotification :: Maybe Bool -- ^ Sends the message silently. Users will receive a notification with no sound.- , sendVideoProtectContent :: Maybe Bool -- ^ Protects the contents of the sent message from forwarding and saving+ , sendVideoProtectContent :: Maybe Bool -- ^ Protects the contents of the sent message from forwarding and saving. , sendVideoReplyToMessageId :: Maybe MessageId -- ^ If the message is a reply, ID of the original message , sendVideoAllowSendingWithoutReply :: Maybe Bool -- ^ Pass True, if the message should be sent even if the specified replied-to message is not found , sendVideoReplyMarkup :: Maybe InlineKeyboardMarkup -- ^ Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user.@@ -505,9 +510,9 @@ , sendAnimationParseMode :: Maybe Text -- ^ Mode for parsing entities in the animation caption. See formatting options for more details. , sendAnimationCaptionEntities :: Maybe [MessageEntity] -- ^ A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode , sendAnimationDisableNotification :: Maybe Bool -- ^ Sends the message silently. Users will receive a notification with no sound.- , sendAnimationProtectContent :: Maybe Bool -- ^ Protects the contents of the sent message from forwarding and saving- , sendAnimationReplyToMessageId :: Maybe MessageId -- ^ If the message is a reply, ID of the original message- , sendAnimationAllowSendingWithoutReply :: Maybe Bool -- ^ Pass True, if the message should be sent even if the specified replied-to message is not found+ , sendAnimationProtectContent :: Maybe Bool -- ^ Protects the contents of the sent message from forwarding and saving.+ , sendAnimationReplyToMessageId :: Maybe MessageId -- ^ If the message is a reply, ID of the original message.+ , sendAnimationAllowSendingWithoutReply :: Maybe Bool -- ^ Pass True, if the message should be sent even if the specified replied-to message is not found. , sendAnimationReplyMarkup :: Maybe InlineKeyboardMarkup -- ^ Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. } deriving Generic
src/Telegram/Bot/API/Stickers.hs view
@@ -36,12 +36,14 @@ -- | Type of uploaded sticker file. Static or animated. data StickerType = PngSticker -- ^ PNG image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px, and either width or height must be exactly 512px. Pass a file_id as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data.- | TgsSticker -- ^ TGS animation with the sticker, uploaded using multipart/form-data. See <https:\/\/core.telegram.org\/animated_stickers#technical-requirements> for technical requirements+ | TgsSticker -- ^ TGS animation with the sticker, uploaded using multipart/form-data. See <https:\/\/core.telegram.org\/animated_stickers#technical-requirements> for technical requirements.+ | WebmSticker -- ^ WEBM video with the sticker, uploaded using multipart/form-data. See <https:\/\/core.telegram.org\/stickers#video-sticker-requirements> for technical requirements. stickerLabel :: StickerType -> T.Text stickerLabel = \case PngSticker -> "png_sticker" TgsSticker -> "tgs_sticker"+ WebmSticker -> "webm_sticker" -- | Sticker file with static/animated label. data StickerFile = StickerFile {stickerFileSticker :: InputFile, stickerFileLabel :: StickerType}@@ -51,6 +53,7 @@ { sendStickerChatId :: SomeChatId -- ^ Unique identifier for the target chat or username of the target channel (in the format @channelusername) , sendStickerSticker :: InputFile -- ^ Sticker to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a .WEBP file from the Internet, or upload a new one using multipart/form-data. , sendStickerDisableNotification :: Maybe Bool -- ^ Sends the message silently. Users will receive a notification with no sound.+ , sendStickerProtectContent :: Maybe Bool -- ^ Protects the contents of the sent message from forwarding and saving. , sendStickerReplyToMessageId :: Maybe MessageId -- ^ If the message is a reply, ID of the original message , sendStickerAllowSendingWithoutReply :: Maybe Bool -- ^ Pass True, if the message should be sent even if the specified replied-to message is not found , sendStickerReplyMarkup :: Maybe InlineKeyboardMarkup -- ^ Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user.
src/Telegram/Bot/API/Types.hs view
@@ -221,6 +221,7 @@ | MessageEntityTextMention | MessageEntityCashtag -- ^ See <https://core.telegram.org/tdlib/docs/classtd_1_1td__api_1_1text_entity_type_cashtag.html>. | MessageEntityPhoneNumber -- ^ See <https://core.telegram.org/tdlib/docs/classtd_1_1td__api_1_1text_entity_type_phone_number.html>.+ | MessageEntitySpoiler deriving (Eq, Show, Generic) -- ** 'PhotoSize'@@ -779,7 +780,8 @@ , stickerFileUniqueId :: FileId -- ^ Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. , stickerWidth :: Int32 -- ^ Sticker width. , stickerHeight :: Int32 -- ^ Sticker height.- , stickerIsAnimated :: Bool -- ^ True, if the sticker is animated.+ , stickerIsAnimated :: Bool -- ^ 'True', if the sticker is animated.+ , stickerIsVideo :: Bool -- ^ 'True', if the sticker is a video sticker. , stickerThumb :: Maybe PhotoSize -- ^ Sticker thumbnail in the .WEBP or .JPG format. , stickerEmoji :: Maybe Text -- ^ Emoji associated with the sticker. , stickerSetName :: Maybe Text -- ^ Name of the sticker set to which the sticker belongs.@@ -794,7 +796,8 @@ data StickerSet = StickerSet { stickerSetName :: Text -- ^ Sticker set name. , stickerSetTitle :: Text -- ^ Sticker set title.- , stickerSetIsAnimated :: Bool -- ^ True, if the sticker set contains animated stickers.+ , stickerSetIsAnimated :: Bool -- ^ 'True', if the sticker set contains animated stickers.+ , stickerSetIsVideo :: Bool -- ^ 'True', if the sticker is a video sticker. , stickerSetContainsMasks :: Bool -- ^ True, if the sticker set contains masks. , stickerSetStickers :: [Sticker] -- ^ List of all set stickers. , stickerSetThumb :: Maybe PhotoSize -- ^ Sticker set thumbnail in the .WEBP or .TGS format.
src/Telegram/Bot/Simple/Reply.hs view
@@ -41,6 +41,7 @@ , replyMessageEntities :: Maybe [MessageEntity] -- ^ A JSON-serialized list of special entities that appear in message text, which can be specified instead of /parse_mode/. , replyMessageDisableWebPagePreview :: Maybe Bool -- ^ Disables link previews for links in this message. , replyMessageDisableNotification :: Maybe Bool -- ^ Sends the message silently. Users will receive a notification with no sound.+ , replyMessageProtectContent :: Maybe Bool -- ^ Protects the contents of the sent message from forwarding and saving. , replyMessageReplyToMessageId :: Maybe MessageId -- ^ If the message is a reply, ID of the original message. , replyMessageAllowSendingWithoutReply :: Maybe Bool -- ^ Pass 'True', if the message should be sent even if the specified replied-to message is not found. , replyMessageReplyMarkup :: Maybe SomeReplyMarkup -- ^ Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user.@@ -52,7 +53,7 @@ -- | Create a 'ReplyMessage' with just some 'Text' message. toReplyMessage :: Text -> ReplyMessage toReplyMessage text- = ReplyMessage text Nothing Nothing Nothing Nothing Nothing Nothing Nothing+ = ReplyMessage text Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing replyMessageToSendMessageRequest :: SomeChatId -> ReplyMessage -> SendMessageRequest replyMessageToSendMessageRequest someChatId ReplyMessage{..} = SendMessageRequest@@ -62,6 +63,7 @@ , sendMessageEntities = replyMessageEntities , sendMessageDisableWebPagePreview = replyMessageDisableWebPagePreview , sendMessageDisableNotification = replyMessageDisableNotification+ , sendMessageProtectContent = replyMessageProtectContent , sendMessageReplyToMessageId = replyMessageReplyToMessageId , sendMessageReplyMarkup = replyMessageReplyMarkup , sendMessageAllowSendingWithoutReply = replyMessageAllowSendingWithoutReply
telegram-bot-simple.cabal view
@@ -5,7 +5,7 @@ -- see: https://github.com/sol/hpack name: telegram-bot-simple-version: 0.4.2+version: 0.4.3 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