tekko
v3.0.1
Published
Another IRC message parser and formatter
Downloads
6,935
Readme
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