tekko
TypeScript icon, indicating that this package has built-in type declarations

3.0.1 • Public • Published

Tekko

Another IRC message parser and formatter.

Heavily inspired by irc-message, this parser also includes a built-in tag value unescaper according to IRCv3 Specifications.

Table of Contents

Installation

npm install tekko --save

Usage

Parse

const { parse } = require("tekko");

const result = parse("@lorem=ipsum;dolor :hello!sir@madam PRIVMSG #test :Hello, world!"));
/* { command: 'PRIVMSG',
 *   params: [ '#test', 'Hello, world!' ],
 *   prefix:
 *    { host: 'madam',
 *      nick: 'hello',
 *      user: 'sir' },
 *   tags: {
 *      lorem: 'ipsum',
 *      dolor: true } }
 */

console.log(result.middle);
/* [ '#test' ]
 */

console.log(result.trailing);
/* 'Hello, world!'
 */

Format

const { format } = require("tekko");

const result = format({
  command: "PRIVMSG",
  params: ["#test", "Hello, world!"],
  prefix: {
    host: "madam",
    nick: "hello",
    user: "sir",
  },
  tags: {
    lorem: 'ipsum',
    dolor: true,
  },
});
/* "@lorem=ipsum;dolor :hello!sir@madam PRIVMSG #test :Hello, world!"
 */

Author

Alexandre Breteau - @0xSeldszar

License

MIT © Alexandre Breteau

Package Sidebar

Install

npm i tekko

Weekly Downloads

288

Version

3.0.1

License

MIT

Unpacked Size

19.5 kB

Total Files

15

Last publish

Collaborators

  • seldszar