yamlirc

simple yaml setup to work with bots

npm install yamlirc
4 downloads in the last week
8 downloads in the last month

YAMLirc

A Yaml configuration file builder to use with irc-bots

Install

Install via npm

$ npm install jahpd/yamlirc

Or clone our repo in github

$ git clone https://github.com/jahpd/yamlirc

And then install necessary modules

$ npm install -l

Build and Test

Run

$ npm test

Usage

var yamlirc = require('yamlirc')
var yamljs = require('yaml-js')
var bot = require('irc')

var opt = {
    server: "irc.freenode.net"
    nick: "yaml"
    channels: ["#nodejs", "#labmacambira", "#yaml"]
}

yamlirc.add('path/to/my/irc.yml', opt, function(err, data){
    // data is a string from file
    oopt = yamljs.load data
    oopt.channels.push "#vegan"

    yamlirc.add('path/to/my/other/irc.yml', oopt, function(err, data){
        //TODO other thing...
    })
})

//load existed file
yamlirc.load('path/to/my/irc.yml', function(err, yaml){
    if(!err) var mybot = new irc.Client(yaml.server, yaml.nick, yaml.options)
})

will generate a file like this in path/to/my/irc.yml

---
server: irc.freenode.net
nick: yamlbot
options: 
  port: 6607
  userName: oyamlboto
  realName: eeByamlbotBee
  autorejoin: on
  debug: on
  secure: off
  pluginsPath: ../plugins/
  channels:
    - "#nodejs" 
    - "#labmacambira" 
    - "#yaml"

in callback function, yamldata get a object like this, and then you can use on a ircbot:

{
    server: "irc.freenode.net",
    nick: "bot",
    options: {
        port: "6607",
        userName: "oyamlboto",
        realName: "eeByamlbotBee",
        autorejoin: true,
        debug: true,
        secure: false,
        pluginsPath: "../plugins/",
        channels: ["#nodejs", "#labmacambira", "#yaml"] 
    }
}
npm loves you