calculon

Library for writing IRC bots in OCaml and a collection of plugins
IN THIS PACKAGE
Module type Calculon . Core . S
module I : Irc_client.CLIENT with type 'a Io.t = 'a Lwt.t
type connection = I.connection_t
val connection : connection

Current connection.

val init : unit Lwt.t
val exit : unit Lwt.t
val log : string -> unit Lwt.t

Log a message (see field irc_log of Config.config), typically for debugging purpose.

  • since 0.5
val logf : ( 'a, Format.formatter, unit, unit Lwt.t ) format4 -> 'a

Pretty logger (calling log to print the formatted message). Example: logf "answer to %s is %d" "life" 42

  • since 0.5
val set_log : ( string -> unit Lwt.t ) -> unit

Set logger (default is the empty logger) that will be used by log

  • since 0.5
val send_exit : unit -> unit

trigger the exit signal (only at the end!)

val messages : irc_msg Signal.t

Signal triggered every time any IRC message is received

val privmsg : privmsg Signal.t

Signal triggered every time a privmsg is received

val line_cut_threshold : int ref

Above !line_cut_threshold, multi-line messages are cut with "..."

val send_privmsg_l : target:string -> messages:string list -> unit Lwt.t

Send a list of messages to the target. If the list is too long (see line_cut_threshold) only a prefix of the list will be sent

val send_privmsg_l_nolimit : ?delay:float -> target:string -> messages:string list -> unit -> unit Lwt.t

Version of send_privmsg_l that does not enforce cut threshold. Be careful of the flood this might cause.

  • parameter delay

    optional delay between each sent message

val send_privmsg : target:string -> message:string -> unit Lwt.t

Helper for sending messages, splitting lines, etc.

val send_notice_l : target:string -> messages:string list -> unit Lwt.t

Send a list of notices. Notices are not supposed to be parsed by other bots, so as to avoid reply loops

val send_notice : target:string -> message:string -> unit Lwt.t

Helper for sending notices, splitting lines, etc.

val send_join : channel:string -> unit Lwt.t

Send a "join" messages to try and join some channel

val send_part : channel:string -> unit Lwt.t

Send a "part" messages to try and part some channel

val talk : target:string -> Talk.t -> unit Lwt.t

Send a pre-formatted answer to the channel.