Giter Site home page Giter Site logo

teamblueridge / teambluebot Goto Github PK

View Code? Open in Web Editor NEW

This project forked from oftn-oswg/oftn-bot

0.0 8.0 0.0 722 KB

State-of-the-art IRC bot library & bot for Node.js

Home Page: http://oftn.org/#projects

License: Other

JavaScript 90.63% Haskell 1.09% C 8.28%

teambluebot's Introduction

oftn-bot

This is the repository for both of the IRC bots oftn-bot (in #oftn on freenode) and ecmabot (in ##javascript on freenode). This was originally created as a replacement for v8bot (http://github.com/eisd/v8bot). Over time, it changed to include a full-featured IRC bot library.

Features

  • Manages bot commands with an easy API
  • Support for "intents" which is when you append "@ user" after a bot command, so the bot can reply to that person
  • Context object provides information about bot command invocations, including:
    • Who invoked the command
    • Who was it "intended" for
    • Was this invoked in the channel or in a private message?
  • Can listen for regular expression matches
  • Control logging amount to standard out
  • Inherits from Node.js's built-in EventEmitter
  • Manages user lists and recognizes mode changes
  • Don't worry about flooding the channel with built-in support for truncation
  • Default option is to strip control codes and colors
  • Each channel and user is represented as a unique JavaScript object with extra information, e.g. channel topic, or user op status
  • Includes extra optional libraries:
    • FactoidServ: Manages a list of factoids which are saved and loaded to disk automatically
    • FeelingLucky: Performs a quick Google "I'm Feeling Lucky" search
    • JSONSaver: Saves and loads arbitrary JavaScript objects to disk automatically (used by FactoidServ)
    • Sandbox: Runs JavaScript in a seperate process to allow for users to run code. (Uses v8, but a compiled SpiderMonkey "shovel" is available that uses js185 shared libraries)

API

The underlying IRCBot library has methods which make it easy to add functionality.

Bot(profile)

@profile: An array of objects representing each server to connect to.

This is the main constructor for the bot. It is suggested that you inherit from this object when creating your bot, but you don't have to.

A profile is an array of objects. Each object has the properties:

  • host: The domain name or IP of an IRC server to connect to. Default: "localhost"
  • port: A port number. Default: 6667.
  • nick: A string nick name to try to connect as. Default: "guest"
  • password: The password used to connect (This is not NickServ). Default: null
  • user: Your IRC username
  • real: Your 'real name' on IRC
  • channels: An array of channel names to connect to. (e.g. ["#stuff", "##mychannel", "#yomama"])

bot.init()

Goes through each server in the profile and begins connecting and registering event listeners.

bot.register_listener(regex, callback)

Adds a regular expression listeners to incoming traffic on all servers. When the messages match, callback is called with the arguments:

  • context: A context object
  • text: The full message
  • 1st subpattern
  • 2nd subpattern
  • ...

bot.register_command(command, callback, options)

Adds a command.

  • command: A string value for the command
  • callback: A function to call when the command is run
  • options: An object with the keys: allow_intentions and hidden.

When the command is called, the callback is called with the arguments:

  • context: A context object
  • text: The command arguments

Additional Documentation

This bot AND/OR bot library is still being developed, but those are some of the basic commands. Look at your-bot-here.js for a simple example of an IRC bot using this API, or ecmabot.js for a more complex and featured example.

teambluebot's People

Contributors

dsamarin avatar imbcmdth avatar devyn avatar inimino avatar ljharb avatar eligrey avatar robotlolita avatar krinkle avatar kalaker avatar

Watchers

 avatar James Cloos avatar Kyle Laker avatar Robert Sink avatar Simon Sickle avatar Abhinav Jhanwar avatar Olivier Karasangabo avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.