badges / shields

Concise, consistent, and legible badges in SVG and raster format
https://shields.io
Creative Commons Zero v1.0 Universal
23.68k stars 5.49k forks source link

Badge request: IRC channel name + user count #627

Open andrewrk opened 8 years ago

andrewrk commented 8 years ago

I'm not sure exactly what shields is, but this seems like a nice place to find out if anyone has already thought of / implemented this idea:

I'd like a shield that displays the IRC channel of my project, and tells the number of people that are currently in the channel. I think that would make it more likely for people to want to join and chat if they see that the room is not empty.

hlandau commented 8 years ago

This is an interesting idea, but difficult. In order to do this reasonably you'd need to find an existing IRC indexer with an API to expose this information. And as far as I'm aware, none exist. There are IRC indexers, but, as far as I'm aware, none with an API. Might be interesting to approach them and ask if they'd be interested in exposing one...

espadrine commented 8 years ago

That's a really nice idea, and I'd love to see it done. If we want to generalize to any IRC network, I'm not sure we can use HTTP.

Something as simple as this gives us the answer, if we parse it:

var net = require('net');
function getUsers(host, port, channel, cb) {
  var client = net.createConnection({host:host, port:port},
    function() {
      client.write('NICK shields\nUSER shields.io 8 * : shields\nJOIN ' + channel + '\n');
    });
  var data;
  client.on('data', function(buffer) {
    data += '' + buffer;
    // Parse the data.
    client.end();
  });
  client.on('end', function() { cb(data); });
}

getUsers('irc.freenode.net', 6667, '#ubuntu', function(data) {console.log(data)});

It is way too slow, will cause nick collisions, doesn't escape the channel name, and the IRC servers wouldn't be able to handle the load.

We would want to use a much more lightweight way to access that data. Ideally, we'd want to talk to Freenode about it, but their website does not present a way to contact them. I left an unmoderated comment on http://blog.freenode.net/2016/02/recent-events-and-future-changes, we'll see how things go.

andrewrk commented 8 years ago

You don't have to join the room to get the user count. The LIST command returns a list of all channels with user count for each one.

You could have a single server do a LIST command on freenode every 5 minutes or so and then cache the results in a table.

espadrine commented 8 years ago

I tried, but I didn't get any user. Do you have a minimal script similar to the one I wrote that produces that result?

tunnckoCore commented 7 years ago

this is interesting idea, yea. And probably the url could be something like this

https://img.shields.io/irc/network-name/channel-name[/port].svg

e.g.

freenode irc tunnckoCore charlike channel

freenode irc tunnckoCore charlike channel

![](https://img.shields.io/badge/irc.freenode.net-%23charlike-blue.svg)
andrewrk commented 7 years ago

I want to reiterate that printing the count of users in the channel would be likely to increase engagement.

tunnckoCore commented 7 years ago

i think that there's no so much space. most important are the network and channel name. For me it can't be without network or channel.

Don't know, probably this seems okey too

freenode irc tunnckoCore charlike channel

but it's not clear nowadays that this is IRC channel "room" :D Once upon a time it was totally enough.

koppor commented 6 years ago

I like the badge of @olstenlarck. Maye also IRC #charlike 331? - Not much more space, but clear that it is IRC.

tunnckoCore commented 6 years ago

@koppor agree :)

paulmelnikow commented 6 years ago

It looks like we would need some help from Freenode on this. @koppor would you like to reach out to them?

tunnckoCore commented 6 years ago

@paulmelnikow why? @espadrine gives good example https://github.com/badges/shields/issues/627#issuecomment-195821298 which i believe will work.

koppor commented 6 years ago

@paulmelnikow

I talked in #freenode on the Freenode IRC.

"basically: every piece of information that users could not gather from outside of the channel should not be published without channel owner consent"

koppor commented 6 years ago

@olstenlarck I think, the above JavaScript statements do a) join a channel (which may be disallowed by channel operators as this is an automated operation) b) are only OK when executed on the shield servers in a cronjob and not on every request by a user.

koppor commented 6 years ago

@paulmelnikow There is http://irc.netsplit.de/ with some user data; maybe, that can be used? (Even though, not all channels seem to be available here)

Example: http://irc.netsplit.de/channels/details.php?room=%23eclipse&net=freenode

http://irc.netsplit.de/channels/?chat=eclipse

grafik

paulmelnikow commented 6 years ago

Is it possible that Freenode could add a separate API for this, maybe even an HTTP API?

ssbarnea commented 5 years ago

At this stage i would be glad to see even only a clickable URI link like irc:///#foo kind of badge, without any counting of users.

graingert commented 3 years ago

I'd like to see info from logbot.info eg: https://freenode.logbot.info/twisted-dev/stats