yamlirc
simple yaml setup to work with bots
Last updated 7 years ago by jahpd .
cc-by-sa · Repository · Original npm · Tarball · package.json
$ cnpm install yamlirc 
SYNC missed versions from official npm registry.

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"] 
	}
}

Current Tags

  • 0.0.3                                ...           latest (7 years ago)

2 Versions

  • 0.0.3                                ...           7 years ago
  • 0.0.1                                ...           7 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 2
Dependencies (2)
Dev Dependencies (3)
Dependents (1)

Copyright 2014 - 2016 © taobao.org |