Haskell bindings for the Euphoria API, successor to euph-api
Find a file
2020-01-22 15:05:59 +00:00
app Clean up 2020-01-06 18:07:02 +00:00
src/Haboli/Euphoria Update haddock 2020-01-22 15:05:59 +00:00
test Create project 2020-01-04 12:56:24 +00:00
.gitignore Create project 2020-01-04 12:56:24 +00:00
CHANGELOG.md Bump version to 0.3.0.0 2020-01-09 21:00:19 +00:00
LICENSE Fix some package details 2020-01-09 09:49:08 +00:00
package.yaml Bump version to 0.3.0.0 2020-01-09 21:00:19 +00:00
README.md Add more info to README 2020-01-22 14:25:22 +00:00
Setup.hs Create project 2020-01-04 12:56:24 +00:00
stack.yaml Create project 2020-01-04 12:56:24 +00:00
stack.yaml.lock Begin implementing the euphoria API 2020-01-06 00:16:22 +00:00

haboli

Haboli is a haskell library providing API bindings for the euphoria api. It can be used to create bots and otherwise interact with the euphoria servers.

Basic concept

This library is based around the custom Client monad. It is based on IO and represents computations that happen while a connection to an euphoria server is open. Once a Client finishes executing, the connection is automatically closed. If the connection closes unexpectedly while the corresponding Client is still running, it is notified and commands like send or nick will result in an exception. The Client does not automatically reconnect.

The Client monad supports exceptions via the throw, catch and handle operations, as well as multiple threads via the fork and wait operations. It supports all session and chat room commands listed in the api reference.

For more information, see the haddock for the Haboli.Euphoria.Client and Haboli.Euphoria.Api modules.

Example bot

Here is a very basic example bot that Replies to !ping with Pong!:

pingPongBot :: Client () ()
pingPongBot = forever $ do
  event <- respondingToPing nextEvent
  case event of
    EventSnapshot _ -> void $ nick "TreeBot"
    EventSend e ->
      let msg = sendMessage e
      in  when (msgContent msg == "!ping") $
            void $ reply msg "Pong!"
    _ -> pure ()

And here's how to run that bot:

main :: IO ()
main = void $ runClient defaultConfig pingPongBot