Example #1
0
	def bot_poll():
		while True:
			sleep(30)
			time_since_last = datetime.now() - bot.last_event

			if ( time_since_last > timeout):
				print "we look disconnected!"
				bot.disconnect()
				bot.connect( configs['SERVER'] )
				bot.start()
Example #2
0
                            try: # sandboxing!
                                c.parse_command(command_name, command_args,
                                                event)
                            except Exception as ex:
                                self.send_message(event.target, event.source +
                                                  ", something has caused me " +
                                                  "to run into an error. " +
                                                  "Please bother the " +
                                                  "operator of this bot to " +
                                                  "fix me.")
                                print(traceback.print_exc())
                            had_command = True
                            break;
                    if not had_command:
                        self.send_message(event.target, event.source +
                                      ", sorry, \"!" + command_name + "\" is " +
                                      "not a defined command.")
    
    def on_feed_update(self, entry):
        for c in self.channel_set:
            print(c)
            print(entry.link + ": " + entry.title)
            with threading.Lock():
                self.send_message(c, entry.link + ": " + entry.title)

if __name__ == "__main__":
    import botguy_config
    bot = Botguy(botguy_config.nick, info_file=botguy_config.info_file)
    bot.connect(botguy_config.server, channel=botguy_config.channels)
    bot.start()