Socket
Socket
Sign inDemoInstall

@ctrl/irc

Package Overview
Dependencies
7
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @ctrl/irc

Node irc client in TypeScript


Version published
Weekly downloads
5
increased by25%
Maintainers
1
Install size
736 kB
Created
Weekly downloads
 

Readme

Source

@ctrl/irc npm

A typed IRC client library for node

Based on irc-upd. Includes irc color decoding based on irc-colors.js

Install

npm install @ctrl/irc

Use

import { IrcClient } from '@ctrl/irc';
const client = new IrcClient('irc.yourserver.com', 'myNick', {
  channels: [],
  port: 7000,
  secure: true,
});
client.connect();

Join a channel

client.join('#yourchannel yourpass');

Leave a channel

client.part('#yourchannel');

Send a message

// To channel
client.say('#yourchannel', 'hello');
// To user
client.say('nonbeliever', 'sup');

With typescript 4.1 template strings feature events can be fully typed.

// (from, message) parameters are typed via template strings matching `message#${string}`
client.addListener('message#yourchannel', (from, message) => {
  console.log(from + ' => #yourchannel: ' + message);
});

Debugging - subscribe to the raw messages and see what events are being parsed and re-emitted

client.on('raw', message => {
  console.log(message);
});

Keywords

FAQs

Last updated on 10 Jan 2024

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc