
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
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.
npm install --save tw-irc
yarn add tw-irc
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.
import Client, {ECommand} from 'tw-irc';
const {Message} = ECommand;
// Create IRC client
const client = new Client();
// Bind events before connect. Just watch for incoming messages
client.on(Message, ({message, displayName}) => {
console.log(`User ${displayName} said: "${message}"`);
});
// When socket connection is successfully opened, join channel
client.onConnected(() => {
client.channels.join('rxnexus');
});
// Connect client to IRC
client.connect();
import Client from 'tw-irc';
// Create authenticated IRC client
const client = new Client({
channels: ['rxnexus'],
secure: true, // secure connection recommended
auth: {
login: 'twitchfan', // your Twitch login
password: 'oauth:...', // oauth token. Get it here: https://twitchapps.com/tmi/
},
});
client.onConnected(() => {
// Say hi!
client.channels.say('Hello @rxnexus!', 'rxnexus');
});
client.connect();
tw-irc supports all of the channel modes and commands.
import Client from 'tw-irc';
const client = new Client();
client.onConnected(() => {
client.channels.join('rxnexus');
// Ban someone
client.channels.ban('troll123', 'rxnexus');
// Set emote-only mode
client.channels.emoteOnly.enable('rxnexus');
});
client.connect();
For easier usage you can create channels controllers from client.
import Client from 'tw-irc';
const client = new Client();
client.onConnected(() => {
// Create channel controller
const channel = client.fork('rxnexus');
// Join channel
channel.join();
// Say hi
channel.say('Hello!');
// Set emote only mode
channel.emoteOnly.enable();
// Ban some troll in channel
channel.ban('troll123');
});
client.connect();
If you want full control over the messages coming from IRC, you can use this trick:
import Client from 'tw-irc';
import {prepareIRCMessage, parseIRCMessage} from 'tw-irc/utils';
const client = new Client();
client.onMessage(event => {
// Convert raw socket message to array of messages. We need this action
// because commands can be concatenated in one message and doing this,
// we just detect them.
const messages = prepareIRCMessage(event.data);
// Parse each of the messages
const parsedMessages = messages.map(parseIRCMessage);
parsedMessages.forEach(message => {
// You can react however you want after all of messages are parsed.
});
});
client.connect();
There are 2 examples for node and browser.
Running node version:
yarn dev-node or npm run dev-node;Running browser version:
yarn dev or npm run dev;http://localhost:9000;You can find updates history here.
MIT
FAQs
TypeScript library for working with Twitch IRC
We found that tw-irc demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.