All Projects → c-cube → calculon

c-cube / calculon

Licence: MIT License
Library for writing IRC bots in OCaml, a collection of plugins, and a dramatic robotic actor.

Programming Languages

ocaml
1615 projects

Projects that are alternatives of or similar to calculon

Limnoria
A robust, full-featured, and user/programmer-friendly Python IRC bot, with many existing plugins. Successor of the well-known Supybot.
Stars: ✭ 578 (+2123.08%)
Mutual labels:  irc, irc-bot
Cardinal
A Python IRC bot, designed to make adding functionality quick and simple.
Stars: ✭ 92 (+253.85%)
Mutual labels:  irc, irc-bot
TwitchPy
This is a package you can use to connect with the Twitch API, manage a channel, create bots, etc
Stars: ✭ 22 (-15.38%)
Mutual labels:  irc, irc-bot
CloudBot
CloudBot - The simple, fast, expandable, open-source Python IRC Bot!
Stars: ✭ 69 (+165.38%)
Mutual labels:  irc, irc-bot
teleirc
Go implementation of a Telegram <=> IRC bridge for use with any IRC channel and Telegram group
Stars: ✭ 112 (+330.77%)
Mutual labels:  irc, irc-bot
phenny
My fork of phenny lives on at https://github.com/vtluug/phenny. This tree is now unmaintained.
Stars: ✭ 15 (-42.31%)
Mutual labels:  irc, irc-bot
eggdrop-docker
No description or website provided.
Stars: ✭ 20 (-23.08%)
Mutual labels:  irc, irc-bot
insobot
C99 modular IRC bot with markov chains
Stars: ✭ 71 (+173.08%)
Mutual labels:  irc, irc-bot
energymech
EnergyMech IRC Bot
Stars: ✭ 24 (-7.69%)
Mutual labels:  irc, irc-bot
CloudBot
CloudBot - The simple, fast, expandable, open-source Python IRC Bot!
Stars: ✭ 57 (+119.23%)
Mutual labels:  irc, irc-bot
HackServ
Python 3 IRC Bot / Botnet
Stars: ✭ 28 (+7.69%)
Mutual labels:  irc, irc-bot
bmotion
An Artificial Stupidity script for eggdrop bots
Stars: ✭ 58 (+123.08%)
Mutual labels:  irc, irc-bot
irc-bot
A simple and modular PHP IRC bot
Stars: ✭ 82 (+215.38%)
Mutual labels:  irc, irc-bot
lita-irc
An IRC adapter for Lita.
Stars: ✭ 19 (-26.92%)
Mutual labels:  irc, irc-bot
honeybot
🛩 A python IRC bot with simple plugins dev. Ignited in mauritius, first-timers friendly! Moved to github.com/pyhoneybot/honeybot
Stars: ✭ 57 (+119.23%)
Mutual labels:  irc, irc-bot
irc.dart
Dart IRC Library
Stars: ✭ 45 (+73.08%)
Mutual labels:  irc, irc-bot
yesbot
IRC Bot Written in Prolog
Stars: ✭ 19 (-26.92%)
Mutual labels:  irc, irc-bot
bancho.js
Interface with Bancho over IRC, made easy and reliable.
Stars: ✭ 47 (+80.77%)
Mutual labels:  irc
IceChat
IceChat IRC Client
Stars: ✭ 68 (+161.54%)
Mutual labels:  irc
irc-go
Libraries to help with IRC development in Go.
Stars: ✭ 22 (-15.38%)
Mutual labels:  irc

Calculon Build Status

Library for writing IRC bots in OCaml, a collection of plugins, and a dramatic robotic actor. The core library is called calculon.

calculon logo

Build

make build

Introduction to the Code

Let's assume calculon is loaded, via:

# #require "calculon";;

Main

The typical main entry point would look like this. Calculon works by gathering a list of plugins (see the module Plugin), some configuration (see Config) and running the package in a loop using irc-client.

module C = Calculon

let plugins : C.Plugin.t list = [
  C.Plugin_social.plugin;
  C.Plugin_factoids.plugin;
  (* etc. *)
]

let () =
  let conf = C.Config.of_argv () in
  C.Run_main.main conf plugins |> Lwt_main.run

Plugins

A plugin contains a set of commands. A command is is a rule that matches a IRC message with some regex, and decides whether or not to fire with a reply. They are defined in the module Command.

For instance, the following module will reply to messages starting with !hello by replying "hello <sender>". This is a simple command, as the function Command.make_simple indicates: it returns a string option to indicate whether or not to respond to any line starting with !prefix. More elaborate commands are possible using Command.make.

open Calculon

let cmd_hello : Command.t =
  Command.make_simple ~descr:"hello world" ~cmd:"hello" ~prio:10
    (fun (input_msg:Core.privmsg) _ ->
       let who = input_msg.Core.nick in
       Lwt.return (Some ("hello " ^ who))
    )

let plugin_hello : Plugin.t = Plugin.of_cmd cmd_hello

Basic plugins are stateless, built from one or more commands with Plugin.of_cmd and Plugin.of_cmds. Other plugins can be stateful (typically, they can have some persistent state, or more "custom" schemes). The constructor Plugin.stateful is used to make such plugins. All the persistent state is stored in a single json file.

See for instance the existing plugins Plugin_factoids and Plugin_movie to see how to use Plugin.stateful.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].