cobalt.py

changeset 21
8c389f46a056
parent 20
2603faf5f91b
child 23
c25944cac3e6
equal deleted inserted replaced
20:2603faf5f91b 21:8c389f46a056
338 stuff = message[1:].split(' ') 338 stuff = message[1:].split(' ')
339 command = stuff[0] 339 command = stuff[0]
340 args = stuff[1:] 340 args = stuff[1:]
341 try: 341 try:
342 self.handle_command (sender, user, host, replyto, command, args) 342 self.handle_command (sender, user, host, replyto, command, args)
343 except logical_exception as msg: 343 except logical_exception as e:
344 self.privmsg (replyto, "error: %s" % msg) 344 for line in e.value.split ('\n'):
345 if len(line) > 0:
346 self.privmsg (replyto, "error: %s" % line)
345 elif http_match: 347 elif http_match:
346 self.get_ticket_data (replyto, http_match.group (2), False) 348 self.get_ticket_data (replyto, http_match.group (2), False)
347 else: 349 else:
348 chanlog ("Recieved bad PRIVMSG: %s" % line) 350 chanlog ("Recieved bad PRIVMSG: %s" % line)
349 351
400 elif command == 'testannounce': 402 elif command == 'testannounce':
401 check_admin (sender, ident, host, command) 403 check_admin (sender, ident, host, command)
402 if len(args) != 1: 404 if len(args) != 1:
403 raise logical_exception ("usage: .%s <ticket>" % command) 405 raise logical_exception ("usage: .%s <ticket>" % command)
404 self.announce_ticket (bt_getissue (args[0])) 406 self.announce_ticket (bt_getissue (args[0]))
407 elif command == 'multierror':
408 raise logical_exception ('a\nb\nc\n')
405 elif command == 'idgames': 409 elif command == 'idgames':
406 try: 410 try:
407 if len(args) < 1: 411 if len(args) < 1:
408 raise logical_exception ('usage: .%s <keywords>' % command) 412 raise logical_exception ('usage: .%s <keywords>' % command)
409 413
453 self.privmsg (replyto, 'Updated to %s, restarting...' % r2) 457 self.privmsg (replyto, 'Updated to %s, restarting...' % r2)
454 excepterm('') 458 excepterm('')
455 else: 459 else:
456 self.privmsg (replyto, 'Up to date at %s.' % r2) 460 self.privmsg (replyto, 'Up to date at %s.' % r2)
457 except hgapi.HgException as e: 461 except hgapi.HgException as e:
458 raise logical_exception ('Search failed: %s' % `e`) 462 raise logical_exception ('Update failed: %s' % str (e))
459 elif command == 'addchan': 463 elif command == 'addchan':
460 check_admin (sender, ident, host, command) 464 check_admin (sender, ident, host, command)
461 if len(args) != 1: 465 if len(args) != 1:
462 raise logical_exception ("usage: .%s <channel>" % command) 466 raise logical_exception ("usage: .%s <channel>" % command)
463 467

mercurial