+ # trout someone
+ def troutq(self, cmd, nick, conn, public):
+ try:
+ target = string.join(cmd.split()[1:])
+ me = self.connection.get_nickname()
+ trout_msg = random.choice(self.trouts)
+# # The bot is loyal(ish)...
+# if target.lower() == self.owner.lower():
+# target = nick
+ # ...and touchy.
+ if me.lower() == target.lower():
+ target = nick
+ conn.action(self.channel, trout_msg % target)
+ if public == 0:
+ if random.random() <= 0.1:
+ conn.action(self.channel, "notes %s is conducting a whispering campaign" % nick)
+ except IndexError:
+ conn.notice(nick, "Who do you wish me to trout?")
+
+ # stock up on trouts
+ def reloadq(self, cmd, nick, conn, public):
+ if irc_lower(nick) == irc_lower(self.owner):
+ tback = self.trouts
+ try:
+ f = open("trouts", "r")
+ self.trouts = [l.strip() for l in f.readlines() if l.find("%s") != -1]
+ f.close()
+ conn.notice(nick, "I am re-armed!")
+ except IOError:
+ conn.notice(nick, "Trout re-arming failed!")
+ self.trouts = tback
+ else:
+ conn.notice(nick, "This command can only be invoked by my owner.")
+