-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUpdate.hs
24 lines (21 loc) · 1.2 KB
/
Update.hs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
{-# LANGUAGE DeriveGeneric #-}
module Telegram.Update
( Json(..)
)
where
import Data.Aeson ( FromJSON
, parseJSON
, genericParseJSON
)
import Deserialization ( customParseOptions )
import GHC.Generics ( Generic )
import qualified Telegram.Message as Message
data Json = Json
{ _update_id :: Int -- Update identifiers start from a certain positive number and increase sequentially.
, _message :: Maybe Message.Json -- New incoming message of any kind — text, photo, sticker, etc.
, _edited_message :: Maybe Message.Json -- New version of a message that is known to the bot and was edited
, _channel_post :: Maybe Message.Json -- New incoming channel post of any kind — text, photo, sticker, etc.
, _edited_channel_post :: Maybe Message.Json -- New version of a channel post that is known to the bot and was edited
} deriving (Generic, Show)
instance FromJSON Json where
parseJSON = genericParseJSON customParseOptions