privmsg handler stub
This commit is contained in:
parent
f310eadb6a
commit
6765a539e9
12
dr.botzo.py
12
dr.botzo.py
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user