
Untitled
By: a guest on
May 4th, 2012 | syntax:
None | size: 0.61 KB | hits: 23 | expires: Never
My python twisted irc bot responding to commands
def privmsg(self, user, channel, msg):
user = user.split('!', 1)[0]
if not msg.startswith('#'): # not a trigger command
return # do nothing
command, sep, rest = msg.lstrip('#').partition(' ')
func = getattr(self, 'command_' + command, None)
def command_time(self, *args):
return time.asctime()
if not message.startswith('!'): # not a trigger command
return # do nothing
command, sep, rest = message.lstrip('!').partition(' ')
from datetime import datetime
# ...
def command_time(self, rest):
return datetime.utcnow().isoformat()