https://github.com/seldszar/tekko
Another IRC message parser and formatter.
https://github.com/seldszar/tekko
formatter ircv3 parser
Last synced: 8 months ago
JSON representation
Another IRC message parser and formatter.
- Host: GitHub
- URL: https://github.com/seldszar/tekko
- Owner: Seldszar
- License: mit
- Created: 2018-09-21T20:10:53.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2022-11-16T00:48:10.000Z (about 3 years ago)
- Last Synced: 2025-02-02T05:24:54.256Z (about 1 year ago)
- Topics: formatter, ircv3, parser
- Language: TypeScript
- Homepage:
- Size: 330 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Tekko
> Another IRC message parser and formatter.
Heavily inspired by [`irc-message`](https://github.com/sigkell/irc-message), this parser also includes a built-in tag value unescaper according to [IRCv3 Specifications](https://ircv3.net/specs/core/message-tags-3.2.html).
## Table of Contents
- [Installation](#installation)
- [Usage](#usage)
- [Author](#author)
- [License](#license)
## Installation
```bash
npm install tekko --save
```
## Usage
### Parse
```javascript
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
```javascript
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](https://twitter.com/0xSeldszar)
## License
MIT © [Alexandre Breteau](https://seldszar.fr)