{-# LANGUAGE TemplateHaskell #-}

-- | Updated messages
module Calamity.Types.Model.Channel.UpdatedMessage (
  UpdatedMessage (..),
) where

import Calamity.Internal.Utils
import Calamity.Types.Model.Channel
import Calamity.Types.Model.Guild.Role
import Calamity.Types.Model.User
import Calamity.Types.Snowflake
import Data.Aeson ((.:), (.:!), (.:?))
import Data.Aeson qualified as Aeson
import Data.Text (Text)
import Data.Time
import Data.Vector.Unboxing qualified as UV
import Data.Word
import Optics.TH
import TextShow qualified

data UpdatedMessage = UpdatedMessage
  { UpdatedMessage -> Snowflake Message
id :: Snowflake Message
  , UpdatedMessage -> Snowflake Channel
channelID :: Snowflake Channel
  , UpdatedMessage -> Maybe Text
content :: Maybe Text
  , UpdatedMessage -> Maybe (MaybeNull UTCTime)
editedTimestamp :: Maybe (MaybeNull UTCTime)
  , UpdatedMessage -> Maybe Bool
tts :: Maybe Bool
  , UpdatedMessage -> Maybe Bool
mentionEveryone :: Maybe Bool
  , UpdatedMessage -> Maybe [User]
mentions :: Maybe [User]
  , UpdatedMessage -> Maybe (Vector (Snowflake Role))
mentionRoles :: Maybe (UV.Vector (Snowflake Role))
  , UpdatedMessage -> Maybe [ChannelMention]
mentionChannels :: Maybe [ChannelMention]
  , UpdatedMessage -> Maybe [Attachment]
attachments :: Maybe [Attachment]
  , UpdatedMessage -> Maybe [Embed]
embeds :: Maybe [Embed]
  , UpdatedMessage -> Maybe [Reaction]
reactions :: Maybe [Reaction]
  , UpdatedMessage -> Maybe Bool
pinned :: Maybe Bool
  , UpdatedMessage -> Maybe MessageType
type_ :: Maybe MessageType
  , UpdatedMessage -> Maybe (MaybeNull Object)
activity :: Maybe (MaybeNull Aeson.Object)
  , UpdatedMessage -> Maybe (MaybeNull Object)
application :: Maybe (MaybeNull Aeson.Object)
  , UpdatedMessage -> Maybe (MaybeNull MessageReference)
messageReference :: Maybe (MaybeNull MessageReference)
  , UpdatedMessage -> Maybe Word64
flags :: Maybe Word64
  , UpdatedMessage -> Maybe (MaybeNull Message)
referencedMessage :: Maybe (MaybeNull Message)
  , UpdatedMessage -> Maybe (MaybeNull Object)
interaction :: Maybe (MaybeNull Aeson.Object)
  , UpdatedMessage -> Maybe [Component]
components :: Maybe [Component]
  }
  deriving (Int -> UpdatedMessage -> ShowS
[UpdatedMessage] -> ShowS
UpdatedMessage -> String
(Int -> UpdatedMessage -> ShowS)
-> (UpdatedMessage -> String)
-> ([UpdatedMessage] -> ShowS)
-> Show UpdatedMessage
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> UpdatedMessage -> ShowS
showsPrec :: Int -> UpdatedMessage -> ShowS
$cshow :: UpdatedMessage -> String
show :: UpdatedMessage -> String
$cshowList :: [UpdatedMessage] -> ShowS
showList :: [UpdatedMessage] -> ShowS
Show)
  deriving (Int -> UpdatedMessage -> Text
Int -> UpdatedMessage -> Builder
Int -> UpdatedMessage -> Text
[UpdatedMessage] -> Text
[UpdatedMessage] -> Builder
[UpdatedMessage] -> Text
UpdatedMessage -> Text
UpdatedMessage -> Builder
UpdatedMessage -> Text
(Int -> UpdatedMessage -> Builder)
-> (UpdatedMessage -> Builder)
-> ([UpdatedMessage] -> Builder)
-> (Int -> UpdatedMessage -> Text)
-> (UpdatedMessage -> Text)
-> ([UpdatedMessage] -> Text)
-> (Int -> UpdatedMessage -> Text)
-> (UpdatedMessage -> Text)
-> ([UpdatedMessage] -> Text)
-> TextShow UpdatedMessage
forall a.
(Int -> a -> Builder)
-> (a -> Builder)
-> ([a] -> Builder)
-> (Int -> a -> Text)
-> (a -> Text)
-> ([a] -> Text)
-> (Int -> a -> Text)
-> (a -> Text)
-> ([a] -> Text)
-> TextShow a
$cshowbPrec :: Int -> UpdatedMessage -> Builder
showbPrec :: Int -> UpdatedMessage -> Builder
$cshowb :: UpdatedMessage -> Builder
showb :: UpdatedMessage -> Builder
$cshowbList :: [UpdatedMessage] -> Builder
showbList :: [UpdatedMessage] -> Builder
$cshowtPrec :: Int -> UpdatedMessage -> Text
showtPrec :: Int -> UpdatedMessage -> Text
$cshowt :: UpdatedMessage -> Text
showt :: UpdatedMessage -> Text
$cshowtList :: [UpdatedMessage] -> Text
showtList :: [UpdatedMessage] -> Text
$cshowtlPrec :: Int -> UpdatedMessage -> Text
showtlPrec :: Int -> UpdatedMessage -> Text
$cshowtl :: UpdatedMessage -> Text
showtl :: UpdatedMessage -> Text
$cshowtlList :: [UpdatedMessage] -> Text
showtlList :: [UpdatedMessage] -> Text
TextShow.TextShow) via TextShow.FromStringShow UpdatedMessage
  deriving (HasID Message) via HasIDField "id" UpdatedMessage
  deriving (HasID Channel) via HasIDField "channelID" UpdatedMessage

instance Aeson.FromJSON UpdatedMessage where
  parseJSON :: Value -> Parser UpdatedMessage
parseJSON = String
-> (Object -> Parser UpdatedMessage)
-> Value
-> Parser UpdatedMessage
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Aeson.withObject String
"UpdatedMessage" ((Object -> Parser UpdatedMessage)
 -> Value -> Parser UpdatedMessage)
-> (Object -> Parser UpdatedMessage)
-> Value
-> Parser UpdatedMessage
forall a b. (a -> b) -> a -> b
$ \Object
v ->
    Snowflake Message
-> Snowflake Channel
-> Maybe Text
-> Maybe (MaybeNull UTCTime)
-> Maybe Bool
-> Maybe Bool
-> Maybe [User]
-> Maybe (Vector (Snowflake Role))
-> Maybe [ChannelMention]
-> Maybe [Attachment]
-> Maybe [Embed]
-> Maybe [Reaction]
-> Maybe Bool
-> Maybe MessageType
-> Maybe (MaybeNull Object)
-> Maybe (MaybeNull Object)
-> Maybe (MaybeNull MessageReference)
-> Maybe Word64
-> Maybe (MaybeNull Message)
-> Maybe (MaybeNull Object)
-> Maybe [Component]
-> UpdatedMessage
UpdatedMessage
      (Snowflake Message
 -> Snowflake Channel
 -> Maybe Text
 -> Maybe (MaybeNull UTCTime)
 -> Maybe Bool
 -> Maybe Bool
 -> Maybe [User]
 -> Maybe (Vector (Snowflake Role))
 -> Maybe [ChannelMention]
 -> Maybe [Attachment]
 -> Maybe [Embed]
 -> Maybe [Reaction]
 -> Maybe Bool
 -> Maybe MessageType
 -> Maybe (MaybeNull Object)
 -> Maybe (MaybeNull Object)
 -> Maybe (MaybeNull MessageReference)
 -> Maybe Word64
 -> Maybe (MaybeNull Message)
 -> Maybe (MaybeNull Object)
 -> Maybe [Component]
 -> UpdatedMessage)
-> Parser (Snowflake Message)
-> Parser
     (Snowflake Channel
      -> Maybe Text
      -> Maybe (MaybeNull UTCTime)
      -> Maybe Bool
      -> Maybe Bool
      -> Maybe [User]
      -> Maybe (Vector (Snowflake Role))
      -> Maybe [ChannelMention]
      -> Maybe [Attachment]
      -> Maybe [Embed]
      -> Maybe [Reaction]
      -> Maybe Bool
      -> Maybe MessageType
      -> Maybe (MaybeNull Object)
      -> Maybe (MaybeNull Object)
      -> Maybe (MaybeNull MessageReference)
      -> Maybe Word64
      -> Maybe (MaybeNull Message)
      -> Maybe (MaybeNull Object)
      -> Maybe [Component]
      -> UpdatedMessage)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
v Object -> Key -> Parser (Snowflake Message)
forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"id"
      Parser
  (Snowflake Channel
   -> Maybe Text
   -> Maybe (MaybeNull UTCTime)
   -> Maybe Bool
   -> Maybe Bool
   -> Maybe [User]
   -> Maybe (Vector (Snowflake Role))
   -> Maybe [ChannelMention]
   -> Maybe [Attachment]
   -> Maybe [Embed]
   -> Maybe [Reaction]
   -> Maybe Bool
   -> Maybe MessageType
   -> Maybe (MaybeNull Object)
   -> Maybe (MaybeNull Object)
   -> Maybe (MaybeNull MessageReference)
   -> Maybe Word64
   -> Maybe (MaybeNull Message)
   -> Maybe (MaybeNull Object)
   -> Maybe [Component]
   -> UpdatedMessage)
-> Parser (Snowflake Channel)
-> Parser
     (Maybe Text
      -> Maybe (MaybeNull UTCTime)
      -> Maybe Bool
      -> Maybe Bool
      -> Maybe [User]
      -> Maybe (Vector (Snowflake Role))
      -> Maybe [ChannelMention]
      -> Maybe [Attachment]
      -> Maybe [Embed]
      -> Maybe [Reaction]
      -> Maybe Bool
      -> Maybe MessageType
      -> Maybe (MaybeNull Object)
      -> Maybe (MaybeNull Object)
      -> Maybe (MaybeNull MessageReference)
      -> Maybe Word64
      -> Maybe (MaybeNull Message)
      -> Maybe (MaybeNull Object)
      -> Maybe [Component]
      -> UpdatedMessage)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
v Object -> Key -> Parser (Snowflake Channel)
forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"channel_id"
      Parser
  (Maybe Text
   -> Maybe (MaybeNull UTCTime)
   -> Maybe Bool
   -> Maybe Bool
   -> Maybe [User]
   -> Maybe (Vector (Snowflake Role))
   -> Maybe [ChannelMention]
   -> Maybe [Attachment]
   -> Maybe [Embed]
   -> Maybe [Reaction]
   -> Maybe Bool
   -> Maybe MessageType
   -> Maybe (MaybeNull Object)
   -> Maybe (MaybeNull Object)
   -> Maybe (MaybeNull MessageReference)
   -> Maybe Word64
   -> Maybe (MaybeNull Message)
   -> Maybe (MaybeNull Object)
   -> Maybe [Component]
   -> UpdatedMessage)
-> Parser (Maybe Text)
-> Parser
     (Maybe (MaybeNull UTCTime)
      -> Maybe Bool
      -> Maybe Bool
      -> Maybe [User]
      -> Maybe (Vector (Snowflake Role))
      -> Maybe [ChannelMention]
      -> Maybe [Attachment]
      -> Maybe [Embed]
      -> Maybe [Reaction]
      -> Maybe Bool
      -> Maybe MessageType
      -> Maybe (MaybeNull Object)
      -> Maybe (MaybeNull Object)
      -> Maybe (MaybeNull MessageReference)
      -> Maybe Word64
      -> Maybe (MaybeNull Message)
      -> Maybe (MaybeNull Object)
      -> Maybe [Component]
      -> UpdatedMessage)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
v Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"content"
      Parser
  (Maybe (MaybeNull UTCTime)
   -> Maybe Bool
   -> Maybe Bool
   -> Maybe [User]
   -> Maybe (Vector (Snowflake Role))
   -> Maybe [ChannelMention]
   -> Maybe [Attachment]
   -> Maybe [Embed]
   -> Maybe [Reaction]
   -> Maybe Bool
   -> Maybe MessageType
   -> Maybe (MaybeNull Object)
   -> Maybe (MaybeNull Object)
   -> Maybe (MaybeNull MessageReference)
   -> Maybe Word64
   -> Maybe (MaybeNull Message)
   -> Maybe (MaybeNull Object)
   -> Maybe [Component]
   -> UpdatedMessage)
-> Parser (Maybe (MaybeNull UTCTime))
-> Parser
     (Maybe Bool
      -> Maybe Bool
      -> Maybe [User]
      -> Maybe (Vector (Snowflake Role))
      -> Maybe [ChannelMention]
      -> Maybe [Attachment]
      -> Maybe [Embed]
      -> Maybe [Reaction]
      -> Maybe Bool
      -> Maybe MessageType
      -> Maybe (MaybeNull Object)
      -> Maybe (MaybeNull Object)
      -> Maybe (MaybeNull MessageReference)
      -> Maybe Word64
      -> Maybe (MaybeNull Message)
      -> Maybe (MaybeNull Object)
      -> Maybe [Component]
      -> UpdatedMessage)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
v Object -> Key -> Parser (Maybe (MaybeNull UTCTime))
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:! Key
"edited_timestamp"
      Parser
  (Maybe Bool
   -> Maybe Bool
   -> Maybe [User]
   -> Maybe (Vector (Snowflake Role))
   -> Maybe [ChannelMention]
   -> Maybe [Attachment]
   -> Maybe [Embed]
   -> Maybe [Reaction]
   -> Maybe Bool
   -> Maybe MessageType
   -> Maybe (MaybeNull Object)
   -> Maybe (MaybeNull Object)
   -> Maybe (MaybeNull MessageReference)
   -> Maybe Word64
   -> Maybe (MaybeNull Message)
   -> Maybe (MaybeNull Object)
   -> Maybe [Component]
   -> UpdatedMessage)
-> Parser (Maybe Bool)
-> Parser
     (Maybe Bool
      -> Maybe [User]
      -> Maybe (Vector (Snowflake Role))
      -> Maybe [ChannelMention]
      -> Maybe [Attachment]
      -> Maybe [Embed]
      -> Maybe [Reaction]
      -> Maybe Bool
      -> Maybe MessageType
      -> Maybe (MaybeNull Object)
      -> Maybe (MaybeNull Object)
      -> Maybe (MaybeNull MessageReference)
      -> Maybe Word64
      -> Maybe (MaybeNull Message)
      -> Maybe (MaybeNull Object)
      -> Maybe [Component]
      -> UpdatedMessage)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
v Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"tts"
      Parser
  (Maybe Bool
   -> Maybe [User]
   -> Maybe (Vector (Snowflake Role))
   -> Maybe [ChannelMention]
   -> Maybe [Attachment]
   -> Maybe [Embed]
   -> Maybe [Reaction]
   -> Maybe Bool
   -> Maybe MessageType
   -> Maybe (MaybeNull Object)
   -> Maybe (MaybeNull Object)
   -> Maybe (MaybeNull MessageReference)
   -> Maybe Word64
   -> Maybe (MaybeNull Message)
   -> Maybe (MaybeNull Object)
   -> Maybe [Component]
   -> UpdatedMessage)
-> Parser (Maybe Bool)
-> Parser
     (Maybe [User]
      -> Maybe (Vector (Snowflake Role))
      -> Maybe [ChannelMention]
      -> Maybe [Attachment]
      -> Maybe [Embed]
      -> Maybe [Reaction]
      -> Maybe Bool
      -> Maybe MessageType
      -> Maybe (MaybeNull Object)
      -> Maybe (MaybeNull Object)
      -> Maybe (MaybeNull MessageReference)
      -> Maybe Word64
      -> Maybe (MaybeNull Message)
      -> Maybe (MaybeNull Object)
      -> Maybe [Component]
      -> UpdatedMessage)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
v Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"mention_everyone"
      Parser
  (Maybe [User]
   -> Maybe (Vector (Snowflake Role))
   -> Maybe [ChannelMention]
   -> Maybe [Attachment]
   -> Maybe [Embed]
   -> Maybe [Reaction]
   -> Maybe Bool
   -> Maybe MessageType
   -> Maybe (MaybeNull Object)
   -> Maybe (MaybeNull Object)
   -> Maybe (MaybeNull MessageReference)
   -> Maybe Word64
   -> Maybe (MaybeNull Message)
   -> Maybe (MaybeNull Object)
   -> Maybe [Component]
   -> UpdatedMessage)
-> Parser (Maybe [User])
-> Parser
     (Maybe (Vector (Snowflake Role))
      -> Maybe [ChannelMention]
      -> Maybe [Attachment]
      -> Maybe [Embed]
      -> Maybe [Reaction]
      -> Maybe Bool
      -> Maybe MessageType
      -> Maybe (MaybeNull Object)
      -> Maybe (MaybeNull Object)
      -> Maybe (MaybeNull MessageReference)
      -> Maybe Word64
      -> Maybe (MaybeNull Message)
      -> Maybe (MaybeNull Object)
      -> Maybe [Component]
      -> UpdatedMessage)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
v Object -> Key -> Parser (Maybe [User])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"mentions"
      Parser
  (Maybe (Vector (Snowflake Role))
   -> Maybe [ChannelMention]
   -> Maybe [Attachment]
   -> Maybe [Embed]
   -> Maybe [Reaction]
   -> Maybe Bool
   -> Maybe MessageType
   -> Maybe (MaybeNull Object)
   -> Maybe (MaybeNull Object)
   -> Maybe (MaybeNull MessageReference)
   -> Maybe Word64
   -> Maybe (MaybeNull Message)
   -> Maybe (MaybeNull Object)
   -> Maybe [Component]
   -> UpdatedMessage)
-> Parser (Maybe (Vector (Snowflake Role)))
-> Parser
     (Maybe [ChannelMention]
      -> Maybe [Attachment]
      -> Maybe [Embed]
      -> Maybe [Reaction]
      -> Maybe Bool
      -> Maybe MessageType
      -> Maybe (MaybeNull Object)
      -> Maybe (MaybeNull Object)
      -> Maybe (MaybeNull MessageReference)
      -> Maybe Word64
      -> Maybe (MaybeNull Message)
      -> Maybe (MaybeNull Object)
      -> Maybe [Component]
      -> UpdatedMessage)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> ((AesonVector (Snowflake Role) -> Vector (Snowflake Role))
-> Maybe (AesonVector (Snowflake Role))
-> Maybe (Vector (Snowflake Role))
forall a b. (a -> b) -> Maybe a -> Maybe b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap AesonVector (Snowflake Role) -> Vector (Snowflake Role)
forall a. AesonVector a -> Vector a
unAesonVector (Maybe (AesonVector (Snowflake Role))
 -> Maybe (Vector (Snowflake Role)))
-> Parser (Maybe (AesonVector (Snowflake Role)))
-> Parser (Maybe (Vector (Snowflake Role)))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
v Object -> Key -> Parser (Maybe (AesonVector (Snowflake Role)))
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"mention_roles")
      Parser
  (Maybe [ChannelMention]
   -> Maybe [Attachment]
   -> Maybe [Embed]
   -> Maybe [Reaction]
   -> Maybe Bool
   -> Maybe MessageType
   -> Maybe (MaybeNull Object)
   -> Maybe (MaybeNull Object)
   -> Maybe (MaybeNull MessageReference)
   -> Maybe Word64
   -> Maybe (MaybeNull Message)
   -> Maybe (MaybeNull Object)
   -> Maybe [Component]
   -> UpdatedMessage)
-> Parser (Maybe [ChannelMention])
-> Parser
     (Maybe [Attachment]
      -> Maybe [Embed]
      -> Maybe [Reaction]
      -> Maybe Bool
      -> Maybe MessageType
      -> Maybe (MaybeNull Object)
      -> Maybe (MaybeNull Object)
      -> Maybe (MaybeNull MessageReference)
      -> Maybe Word64
      -> Maybe (MaybeNull Message)
      -> Maybe (MaybeNull Object)
      -> Maybe [Component]
      -> UpdatedMessage)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
v Object -> Key -> Parser (Maybe [ChannelMention])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"mention_channels"
      Parser
  (Maybe [Attachment]
   -> Maybe [Embed]
   -> Maybe [Reaction]
   -> Maybe Bool
   -> Maybe MessageType
   -> Maybe (MaybeNull Object)
   -> Maybe (MaybeNull Object)
   -> Maybe (MaybeNull MessageReference)
   -> Maybe Word64
   -> Maybe (MaybeNull Message)
   -> Maybe (MaybeNull Object)
   -> Maybe [Component]
   -> UpdatedMessage)
-> Parser (Maybe [Attachment])
-> Parser
     (Maybe [Embed]
      -> Maybe [Reaction]
      -> Maybe Bool
      -> Maybe MessageType
      -> Maybe (MaybeNull Object)
      -> Maybe (MaybeNull Object)
      -> Maybe (MaybeNull MessageReference)
      -> Maybe Word64
      -> Maybe (MaybeNull Message)
      -> Maybe (MaybeNull Object)
      -> Maybe [Component]
      -> UpdatedMessage)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
v Object -> Key -> Parser (Maybe [Attachment])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"attachments"
      Parser
  (Maybe [Embed]
   -> Maybe [Reaction]
   -> Maybe Bool
   -> Maybe MessageType
   -> Maybe (MaybeNull Object)
   -> Maybe (MaybeNull Object)
   -> Maybe (MaybeNull MessageReference)
   -> Maybe Word64
   -> Maybe (MaybeNull Message)
   -> Maybe (MaybeNull Object)
   -> Maybe [Component]
   -> UpdatedMessage)
-> Parser (Maybe [Embed])
-> Parser
     (Maybe [Reaction]
      -> Maybe Bool
      -> Maybe MessageType
      -> Maybe (MaybeNull Object)
      -> Maybe (MaybeNull Object)
      -> Maybe (MaybeNull MessageReference)
      -> Maybe Word64
      -> Maybe (MaybeNull Message)
      -> Maybe (MaybeNull Object)
      -> Maybe [Component]
      -> UpdatedMessage)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
v Object -> Key -> Parser (Maybe [Embed])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"embeds"
      Parser
  (Maybe [Reaction]
   -> Maybe Bool
   -> Maybe MessageType
   -> Maybe (MaybeNull Object)
   -> Maybe (MaybeNull Object)
   -> Maybe (MaybeNull MessageReference)
   -> Maybe Word64
   -> Maybe (MaybeNull Message)
   -> Maybe (MaybeNull Object)
   -> Maybe [Component]
   -> UpdatedMessage)
-> Parser (Maybe [Reaction])
-> Parser
     (Maybe Bool
      -> Maybe MessageType
      -> Maybe (MaybeNull Object)
      -> Maybe (MaybeNull Object)
      -> Maybe (MaybeNull MessageReference)
      -> Maybe Word64
      -> Maybe (MaybeNull Message)
      -> Maybe (MaybeNull Object)
      -> Maybe [Component]
      -> UpdatedMessage)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
v Object -> Key -> Parser (Maybe [Reaction])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"reactions"
      Parser
  (Maybe Bool
   -> Maybe MessageType
   -> Maybe (MaybeNull Object)
   -> Maybe (MaybeNull Object)
   -> Maybe (MaybeNull MessageReference)
   -> Maybe Word64
   -> Maybe (MaybeNull Message)
   -> Maybe (MaybeNull Object)
   -> Maybe [Component]
   -> UpdatedMessage)
-> Parser (Maybe Bool)
-> Parser
     (Maybe MessageType
      -> Maybe (MaybeNull Object)
      -> Maybe (MaybeNull Object)
      -> Maybe (MaybeNull MessageReference)
      -> Maybe Word64
      -> Maybe (MaybeNull Message)
      -> Maybe (MaybeNull Object)
      -> Maybe [Component]
      -> UpdatedMessage)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
v Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"pinned"
      Parser
  (Maybe MessageType
   -> Maybe (MaybeNull Object)
   -> Maybe (MaybeNull Object)
   -> Maybe (MaybeNull MessageReference)
   -> Maybe Word64
   -> Maybe (MaybeNull Message)
   -> Maybe (MaybeNull Object)
   -> Maybe [Component]
   -> UpdatedMessage)
-> Parser (Maybe MessageType)
-> Parser
     (Maybe (MaybeNull Object)
      -> Maybe (MaybeNull Object)
      -> Maybe (MaybeNull MessageReference)
      -> Maybe Word64
      -> Maybe (MaybeNull Message)
      -> Maybe (MaybeNull Object)
      -> Maybe [Component]
      -> UpdatedMessage)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
v Object -> Key -> Parser (Maybe MessageType)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"type"
      Parser
  (Maybe (MaybeNull Object)
   -> Maybe (MaybeNull Object)
   -> Maybe (MaybeNull MessageReference)
   -> Maybe Word64
   -> Maybe (MaybeNull Message)
   -> Maybe (MaybeNull Object)
   -> Maybe [Component]
   -> UpdatedMessage)
-> Parser (Maybe (MaybeNull Object))
-> Parser
     (Maybe (MaybeNull Object)
      -> Maybe (MaybeNull MessageReference)
      -> Maybe Word64
      -> Maybe (MaybeNull Message)
      -> Maybe (MaybeNull Object)
      -> Maybe [Component]
      -> UpdatedMessage)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
v Object -> Key -> Parser (Maybe (MaybeNull Object))
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:! Key
"activity"
      Parser
  (Maybe (MaybeNull Object)
   -> Maybe (MaybeNull MessageReference)
   -> Maybe Word64
   -> Maybe (MaybeNull Message)
   -> Maybe (MaybeNull Object)
   -> Maybe [Component]
   -> UpdatedMessage)
-> Parser (Maybe (MaybeNull Object))
-> Parser
     (Maybe (MaybeNull MessageReference)
      -> Maybe Word64
      -> Maybe (MaybeNull Message)
      -> Maybe (MaybeNull Object)
      -> Maybe [Component]
      -> UpdatedMessage)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
v Object -> Key -> Parser (Maybe (MaybeNull Object))
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:! Key
"application"
      Parser
  (Maybe (MaybeNull MessageReference)
   -> Maybe Word64
   -> Maybe (MaybeNull Message)
   -> Maybe (MaybeNull Object)
   -> Maybe [Component]
   -> UpdatedMessage)
-> Parser (Maybe (MaybeNull MessageReference))
-> Parser
     (Maybe Word64
      -> Maybe (MaybeNull Message)
      -> Maybe (MaybeNull Object)
      -> Maybe [Component]
      -> UpdatedMessage)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
v Object -> Key -> Parser (Maybe (MaybeNull MessageReference))
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:! Key
"message_reference"
      Parser
  (Maybe Word64
   -> Maybe (MaybeNull Message)
   -> Maybe (MaybeNull Object)
   -> Maybe [Component]
   -> UpdatedMessage)
-> Parser (Maybe Word64)
-> Parser
     (Maybe (MaybeNull Message)
      -> Maybe (MaybeNull Object) -> Maybe [Component] -> UpdatedMessage)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
v Object -> Key -> Parser (Maybe Word64)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"flags"
      Parser
  (Maybe (MaybeNull Message)
   -> Maybe (MaybeNull Object) -> Maybe [Component] -> UpdatedMessage)
-> Parser (Maybe (MaybeNull Message))
-> Parser
     (Maybe (MaybeNull Object) -> Maybe [Component] -> UpdatedMessage)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
v Object -> Key -> Parser (Maybe (MaybeNull Message))
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:! Key
"referenced_message"
      Parser
  (Maybe (MaybeNull Object) -> Maybe [Component] -> UpdatedMessage)
-> Parser (Maybe (MaybeNull Object))
-> Parser (Maybe [Component] -> UpdatedMessage)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
v Object -> Key -> Parser (Maybe (MaybeNull Object))
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:! Key
"interaction"
      Parser (Maybe [Component] -> UpdatedMessage)
-> Parser (Maybe [Component]) -> Parser UpdatedMessage
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
v Object -> Key -> Parser (Maybe [Component])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"components"

$(makeFieldLabelsNoPrefix ''UpdatedMessage)