summaryrefslogtreecommitdiff
path: root/Network/API/Telegram/Bot/Object/Update/Message/Keyboard.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Network/API/Telegram/Bot/Object/Update/Message/Keyboard.hs')
-rw-r--r--Network/API/Telegram/Bot/Object/Update/Message/Keyboard.hs20
1 files changed, 20 insertions, 0 deletions
diff --git a/Network/API/Telegram/Bot/Object/Update/Message/Keyboard.hs b/Network/API/Telegram/Bot/Object/Update/Message/Keyboard.hs
new file mode 100644
index 0000000..ef15bb8
--- /dev/null
+++ b/Network/API/Telegram/Bot/Object/Update/Message/Keyboard.hs
@@ -0,0 +1,20 @@
+module Network.API.Telegram.Bot.Object.Update.Message.Keyboard (Keyboard (..), module Exports) where
+
+import Network.API.Telegram.Bot.Object.Update.Message.Keyboard.Button as Exports
+
+import "aeson" Data.Aeson (FromJSON (parseJSON), ToJSON (toJSON), object, withObject, (.:), (.=))
+import "base" Data.Function (($))
+import "base" Data.Functor ((<$>))
+import "base" Text.Show (Show)
+
+import Network.API.Telegram.Bot.Object.Update.Message.Keyboard.Button (Button)
+
+data Keyboard = Inline [[Button]] deriving Show
+
+instance FromJSON Keyboard where
+ parseJSON = withObject "Inline" $ \v ->
+ Inline <$> v .: "inline_keyboard"
+
+instance ToJSON Keyboard where
+ toJSON (Inline buttons) = object
+ ["inline_keyboard" .= buttons]