privmsg handler stub

This commit is contained in:
Brian S. Stephan 2010-07-24 12:22:35 -05:00
parent f310eadb6a
commit 6765a539e9
1 changed files with 12 additions and 0 deletions

View File

@ -6,7 +6,11 @@ import sys
import irclib
#####
# on_connect
# handler for when the bot has connected to IRC
#####
def on_connect(connection, event):
# user modes
try:
@ -18,6 +22,13 @@ def on_connect(connection, event):
# TODO: support multiple
if irclib.is_channel(channel):
connection.join(channel)
#####
# on_privmsg
# private messages to the bot
#####
def on_privmsg(connection, event):
print 'privmsg: ' + event.target() + '> ' + event.source().split('!')[0] + ': ' + event.arguments()[0]
#####
# init
@ -52,6 +63,7 @@ server = irc.server().connect(server, port, nick, ircname)
# install handlers
server.add_global_handler("welcome", on_connect)
server.add_global_handler('privmsg', on_privmsg)
# loop forever
irc.process_forever()