Pues eso, habemus nueva versión de PyIC ( una librería para clientes IRC ), ya está subida en GitHub [ https://github.com/kenkeiras/PyIC ]

Se puede ver como quedan las funciones en el README, pero los cambios básicamente son estos:

  • Lee el 'MOTD' automáticamente, se puede recuperar con irc.get_motd( ).
  • irc.get_users( ) devuelve la lista de usuarios, no hace falta leerlos a mano.
  • Lo mismo para irc.get_channels( ), que devuelve un array de tuplas( 'canal', 'número de usuarios', 'tema' ).
  • irc.get_topic( ) lo mismo, devuelve una string con el tema.
  • Y para no variar, lo mismo para irc.whois( ) y irc.whowas( ) , que devuelven un diccionario como este: { 'server_info': Información del servidor 'idle': 'seconds idle, signon time' 'real_name': Nombre real del usuario 'channels': Array de canales 'nick': Nick del usuario 'host': Dirección del host 'user': Nombre del usuario 'time': Tiempo conectado 'server': Server donde está conectado }

Enfín, por ejemplo:

!/usr/bin/env python

-- encoding: utf-8 --

PyIC example

from pyic import *

botName = "HelloBot" # NickName

server = "irc.freenode.net" # IRC server

channel = "#bot_testing" # IRC channel

greet = "Hello"

topic = "PyIC testing"

print "Connecting..."

irc = irc_client( botName, server ) # Connect

print "Message of the day:"

print irc.get_motd( )

print "Reading channel list"

print len( irc.get_channels( ) ), "channels"

print "Joining", channel

irc.join( channel ) # Joins the channel

irc.notice( channel, greet + " " + channel ) # talks to the channel

use notice in order to avoid automatic responses

Reads the user list

for usr in irc.get_users( channel ):

print '"' + usr + '" data'

print irc.whois( clean_usr( usr ) ) # Shows the user data

irc.notice( channel, greet + " " + usr ) # talks to the user

print "Setting channel topic"

irc.set_topic( channel, topic )

print "Topic:", irc.get_topic( channel )

print "Waiting for users..."

Greets who enters the channel

while ( True ):

msg = irc.getmsg( )

if ( msg.type.upper( ) == "JOIN" ): # Someone entered the channel

   if ( msg.by != botName ):



       print "'" + msg.by + "'", "has arrived"

       irc.notice( channel, greet + " " + msg.by )

       print irc.whois( msg.by )

Hasta la próxima