dbircdsock - Read from an IRCd socket.
If you want to provide a fix or a change, feel free! It will be applied if found reasonable.
Notes:
- The InspIRCd code makes use of "destructuring". You must apply --harmony_destructuring in order to use this code, otherwise an error will be thrown.
######IRCd Service Example:
"use strict";
const ircd = require('dbircdsock');
let server = new ircd(ircd.protocols.inspircd, {
address: 'services.example.com',
serverId: '98X',
password: "",
description: 'OWCA, Secret Agent Headquarters',
host: '127.0.0.1',
port: 7000
});
(function() {
this.connect();
let channels = [];
let clients = [];
let scrap = this.create({
nick: 'ScrapServ',
hostname: 'services.example.com/ScrapServ',
ident: 'scrap',
ip: '127.0.0.1',
gecos: 'Secret Agent ScrapServ'
});
this.on('BURST', function() {
this.introduce(scrap);
});
this.on('CLIENT', function(client) {
console.log('Client', client, 'has connected to the network');
this.notice(scrap, client, "Welcome to the network, %s!", client);
});
this.on('CHANNEL', function(channel) {
console.log('Channel', channel, 'has just been created');
});
this.on('DECHANNEL', function(channel) {
console.log('Channel', channel, 'has just been destroyed');
});
this.on('JOIN', function(channel, nick, prefixes) {
console.log('Client', nick, 'has just joined', channel, ':' + prefixes.join(','));
});
this.on('PART', function(channel, nick, message) {
console.log('Client', nick, 'has just parted', channel, ':' + message);
});
this.on('TOPIC', function(server, client, channel, topic, old) {
console.log('Topic for', channel, 'has been set to:', topic);
});
}.bind(server))();