Giter Site home page Giter Site logo

sagax / fgbot_ircp Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ppvg/node-ircp

0.0 2.0 0.0 192 KB

IRC protocol library for Node.js.

Home Page: https://npmjs.org/package/ircp

License: BSD 2-Clause "Simplified" License

LiveScript 97.69% JavaScript 2.31%

fgbot_ircp's Introduction

ircp

Build Status Code Coverage

IRC protocol library for Node.js. Used to be part of ircc.

Installation

$ npm install ircp

Dependencies

Node.js 0.8.x or above.

API

ircp.parse(line)

ircp.parser.parse(line)

Takes an IRC message as raw text and returns a message object. A few examples (via the node REPL):

> ircp.parse(':nick!user@host PART #channel');

{ command: 'PART',
  parameters: [ '#channel' ],
  nick: 'nick',
  user: 'user',
  host: 'host',
  type: 'command' }

> ircp.parse(':irc.example.com 001 botname :Welcome to the example IRC network!');

{ command: 'WELCOME',
  parameters:
   [ 'botname',
     'Welcome to the example IRC network!' ],
  server: 'irc.example.com',
  code: '001',
  type: 'reply' }

Throws an Error if the message can't be parsed.

ircp.serialize(message)

ircp.serializer.serialize(message)

The reverse of parser. Takes a message object and turns it into a string.

> ircp.serialize(ircp.parse(':nick!user@host PART #channel'));

':nick!user@host PART #channel'

Throws an Error if the object is not a valid message.

ircp.codes.convert()

Find the name and type of an IRC command. Known numeric commands are converted to their human-readable form. A few examples:

> ircp.codes.convert('001');

{ name: 'WELCOME', type: 'reply' }

> ircp.codes.convert('401');

{ name: 'NOSUCHNICK', type: 'error' }

> ircp.codes.convert('NOTICE');

{ name: 'NOTICE', type: 'command' }

Possible values for type are 'reply', 'error', 'command' and 'unknown'.

fgbot_ircp's People

Contributors

ppvg avatar

Watchers

James Cloos avatar sagax 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.