Skip to content
This repository
tree: b077958233
Fetching contributors…

Cannot retrieve contributors at this time

file 47 lines (45 sloc) 1.416 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
module IBC = IrcBotCore

(**
* Connects a newly created bot to a server.
*
* @param irc The parameters of the bot.
* @param sched The scheduler to use during the connection.
* @param server The server to which the bot will connect.
* @param port The port on which to connect.
*)
let insert_bot (irc: IBC.irc) sched server port =
    let t = {
        IBC.runtime = {
            IBC.rt_proto = {
                IBC.rt_backtrace = true;
                rt_block_size = 4096;
                rt_payload = ();
                rt_server_write_timeout = Time.seconds 60
            }
        };
        err_cont = None;
        extra_params = irc
    } in
    IBC.connect t sched server port

(**
* Creates and runs a new bot.
*
* @param username The username of the bot.
* @param realname The realname of the bot.
* @param nickname The nickname of the bot.
* @param password The password to the server.
* @param server The server to which the bot will connect.
* @param port The port on which to connect.
*)
let create_bot username realname nickname password server channel port callback =
    let parameters = {
        IBC.username = username;
        realname = realname;
        nickname = nickname;
        password = password;
        server = server;
        channel = channel;
        callback = callback
    } in
    let sched = Scheduler.default in
    insert_bot parameters sched server port
Something went wrong with that request. Please try again.