diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c91aaab..0704941 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,4 +28,4 @@ jobs: key: ${{ runner.os }}-v2-${{ matrix.ghc }}-${{ github.run_id }} restore-keys: ${{ runner.os }}-v2-${{ matrix.ghc }}- - run: | - cabal build all -fexamples + cabal build all -fexamples --ghc-options=-Werror diff --git a/telegram-bot-api/src/Telegram/Bot/API/Methods/SendDocument.hs b/telegram-bot-api/src/Telegram/Bot/API/Methods/SendDocument.hs index 68dfa21..1a7dae6 100644 --- a/telegram-bot-api/src/Telegram/Bot/API/Methods/SendDocument.hs +++ b/telegram-bot-api/src/Telegram/Bot/API/Methods/SendDocument.hs @@ -115,7 +115,9 @@ instance ToMultipart Tmp SendDocumentRequest where = (FileData "file" (T.pack $ takeFileName path) ct path) : maybe [] (\t -> [FileData "thumbnail" (T.pack $ takeFileName t) "image/jpeg" t]) sendDocumentThumbnail - DocumentFile path ct = sendDocumentDocument + (path, ct) = case sendDocumentDocument of + DocumentFile path' ct' -> (path', ct') + _ -> error "ToMultipart Tmp SendDocumentRequest: cannot use multipart for links or file ids" instance ToJSON SendDocumentRequest where toJSON = gtoJSON diff --git a/telegram-bot-api/src/Telegram/Bot/API/Methods/SendPhoto.hs b/telegram-bot-api/src/Telegram/Bot/API/Methods/SendPhoto.hs index 2b95bfc..2ee26e4 100644 --- a/telegram-bot-api/src/Telegram/Bot/API/Methods/SendPhoto.hs +++ b/telegram-bot-api/src/Telegram/Bot/API/Methods/SendPhoto.hs @@ -104,7 +104,9 @@ instance ToMultipart Tmp SendPhotoRequest where = (FileData "file" (T.pack $ takeFileName path) ct path) : maybe [] (\t -> [FileData "thumb" (T.pack $ takeFileName t) "image/jpeg" t]) sendPhotoThumb - PhotoFile path ct = sendPhotoPhoto + (path, ct) = case sendPhotoPhoto of + PhotoFile path' ct' -> (path', ct') + _ -> error "ToMultipart Tmp SendPhotoRequest: cannot use multipart for links or file ids" instance ToJSON SendPhotoRequest where toJSON = gtoJSON diff --git a/telegram-bot-simple/examples/EchoBot.hs b/telegram-bot-simple/examples/EchoBot.hs index 9af6fa3..d56147d 100644 --- a/telegram-bot-simple/examples/EchoBot.hs +++ b/telegram-bot-simple/examples/EchoBot.hs @@ -35,8 +35,8 @@ updateToAction update _ Just $ InlineEcho queryId msg | isJust $ updateMessageSticker update = do fileId <- stickerFileId <$> updateMessageSticker update - chatId <- updateChatId update - pure $ StickerEcho (InputFileId fileId) chatId + chatOfUser <- updateChatId update + pure $ StickerEcho (InputFileId fileId) chatOfUser | otherwise = case updateMessageText update of Just text -> Just (Echo text) Nothing -> Nothing diff --git a/telegram-bot-simple/examples/EchoBotWebhook.hs b/telegram-bot-simple/examples/EchoBotWebhook.hs index 9da4ad6..2d1f5a2 100644 --- a/telegram-bot-simple/examples/EchoBotWebhook.hs +++ b/telegram-bot-simple/examples/EchoBotWebhook.hs @@ -43,8 +43,8 @@ updateToAction update _ Just $ InlineEcho queryId msg | isJust $ updateMessageSticker update = do fileId <- stickerFileId <$> updateMessageSticker update - chatId <- updateChatId update - pure $ StickerEcho (InputFileId fileId) chatId + chatOfUser <- updateChatId update + pure $ StickerEcho (InputFileId fileId) chatOfUser | otherwise = case updateMessageText update of Just text -> Just (Echo text) Nothing -> Nothing diff --git a/telegram-bot-simple/examples/GameBot.hs b/telegram-bot-simple/examples/GameBot.hs index e79ac97..f6c0514 100644 --- a/telegram-bot-simple/examples/GameBot.hs +++ b/telegram-bot-simple/examples/GameBot.hs @@ -104,7 +104,11 @@ handleAction BotSettings{..} action model = case action of { inlineQueryResultTitle = Just msg , inlineQueryResultInputMessageContent = Just gameMsg } - gameMsg = (defaultInputTextMessageContent gameMessageText) { inputMessageContentParseMode = Just "HTML" } + gameMsg = InputTextMessageContent + { inputMessageContentMessageText = gameMessageText + , inputMessageContentParseMode = Just "HTML" + , inputMessageContentDisableWebPagePrefiew = Nothing + } inlineQueryResult = InlineQueryResultGame { inlineQueryResultGameGeneric = genericResult , inlineQueryResultGameGameShortName = gameName @@ -737,4 +741,3 @@ renderAgainLink settings txt = do H.div ! A.class_ "position-link" $ do H.div ! A.class_ "qel-button text-button text-again-button" $ toMarkup txt - diff --git a/telegram-bot-simple/src/Telegram/Bot/Simple/Reply.hs b/telegram-bot-simple/src/Telegram/Bot/Simple/Reply.hs index 0e3587c..cdacea3 100644 --- a/telegram-bot-simple/src/Telegram/Bot/Simple/Reply.hs +++ b/telegram-bot-simple/src/Telegram/Bot/Simple/Reply.hs @@ -61,6 +61,7 @@ replyMessageToSendMessageRequest :: SomeChatId -> ReplyMessage -> SendMessageReq replyMessageToSendMessageRequest someChatId ReplyMessage{..} = SendMessageRequest { sendMessageChatId = someChatId , sendMessageBusinessConnectionId = Nothing + , sendMessageMessageEffectId = Nothing , sendMessageMessageThreadId = replyMessageMessageThreadId , sendMessageText = replyMessageText , sendMessageParseMode = replyMessageParseMode