Simple IRC Announce System in Python

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.

impirt irclib
import time

# Connection information
network = ‘IRC.SERVER.NAME’
port = 6667
channel = ‘CHANNELNAME’
nick = ‘NICKNAME’
name = ‘REAL NAME’

# Connect
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.


One thought on “Simple IRC Announce System in Python

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s