示例#1
0
 def check_and_answer(self, event, private):
     text = ascii_me(event.arguments[0])
     source = event.source.nick
     if (source == self.owner and text == "%s: feeling better?" % self.nickname):
         try:
             print '\n\n reloading decision module\n\n'
             reload(bot_action_decision)
             self.broken = False
         except Exception as thisbroke:
             self.message(self.owner, "halp reloading")
             print ("%s had an error of type %s: %s (in the reload action)" %
                    (self.nickname, type(thisbroke), thisbroke))
             self.broken = True
     elif not self.broken:
         try:
             target, messages = bot_action_decision.actions(self, source, text, private)
         except Exception as thisbroke:
             self.message(self.owner, "halp")
             try:
                 error = ("%s had an error of type %s: %s (in the decision thread)" %
                         (self.nickname, type(thisbroke), thisbroke))
                 print error
                 self.message(self.owner, error)
             except:
                 print 'had some trouble with the error logging'
             try:
                 traceback = format_exc(thisbroke).split('\n')
                 print tracebook
                 self.message(self.owner, traceback)
             except:
                 print 'had some trouble with the traceback'
             self.broken = True
         else:
             if target:
                 self.messenger.messenger.add_to_queue(target, messages)
示例#2
0
 def check_and_answer(self, event, private):
     text = ascii_me(event.arguments[0])
     source = event.source.nick
     if (source == self.owner and text == "%s: feeling better?" % self.nickname):
         try:
             print '\n\n reloading decision module\n\n'
             reload(bot_action_decision)
             self.broken = False
         except Exception as thisbroke:
             self.raw_message(self.owner, "halp reloading")
             self.message_broken(thisbroke)
     elif not self.broken:
         try:
             target, messages = bot_action_decision.actions(self, source, text, private)
         except Exception as thisbroke:
             self.raw_message(self.owner, 'halp')
             self.message_broken(thisbroke)
         else:
             if target:
                 self.message(target, messages)