mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2025-06-28 20:29:53 +00:00
terminal: refactor chat core used in terminal app and in bot examples (#516)
* terminal: refactor chat core used in terminal app and in bot examples * fix tests * refactor
This commit is contained in:
parent
0ac9785e4b
commit
fa313caa82
10 changed files with 73 additions and 77 deletions
|
@ -5,6 +5,7 @@ module Main where
|
|||
import Simplex.Chat
|
||||
import Simplex.Chat.Bot
|
||||
import Simplex.Chat.Controller (versionNumber)
|
||||
import Simplex.Chat.Core
|
||||
import Simplex.Chat.Options
|
||||
import System.Directory (getAppUserDataDirectory)
|
||||
import Text.Read
|
||||
|
@ -12,7 +13,7 @@ import Text.Read
|
|||
main :: IO ()
|
||||
main = do
|
||||
opts <- welcomeGetOpts
|
||||
simplexChatBot defaultChatConfig opts $
|
||||
simplexChatCore defaultChatConfig opts Nothing $
|
||||
chatBotRepl "Hello! I am a simple squaring bot - if you send me a number, I will calculate its square" $ \msg ->
|
||||
case readMaybe msg :: Maybe Integer of
|
||||
Just n -> msg <> " * " <> msg <> " = " <> show (n * n)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue