0.3.0 • Published 10 years ago

putain-de-bot v0.3.0

Weekly downloads
3
License
ISC
Repository
github
Last release
10 years ago

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")
  })
0.3.0

10 years ago

0.2.5

10 years ago

0.2.4

10 years ago

0.2.3

10 years ago

0.2.2

10 years ago

0.2.1

10 years ago

0.2.0

10 years ago

0.1.2

10 years ago

0.1.1

10 years ago

0.1.0

10 years ago

0.0.0

10 years ago