@@ -18,6 +18,7 @@ import Entity
1818import Data.Proxy
1919import Property
2020import Data.Maybe
21+ import Data.Functor
2122
2223sayMessage :: Reaction Message T. Text
2324sayMessage =
@@ -96,6 +97,12 @@ data NoTrustReply = NoTrustReply
9697 , noTrustLinkReply :: T. Text
9798 } deriving (Eq )
9899
100+ updateNoTrustCommandReply :: T. Text -> NoTrustReply -> NoTrustReply
101+ updateNoTrustCommandReply value reply = reply {noTrustCommandReply = value}
102+
103+ updateNoTrustLinkReply :: T. Text -> NoTrustReply -> NoTrustReply
104+ updateNoTrustLinkReply value reply = reply {noTrustLinkReply = value}
105+
99106instance IsEntity NoTrustReply where
100107 nameOfEntity Proxy = " NoTrustReply"
101108 toProperties reply =
@@ -107,6 +114,23 @@ instance IsEntity NoTrustReply where
107114 NoTrustReply <$> extractProperty " command" properties <*>
108115 extractProperty " link" properties
109116
117+ setNoTrustLinkReplyCommand :: Reaction Message T. Text
118+ setNoTrustLinkReplyCommand =
119+ liftR
120+ (\ msg -> do
121+ reply <- noTrustReply
122+ void $ updateEntityById $ fmap (updateNoTrustLinkReply msg) reply) $
123+ cmapR (const " Updated not trust link reply message" ) $ Reaction replyMessage
124+
125+ setNoTrustCommandReplyCommand :: Reaction Message T. Text
126+ setNoTrustCommandReplyCommand =
127+ liftR
128+ (\ msg -> do
129+ reply <- noTrustReply
130+ void $ updateEntityById $ fmap (updateNoTrustCommandReply msg) reply) $
131+ cmapR (const " Updated not trust command reply message" ) $
132+ Reaction replyMessage
133+
110134noTrustReply :: Effect (Entity NoTrustReply )
111135noTrustReply = do
112136 reply <- listToMaybe <$> selectEntities Proxy (Take 1 $ All )
@@ -116,9 +140,11 @@ noTrustReply = do
116140 createEntity Proxy $
117141 NoTrustReply
118142 [qms |You have to be trusted to use this command.
119- Mods can change this message with !TODO|]
143+ Mods can change this message with
144+ !config reply command <message>|]
120145 [qms |You have to be trusted to send links.
121- Mods can change this message with !TODO|]
146+ Mods can change this message with
147+ !config reply link <message>|]
122148
123149noTrust :: Message a -> Effect ()
124150noTrust Message {messageSender = sender} = do
0 commit comments