Display a nicklist from IRC on a website

The purpose is to display a list of users from an IRC channel on a website, which basicly consists of the two sections below.

Obtaining a list of users

Here is the piece of TCL code I have used myself to successfully generate a list of users on a channel:

bind time - "?0 * * * *" save:nicklist
proc save:nicklist {min hour day mon year} {
  set file "~/public_html/nicklist.db"
  set fs [open $file w]
  set mychan "#HappyMeal"
  set reg [list]
  set voi [list]
  set ops [list]
  foreach user [internalchanlist $mychan] {
    if {[isop $user $mychan]} {
      lappend ops @$user<br />
    } elseif {[isvoice $user $mychan]} {
      lappend voi +$user<br />
    } else {
      lappend reg $user<br />
    }
  }
  set ops [lsort -dict -increasing $ops]
  set voi [lsort -dict -increasing $voi]
  set reg [lsort -dict -increasing $reg]
  puts $fs "<font color=#FD8500>[join $ops ""]</font>
            <font color=#C1C1C1>[join $voi ""]</font>
            <font color=#747474>[join $reg ""]</font>"
  close $fs
}

This code has been tested and found working both in eggdrops and sBNC instances. You might want to change the points pointed out below of the code into something you want.

  • Where to save the nicklist, set file ”~/public_html/nicklist.db”
  • What channel to use as a source of nicks, set mychan ”#HappyMeal”
  • Colors you want opped, voiced, and regular people to have, color=#FD8500 etc.

Including it on the website

The last thing you need is some php to reach out for the database we save every 10 minutes above, and display it.

<?php
  include('http://path.to/nicklist.db');
?>

I use different servers for the actual nicklist.db and the website, hence the complete URL in the include function.

faq/display_a_nicklist_from_irc_on_a_website.txt · Last modified: 2006/04/25 15:14 by zyberdog