Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 4th, 2012  |  syntax: None  |  size: 0.61 KB  |  hits: 23  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. My python twisted irc bot responding to commands
  2. def privmsg(self, user, channel, msg):
  3.     user = user.split('!', 1)[0]
  4.  
  5.    if not msg.startswith('#'): # not a trigger command
  6.         return # do nothing
  7.     command, sep, rest = msg.lstrip('#').partition(' ')
  8.     func = getattr(self, 'command_' + command, None)
  9.  
  10. def command_time(self, *args):
  11.     return time.asctime()
  12.        
  13. if not message.startswith('!'): # not a trigger command
  14.    return # do nothing
  15. command, sep, rest = message.lstrip('!').partition(' ')
  16.        
  17. from datetime import datetime
  18.  
  19. # ...
  20. def command_time(self, rest):
  21.     return  datetime.utcnow().isoformat()