tw-irc
Overview
Here is a library that handles connection to Twitch IRC. It allows you to join or leave channels, detect and send new messages and other.
Compatible for both node
and browser
.
Table of contents
Install
npm install --save tw-irc
yarn add tw-irc
Usage
To start working with Twitch IRC, we have to create a client. You can specify
if connection is secure
, pass channels
which client will automatically
join on connection established, or pass auth
data which is required to
send messages from someones face.
Basic
; ; // Create IRC client; // Bind events before connect. Just watch for incoming messagesclient.onMessage,; // When socket connection is successfully opened, join channelclient.onConnected; // Connect client to IRCclient.connect;
Authenticated client
; // Create authenticated IRC client; client.onConnected; client.connect;
Using channel commands
tw-irc
supports all of the channel modes and commands.
; ; client.onConnected; client.connect;
Forking channels
For easier usage you can create channels controllers from client.
; ; client.onConnected; client.connect;
Getting full control
If you want full control over the messages coming from IRC, you can use this trick:
;; ; client.onMessage; client.connect;
Example
There are 2 examples for node and browser.
Running node version:
- Clone repo;
- Type
yarn dev-node
ornpm run dev-node
;
Running browser version:
- Clone repo;
- Type
yarn dev
ornpm run dev
; - Open browser and go to
http://localhost:9000
; - Open console;
Updates history
You can find updates history here.
License
MIT