irc-client-lwt

IRC client library - Lwt implementation
README

IRC client library, supporting Lwt and Unix blocking IO.



Build dependencies

The latest tagged version is available via opam: opam install irc-client

Usage

Simple bot which connects to a channel, sends a message, and then logs all
messages in that channel to stdout:

open Lwt
module C = Irc_client_lwt

let host = "localhost"
let port = 6667
let realname = "Demo IRC bot"
let nick = "demoirc"
let username = nick
let channel = "#demo_irc"
let message = "Hello, world!  This is a test from ocaml-irc-client"

let callback _connection result =
  let open Irc_message in
  match result with
  | Result.Ok msg ->
    Lwt_io.printf "Got message: %s\n" (to_string msg)
  | Result.Error e ->
    Lwt_io.printl e

let lwt_main =
  Lwt_unix.gethostbyname host
  >>= fun he -> C.connect ~addr:(he.Lwt_unix.h_addr_list.(0))
                  ~port ~username ~mode:0 ~realname ~nick ()
  >>= fun connection -> Lwt_io.printl "Connected"
  >>= fun () -> C.send_join ~connection ~channel
  >>= fun () -> C.send_privmsg ~connection ~target:channel ~message
  >>= fun () -> C.listen ~connection ~callback ()
  >>= fun () -> C.send_quit ~connection

let _ = Lwt_main.run lwt_main

Compile the above with:

ocamlfind ocamlopt -package irc-client.lwt -linkpkg code.ml

Alternatively, you can find it at examples/example1.ml; enable its compilation
with ./configure --enable-examples --enable-lwt.

Install
Published
24 Sep 2019
Sources
irc-client.0.6.2.tar.gz
md5=dd23fab61a244c530066e016b42d5197
Dependencies
ocaml
>= "4.02.0"
odoc
with-doc
lwt
>= "2.4.7"
irc-client
>= "0.4.0" & < "0.7.0"
dune
>= "1.6"
Reverse Dependencies
calculon
>= "0.3"