# Haskell Bots

These bots must be built as part of the `simplex-chat` cabal project.

## Setup

1. Clone simplex-chat (stable branch):
   ```bash
   git clone https://github.com/simplex-chat/simplex-chat.git
   cd simplex-chat
   git checkout stable
   ```

2. Copy bot directories into `apps/`:
   ```bash
   cp -r simplex-deadmans-bot simplex-chat/apps/
   cp -r simplexxx-directory  simplex-chat/apps/
   ```

3. Add the following executables to `simplex-chat.cabal`:

### simplex-deadmans-bot
```cabal
executable simplex-deadmans-bot
  main-is: Main.hs
  hs-source-dirs: apps/simplex-deadmans-bot
  build-depends:
    base, simplex-chat, simplexmq, text, stm, time, http-conduit
  default-language: Haskell2010
  ghc-options: -threaded
```

### simplexxx-directory
```cabal
executable simplexxx-directory
  main-is: Main.hs
  hs-source-dirs: apps/simplexxx-directory
  other-modules:
    Directory.BlockedWords, Directory.Captcha, Directory.Events,
    Directory.Listing, Directory.Options, Directory.Search,
    Directory.Service, Directory.Store, Directory.Store.Migrate,
    Directory.Store.Postgres.Migrations, Directory.Store.SQLite.Migrations,
    Directory.Util
  build-depends:
    -- same as simplex-directory-service in simplex-chat.cabal
  default-language: Haskell2010
  ghc-options: -threaded
```

4. On macOS, add to `cabal.project`:
   ```
   package *
       extra-lib-dirs: /opt/homebrew/opt/openssl@3/lib
       extra-include-dirs: /opt/homebrew/opt/openssl@3/include
   ```

5. Build:
   ```bash
   cabal update
   cabal build simplex-deadmans-bot simplexxx-directory
   ```
