chiark / gitweb /
new flirt from rjk
[irc.git] / commands.py
index e8293ef868e23f08b9b4b5cba21bcf0a491dd041..474a4420e4edfca1921431bf733b1a1fe05f8445 100755 (executable)
@@ -61,6 +61,9 @@ def fish_quota(pond):
             pond.cur_fish=pond.max_fish
         pond.quotatime=time.time()
 
+# List of things the bot might be called to work round the self-trouting code
+synonyms=["itself","the bot","themself"]
+
 # trout someone, or flirt with them
 def troutq(bot, cmd, nick, conn, public, cfg):
     fishlist=cfg[0]
@@ -86,7 +89,7 @@ def troutq(bot, cmd, nick, conn, public, cfg):
     trout_msg = random.choice(fishlist)
     fishpond.last=trout_msg
     # The bot won't trout or flirt with itself;
-    if irc_lower(me) == irc_lower(target):
+    if irc_lower(me) == irc_lower(target) or irc_lower(target) in synonyms:
         target = nick
     # There's a chance the game may be given away if the request was not
     # public...
@@ -132,7 +135,7 @@ def slashq(bot, cmd, nick, conn, public, cfg):
        return
     # The bot won't slash with itself, instead slashing the requester
     for n in [0,1]:
-       if irc_lower(me) == irc_lower(who[n]):
+       if irc_lower(me) == irc_lower(who[n]) or irc_lower(who[n]) in synonyms:
            who[n] = nick
     # Perhaps someone asked to slash themselves with the bot then we get
     if irc_lower(who[0]) == irc_lower(who[1]):
@@ -437,7 +440,6 @@ def urlq(bot, cmd, nick, conn, public,urldb):
         conn.privmsg(bot.channel,"%s remarks: %s" % (nick," ".join(cmd.split()[1:])))
       else:
         conn.privmsg(bot.channel,"(via %s) %s"%(nick," ".join(cmd.split()[1:])))
-      bot.automsg(False,nick,"That URL was unique; I have posted it into IRC")
     urldb[url]=UrlLog(url,nick)
 
 ### Deal with URLs spotted in channel
@@ -503,7 +505,7 @@ def getTweet(urlstring,twitapi):
   tweetID = parts[-1]
   try:
     status = twitapi.GetStatus(tweetID)
-    print status, type(status), status=={}
+    #print status, type(status), status=={}
     if status == {}:
         return "twitapi.GetStatus returned nothing :-("
     if status.user == None and status.text == None: