def execute(self): """Sends the IM with the commit message""" from toc import TocTalk, BotManager bm = BotManager() bot = TocTalk(self.screenname, self.password) bm.addBot(bot, "bot") time.sleep(4) message = self._generateMessage() names = [name.strip() for name in self.to.split(',')] for name in names: print name bot.do_SEND_IM(name, message)
if retu == '': return getmyprofile() print retu return retu if __name__ == "__main__": sn = 'graehl' pw = 'brush' hl = Hotlist() output = Outputter(hl) bot = Claim(sn,pw,output,hl) bot._debug = 0 bot._profile = 'blah' output.setBot(bot) bm = BotManager() try: bm.addBot(bot,"claimbot") except TOCError: output.error(sys.exc_value) sys.exit(1) output.go()
# if we cannot warn more. We really don't care at # this point for x in xrange(0,3): self.do_EVIL(screenname) # so that we don't exceed speed limit time.sleep(2) # if this file is run directly if __name__ == "__main__": bot = BattleBot(sn1, pass1) bot._info = "I'm warrior #1 in this sad, sad fight." # make verbose output. more fun to watch frenzy bot._debug = 2 bot2 = BattleBot(sn2, pass2) bot2._info = "I'm warrior #2, sure to be the victor!" bot2._debug = 2 bm = BotManager() bm.addBot(bot,"myBot") bm.addBot(bot2,"myBot2") time.sleep(4) # time to log on #set 'em off.. bot.do_SEND_IM(sn2,"Hi, friend? How are you?") bm.wait() # this will never return
elif str(msg[:5]) == "dance": logging.info(time.asctime() + " Dance command was requested by " + str(message[0])) for i in self.danceLyrics: bot.do_SEND_IM(message[0], str(i)) time.sleep(1) elif str(msg[:4]) == "help" : logging.info(time.asctime() + " Help command was requested by " + str(message[0])) bot.do_SEND_IM(message[0], str(self.lovejoy.get_help())) elif str(msg[:4]) == "time" : logging.info(time.asctime() + " Time command was requested by " + str(message[0])) bot.do_SEND_IM(message[0], time.asctime()) else: logging.info(time.asctime() + " Unknown command: \"" + str(msg[0:]) + "\" requested by " + str(message[0])) bot.do_SEND_IM(message[0], "Your message has me confused. Type help for a list of my commands.") #Program is run. #Get Lovejoy and AIM login information and start the AIMBot. if __name__ == "__main__": print "__Lovejoy Login__" lovejoySN = raw_input("Username: "******"Password: "******"__AIM Login__" aimSN = raw_input("Username: "******"Password: "******"AIMBot") time.sleep(5) bm.wait()
class Slave(TocTalk): def __init__(self,user,passwd, masterSN): TocTalk.__init__(self,user,passwd) self.masterSN = masterSN def on_IM_IN(self,data): screenname = data.split(":")[0] self.do_SEND_IM(screenname, "Sorry, I only say what my master, %s, tells me to say." % self.masterSN) # if this file is run directly if __name__ == "__main__": # create the master mb = Master(masterSN, masterPW) # create the slave sb = Slave(slaveSN, slavePW, masterSN) bm = BotManager() bm.addBot(mb,"mb") bm.addBot(sb,"sb") while 1: # blocks until we read [screenname, message] = mb.queue.get() sb.do_SEND_IM(screenname, '''You said %s to my master %s.''' % (message,masterSN) )