node package manager

yamlirc

simple yaml setup to work with bots

A Yaml configuration file builder to use with irc-bots

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
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(errdata){
// data is a string from file 
oopt = yamljs.load data
oopt.channels.push "#vegan"
yamlirc.add('path/to/my/other/irc.yml', oopt, function(errdata){
//TODO other thing... 
})
})
 
//load existed file 
yamlirc.load('path/to/my/irc.yml', function(erryaml){
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"] 
}
}