I am developing a system to give alerts in IRC channels in python.
Here is a very simple IRC bot which can give some announcement/alert in any channel or to any person as private message.
# Connection information
network = ‘IRC.SERVER.NAME’
port = 6667
channel = ‘CHANNELNAME’
nick = ‘NICKNAME’
name = ‘REAL NAME’
irc = irclib.IRC()
server = irc.server()
server.connect ( network, port, nick, ircname = name )
# Message both the channel and you
server.privmsg ( channel, ‘Hello Everybody. Nice to see you’ )
server.privmsg ( ‘ANY USER NAME’, ‘Private Message to User’ )
#All the scripts in internet use process_forever(). But it keeps the script to be running forever.
#I want this script to quit after sending the message. So using a sleep for the giving sometime for the bot #to finish all its network operations
Using this, I automated a reporting system to ping in our internal IRC channels about the recent updates in our internal tracker.