How to use irc - 10 common examples

To help you get started, we’ve selected a few irc examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github alexyoung / ircd.js / test / links.js View on Github external
}
};

server1.start();
server2.start();
server3.start();
server4.start();

// TODO: Make a client join, oper, then link the two servers
//       and fix the other tests

var client,
    client2,
    client3;

client = new irc.Client('localhost', 'alex', {
  channels: ['#test'],
  port: 6667,
  debug: false
});

client2 = new irc.Client('localhost', 'bob', {
  channels: ['#test'],
  port: 8000,
  debug: false
});

client3 = new irc.Client('localhost', 'alice', {
  channels: ['#test'],
  port: 8001,
  debug: false
});
github arscan / streamed / source_bots / live-github-irc.js View on Github external
separator = "*";

var colors = [
    "orange",
    "light_magenta",
    "dark_blue",
    "gray",
    "yellow",
    "light_red",
    "light_magenta",
    "light_cyan"
    ];

var last = [];

var ircclient = new irc.Client(server, nick, {debug: false, showErrors: true, floodProtection: false, floodProtectionDelay: 0, channels: ["#github"]});

/* listeners */

ircclient.addListener('error', function(message) {
         console.log('irc error: ' +  message);
 });

ircclient.on("error", function(err){
    console.log("irc error: " + err);

});

