nandub / hubot-irc

IRC adapter for Hubot
MIT License
299 stars 128 forks source link

Add means to ensure users are authenticated with nickserv? #103

Closed patcon closed 7 years ago

patcon commented 10 years ago

The gittip project is considering how to use hubot to deploy from the public #gittip channel on freenode. Still not sure if it's a good idea, but we would definitely need a way to ensure that only the designated irc users are allowed to "become" privileged from hubot's point of view.

Links:

jgable commented 10 years ago

That's interesting. I've also thought about adding something like this before. I'm worried this could introduce a significant delay in bot commands since you'd effectively have to check this before every command response, for every person, all the time.

patcon commented 10 years ago

@jgable Ah missed this :) Could we not set it up in such a way that it only checked when calling a command that used robot.Auth.hasRole?

https://github.com/github/hubot-scripts/blob/master/src/scripts/auth.coffee#L18

cc: @balupton

balupton commented 10 years ago

We're also thinking of making a hubot script that allows moderators to interact with github issues (close, label, etc) via IRC. As such, this would also be essential for such functionality.

patcon commented 10 years ago

Ok, so I've sorted out how the irc lib and communication with nickserv works. I did npm install irc, and this script gives me the data that I want, so I guess I can move forward with this sometime soon.

var irc = require('irc');
var client = new irc.Client('irc.freenode.com', 'myNick', {
  channels: ['#testtesttest'],
});

client.addListener('notice', function (from, to, text) {
  if (from == 'NickServ' && text.indexOf('ACC') != -1) {
    console.log(from + ': ' + text);
  };
});

client.addListener('notice', function (from, to, text) {
  if(from=='NickServ' && text.toLowerCase().indexOf('identify') != -1) {
    console.log(text);
    client.say('NickServ', 'ACC patcon');
  };
});

It basically waits for nickserv to talk to me via notice, then asks it to identify someone and provides feedback that can be read like so.

➜  /tmp  node irc-server.js
This nickname is registered. Please choose a different nickname, or identify via /msg NickServ identify <password>.
NickServ: patcon ACC 3
mikeumus commented 10 years ago

I give this issue a thumb: :+1:

macalinao commented 10 years ago

This is kind of important

chrisdotcode commented 7 years ago

It's a bit late now, but I think that @patcon's solution looks pretty good for this sort of thing. (and may gratipay rest in peace).