Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/c-cube/irky
[wip] IRC client for OCaml
https://github.com/c-cube/irky
client irc ocaml openssl
Last synced: 8 days ago
JSON representation
[wip] IRC client for OCaml
- Host: GitHub
- URL: https://github.com/c-cube/irky
- Owner: c-cube
- License: mit
- Created: 2023-07-06T04:20:18.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-02-27T04:19:37.000Z (11 months ago)
- Last Synced: 2025-01-16T00:10:59.647Z (10 days ago)
- Topics: client, irc, ocaml, openssl
- Language: OCaml
- Homepage:
- Size: 332 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGES.md
- License: LICENSE
Awesome Lists containing this project
README
# Irky
A fork of [irc-client](https://github.com/johnelse/ocaml-irc-client) focused on
direct style IOs (unix and Eio).[![Build status](https://github.com/c-cube/irky/actions/workflows/workflow.yml/badge.svg)](https://github.com/c-cube/irky/actions)
## License
MIT
## Usage
Simple bot which connects to a channel, sends a message, and then logs all
messages in that channel to stdout:```ocaml
module C = Irky.Clientlet host = ref "irc.libera.chat"
let port = ref 6667
let nick = ref "irkytest"
let channel = ref "##demo_irc"let on_msg _client msg =
Printf.printf "Got message: %s\n%!" (Irky.Message.to_string msg)let() =
let io = Irky_unix.io in
C.reconnect_loop ~reconnect_delay:15. ~io
~connect:(fun () ->
C.connect_by_name ~server:!host ~port:!port ~nick:!nick ~io ())
~on_connect:(fun client ->
Printf.printf "Connected, sending join for %S\n%!" !channel;
C.send_join client ~channel:!channel;
C.send_privmsg client ~target:!channel ~message:"hello from irky!")
on_msg
```Compile the above with:
```
ocamlfind ocamlopt -package irky -package irky.unix -linkpkg code.ml
```Alternatively, you can find an extended version of this example in `examples/example.ml`;
run it using `dune exec -- examples/example.exe`.