ircclient.addListener('message', function (from, to, message) {
        console.log(from + ' => ' + to + ': ' + message);
});
github Phalanxia / Maid-IRC / lib / maidIrc.js View on Github external
function createClient (socket, info, clientId) {
		console.log("Creating new IRC client instance");
		// Create the IRC client instance.
		var client = new irc.Client(info.server, info.nick, {
			channels: [info.channel],
			userName: info.nick,
			password: info.nicknamePassword,
			realName: info.realName,
			port: info.port,
			floodProtection: true,
			floodProtectionDelay: 1000,
			autoRejoin: true,
			autoConnect: false,
			secure: false,
			selfSigned: false,
			certExpired: false,
			sasl: false,
			stripColors: true,
			messageSplit: 512,
			showErrors: true
github Phalanxia / Maid-IRC / src / server / modules / maidIrc.js View on Github external
function createClient(socket, info, clientId) {
		// Create the IRC client instance
		console.log('Creating new IRC client instance');
		let _debug = false;

		if (env === 'development') {
			_debug = true;
		}

		const client = new irc.Client(info.server, info.nick, {
			userName: info.nick,
			realName: info.realName,
			password: info.nicknamePassword,
			port: info.port,
			localAddress: null,
			debug: _debug,
			showErrors: true,
			autoRejoin: true,
			autoConnect: false,
			channels: [info.channel],
			retryCount: null,
			retryDelay: 2000,
			secure: false,
			selfSigned: false,
			certExpired: false,
			floodProtection: true,
github L1fescape / AWESOM-0 / awesom0.js View on Github external
lastMsg = msg;
          if (debug) {
            console.log(chalk.green('Response (via ' + channel + '):'), msg);
          }
        },
        opt : this.client.opt
      };
      this.testMsg = function(msg) {
        this.onmessage('TestUser', '#test', msg);
      };
      this.lastMsg = function(){
        return lastMsg;
      };
    } else {
      // connect to the irc server
      this.client = new irc.Client(this.settings.server, this.settings.botname, {
        channels: this.settings.channels,
        port: this.settings.port || 6667,
        showErrors: this.debug,
        userName: this.settings.userName || 'awesom0',
        realName: this.settings.realName || 'AWESOM-0'
      });

      // bind all events
      this.client.addListener('connect', _.bind(this.connecting, this));
      this.client.addListener('registered', _.bind(this.onconnect, this));
      this.client.addListener('message', _.bind(this.onmessage, this));
      this.client.addListener('join', _.bind(this.onjoin, this));
      this.client.addListener('error', _.bind(this.onerror, this));
    }

    return this;
github mythmon / crimsontwins / app / chat.js View on Github external
var irc = require('irc');

var config = require('./config');
var manager = require('./manager');


// IRC Bot
var ircClient = new irc.Client(config.irc.server, config.irc.nick, {
  channels: config.irc.channels
});

// On connected to IRC server
ircClient.on('registered', function(message) {
  // Store the nickname assigned by the server
  config.irc.nick = message.args[0];
});

// On receive IRC message.
ircClient.addListener('message', function(from, to, message) {
  var match;

  // Only listen to messages targeted at the bot.
  if (message.indexOf(config.irc.nick) !== 0) {
    if (from === 'dashbot') {
github alexyoung / ircd.js / test / clients.js View on Github external
'test secret channels in WHOIS': function(end) {
    var setMode = true, client, client2;

    client = new irc.Client('localhost', 'n1', {
      channels: ['#secret'],
      port: port,
      debug: false
    });

    client.addListener('join', function() {
      client2 = new irc.Client('localhost', 'n2', {
        channels: ['#test'],
        port: port,
        debug: false
      });

      client.send('MODE', '#secret', '+s');

      client.on('raw', function(data) {
        if (data.rawCommand === 'MODE') {
github cliffano / nestor / lib / bot.js View on Github external
Bot.prototype.connect = function (host, channel, opts) {
  const PENDING = 1000;

  this.nick = (opts && opts.nick) ? opts.nick : 'nestor';
  this.channel = '#' + channel;

  var self = this;

  process.on('SIGINT', function () { self.disconnect(); });
  process.on('SIGTERM', function () { self.disconnect(); });

  console.log(text.__('Connecting to %s as %s'), host, this.nick);
  this.client = new irc.Client(host, this.nick);

  this.client.addListener('error', function (err) {
    console.error(text.__('Error: '), err);
  });

  this.client.addListener('message' + this.channel, function (from, message) {
    if (message.match(new RegExp('^' + self.nick))) {
      var parts = message.split(' '),
        command = parts[1],
        args = parts.slice(2);

      if (command === undefined) {
        self.say(text.__('Usage: %s   ... '), self.nick);
      } else if (self.commands[command]) {
        self.commands[command].apply(self, args);  
      } else {
github jarofghosts / ziggy / lib / ziggy.js View on Github external
Ziggy.bots.forEach(function (bot) {
    bot.client = new irc.Client(bot.server, bot.nickName, { channels: bot.channels })
    bot.plugins.forEach(function (plugin) {
      if (Ziggy.plugins.indexOf(plugin) === -1) {
        console.log('unknown plugin: ' + plugin)
      } else {
        Ziggy.plugins[plugin].listeners.forEach(function (listener) {
          bot.client.addListener(listener.on, listener.callback)
        })
      }
    })
  })
}
github zenirc / zenircbot / bot.js View on Github external
setup: function() {
        zenircbot.config = api.load_config(opts.config);
        zenircbot.pub = api.get_redis_client(zenircbot.config.redis);
        zenircbot.sub = api.get_redis_client(zenircbot.config.redis);

        zenircbot.unsetRedisKeys();
        var cfg = zenircbot.server_config_for(0);
        console.log('irc server: '+cfg.hostname+' nick: '+cfg.nick);
        zenircbot.irc = new irc.Client(cfg.hostname, cfg.nick, cfg);
        var bot = zenircbot.irc

        bot.addListener('connect', function() {
            zenircbot.pub.set('zenircbot:nick', bot.nick);
            zenircbot.pub.set('zenircbot:admin_spew_channels',
                              cfg.admin_spew_channels)
        });

        bot.addListener('ctcp', function(nick, to, text, type) {
            console.log('action: ' + nick + ' said ' + text + ' to ' + to);
            if (to == bot.nick) {
                to = nick;
            }
            var msg = {
                version: 1,
                type: 'privmsg_action',

irc

An IRC client library for node

GPL-3.0
Latest version published 7 years ago

Package Health Score

60 / 100
Full package analysis

Popular irc functions