From 877d3caa9cff34874e4b5f676a9fbdb0f531d47e Mon Sep 17 00:00:00 2001 From: Evert Prants Date: Sat, 24 Sep 2022 14:22:51 +0300 Subject: [PATCH] add README --- README.md | 41 +++++++++++++++++++++++++++++++++++++++++ package.json | 1 + 2 files changed, 42 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..bd50d75 --- /dev/null +++ b/README.md @@ -0,0 +1,41 @@ +# IRClib + +Zero dependencies library for creating anything using the IRC protocol - bots, clients, you name it. It includes a variety of utilities, such as a nick list class that manages mode prefixes for you, NickServ authentication checker and message formatting (colors!). + +[Read the Typedoc](https://lunasqu.ee/irclib/index.html) + +## Getting started + +There is an example usage documented in [src/examples/connection-test.ts](https://gitlab.icynet.eu/IcyNetwork/irclib/-/blob/master/src/examples/connection-test.ts), but basically you have two ways to create an IRC client connection: + +1. Use the `IRCBot` class. This just takes connection options and it uses `IRCSocketConnector` (so it will not work in the browser!) +2. Use the `IRCConnectionWrapper` class directly. To use this, you need to provide your own connector in addition to the options. + +### Connection options + +The connection options are documented in detail [here](https://lunasqu.ee/irclib/interfaces/IIRCOptions.html), but the most important are: + +- `host` - Server host. +- `nick` - Your nickname. +- `port` - Server port, defaults to 6667. +- `ssl` - Use secure connection. +- `channels` - String-list of channels to join on connect. + +### Connectors + +This module provides two connectors: `IRCSocketConnector` for Node.js usage (`net` and `tls`) and `IRCWebSocketConnector` for browser usage (WebSockets). You can always write your own if you need something different. + +**These are not included in the main module!** You need to import them from `@icynet/irclib/lib/connector/[..].ts`. This is to prevent browser bundlers from including `net` and `tls`! + +### Event handlers + +The main classes use a special custom [TypedEventEmitter](https://lunasqu.ee/irclib/classes/TypedEventEmitter.html) to send events. + +- [Connection wrapper events](https://lunasqu.ee/irclib/classes/IRCConnectionWrapper.html) +- [Nick list events](https://lunasqu.ee/irclib/classes/IRCNickList.html) + +Basically, you're mostly just going to need the `message` event for IRC. + +## IRCv3 + +Currently, this module only supports SASL authentication capability. diff --git a/package.json b/package.json index cf5beae..0397141 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,7 @@ }, "author": "Evert Prants", "license": "ISC", + "repository": "https://gitlab.icynet.eu/IcyNetwork/irclib", "devDependencies": { "@types/node": "^18.7.18", "prettier": "^2.7.1",