putain-de-bot

0.3.0 • Public • Published

putain de bot!

https://travis-ci.org/putaindebot/core

api

bot(options) > bot instance

creates a bot with the given options.

options.name

bot username

options.channel

channel to connect to

options.server

server to connect to

options.flood

object containing flood config with protection & delay keys.

options.debug

doesn't use irc feed but lets you write() data in it for testing purposes.

bot.mention(regexp, callback) > bot

checks mentions followed by a string matching regexp, and executes callback when a chunk matches.

mentions must start with options.name.

bot.message(regexp, callback) > bot

checks message followed by a string matching regexp, and executes callback when a chunk matches.

bot.leave(message, callback) > bot

leaves the current channel and executes callback afterwards.

bot.join(callback) > bot

joins the current channel.

bot.use(plugin[, args…]) > bot

inits the given plugin in bot, with the given optional args.

callbacks

ed-209 is a stream-based bot. to write data from mention or message callbacks, just use :

this.queue("string")

and it will go the write stream.

example

var ed209 = require("putain-de-bot")
var bot = ed209({
  name : "yoloswegbot",
  channel : "#ed-209-arena",
  server : "irc.freenode.net",
  flood : {
    protection : true,
    delay : 500
  }
})

bot
  .mention(/alert ([\s\S]+)/, function(whole, message){
    this.queue(bot.getUsers().join(" "))
    this.queue(message)
  })
  .message(/shut up/, function(){
    this.queue("hoi! be nice")
  })

Readme

Keywords

none

Package Sidebar

Install

npm i putain-de-bot

Weekly Downloads

2

Version

0.3.0

License

ISC

Last publish

Collaborators

  • bloodyowl