mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-05-28 13:44:31 +00:00
core: pre- and post-start chat hooks for CLI-based bots (#6217)
This commit is contained in:
@@ -168,7 +168,13 @@ data RandomAgentServers = RandomAgentServers
|
||||
|
||||
-- The hooks can be used to extend or customize chat core in mobile or CLI clients.
|
||||
data ChatHooks = ChatHooks
|
||||
{ -- preCmdHook can be used to process or modify the commands before they are processed.
|
||||
{ -- preStartHook can be used to verify some data,
|
||||
-- It is called before chat controller is started, unless the core is started in maintenance mode.
|
||||
preStartHook :: Maybe (ChatController -> IO ()),
|
||||
-- postStartHook can be used to update some data after start (e.g. commands in bot or group profiles),
|
||||
-- It is called after chat controller is started.
|
||||
postStartHook :: Maybe (ChatController -> IO ()),
|
||||
-- preCmdHook can be used to process or modify the commands before they are processed.
|
||||
-- This hook should be used to process CustomChatCommand.
|
||||
-- if this hook returns ChatResponse, the command processing will be skipped.
|
||||
preCmdHook :: Maybe (ChatController -> ChatCommand -> IO (Either (Either ChatError ChatResponse) ChatCommand)),
|
||||
@@ -180,7 +186,7 @@ data ChatHooks = ChatHooks
|
||||
}
|
||||
|
||||
defaultChatHooks :: ChatHooks
|
||||
defaultChatHooks = ChatHooks Nothing Nothing Nothing
|
||||
defaultChatHooks = ChatHooks Nothing Nothing Nothing Nothing Nothing
|
||||
|
||||
data PresetServers = PresetServers
|
||||
{ operators :: NonEmpty PresetOperator,
|
||||
|
||||
Reference in New Issue
Block a user