From adb2e064998dbb400711a15cc5b47ed259cd534f Mon Sep 17 00:00:00 2001 From: fetsh-edu Date: Sat, 27 May 2023 15:40:29 +0300 Subject: [PATCH 1/4] Omit Null values while adding Json Fields --- telegram-bot-api/src/Telegram/Bot/API/Internal/Utils.hs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/telegram-bot-api/src/Telegram/Bot/API/Internal/Utils.hs b/telegram-bot-api/src/Telegram/Bot/API/Internal/Utils.hs index 6d458ad..8ed7114 100644 --- a/telegram-bot-api/src/Telegram/Bot/API/Internal/Utils.hs +++ b/telegram-bot-api/src/Telegram/Bot/API/Internal/Utils.hs @@ -106,9 +106,13 @@ instance (GSomeJSON f, GSomeJSON g) => GSomeJSON (f :+: g) where <|> R1 <$> gsomeParseJSON js addJsonFields :: Value -> [Pair] -> Value -addJsonFields (Object obj) pairs = Object $ Map.union obj (Map.fromList pairs) +addJsonFields (Object obj) pairs = Object $ Map.union obj $ Map.fromList (filter (not . isNull) pairs) addJsonFields x _ = x +isNull :: Pair -> Bool +isNull (_, Null) = True +isNull _ = False + addMultipartFields :: [Input] -> MultipartData tag -> MultipartData tag addMultipartFields newFields (MultipartData currenFields files) = MultipartData (newFields <> currenFields) files From cd9e62e8dfa45ce8165505a8b705e189facdb78d Mon Sep 17 00:00:00 2001 From: fetsh-edu Date: Sat, 27 May 2023 15:41:01 +0300 Subject: [PATCH 2/4] Fix broken link in README --- telegram-bot-simple/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/telegram-bot-simple/README.md b/telegram-bot-simple/README.md index 68aecd7..d56e41d 100644 --- a/telegram-bot-simple/README.md +++ b/telegram-bot-simple/README.md @@ -13,7 +13,7 @@ The supplementary materials for the workshop is available at https://github.com/ ## Examples -See bot examples here: https://github.com/fizruk/telegram-bot-simple/tree/master/examples +See bot examples here: https://github.com/fizruk/telegram-bot-simple/tree/master/telegram-bot-simple/examples Use `cabal build all -fexamples` to build it. If you are building with stack then use `stack build --flag telegram-bot-simple:examples`. From 69bda1ce1c377375bf017610fa080f3ee705c955 Mon Sep 17 00:00:00 2001 From: fetsh-edu Date: Mon, 5 Jun 2023 19:34:01 +0300 Subject: [PATCH 3/4] Support Sender chat type for InlineQuery --- telegram-bot-api/src/Telegram/Bot/API/Types/Chat.hs | 1 + 1 file changed, 1 insertion(+) diff --git a/telegram-bot-api/src/Telegram/Bot/API/Types/Chat.hs b/telegram-bot-api/src/Telegram/Bot/API/Types/Chat.hs index d44c5f6..a82a0b4 100644 --- a/telegram-bot-api/src/Telegram/Bot/API/Types/Chat.hs +++ b/telegram-bot-api/src/Telegram/Bot/API/Types/Chat.hs @@ -57,6 +57,7 @@ data ChatType | ChatTypeGroup | ChatTypeSupergroup | ChatTypeChannel + | ChatTypeSender deriving (Generic, Show) instance ToJSON ChatType where From a74df3fd26b21160e436663b57e887b5c3a94147 Mon Sep 17 00:00:00 2001 From: fetsh-edu Date: Mon, 5 Jun 2023 20:04:08 +0300 Subject: [PATCH 4/4] Fix broken link in another README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3c7a7b5..58797f0 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ The supplementary materials for the workshop is available at https://github.com/ ## Examples -See bot examples here: https://github.com/fizruk/telegram-bot-simple/tree/master/examples +See bot examples here: https://github.com/fizruk/telegram-bot-simple/tree/master/telegram-bot-simple/examples Use `cabal build all -fexamples` to build it. If you are building with stack then use `stack build --flag telegram-bot-simple:examples`.