Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=ed339aaa57ffd628958b09e33605c7c90a8072cc0827dca34ef0b2344a576538
Description
Added to opam-repository:
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_mainCompile the above with:
ocamlfind ocamlopt -package irc-client.lwt -linkpkg code.mlAlternatively, you can find it at examples/example1.ml; enable its compilation with ./configure --enable-examples --enable-lwt.
Dependencies (6)
Dev Dependencies (1)
-
odoc
with-doc
Optional Dependencies
None
Used by
None
Conflicts
None
Build status
Results of building irc-client-tls with each compiler on check.ci.ocaml.org, run of against opam-repository 7cdc698. All results for this package.
Each result links to its build log. To keep crawlers from overloading the site, build logs require a GitHub sign-in (see ocurrent/opam-health-check). On your first log, GitHub asks you to “Authorize opam-health-check”, the OCurrent app that runs these checks; it sees only your public profile, not your repositories. The sign-in lasts 30 days.
| Version | OCaml 4.11 | OCaml 4.14 | OCaml 5.2 | OCaml 5.4 | OCaml 5.5 |
|---|---|---|---|---|---|
| 0.7.1 (this version) | good | good | good | good | good |
- good Package successfully built
- partial One of the dependencies failed to build
- bad Package failed to build
- n/a Package is not available in this environment
- internal Internal failure