chiark / gitweb /
blame: Allow `~blame #last 2' etc.
[irc.git] / commands.py
index d6ba5302dee49573d96ae9013fae6526a4c206a8..721089d3912d6e86d466c2be1d65edbf3253f7e9 100755 (executable)
@@ -333,7 +333,14 @@ def blameq(bot,cmd,nick,conn,public,fishpond,cfgs):
     cwhat=' '.join(clist[2:])
     kindsfile = "fish?"
     if clist[1]=="#last":
-        try: lmsg, lcfg = fishpond.last[0]
+        try:
+            n = abs(int(clist[2]))-1
+            if n < 0: raise ValueError
+        except IndexError: n = 0
+        except ValueError:
+            bot.automsg(public,nick,"Huh?")
+            return
+        try: lmsg, lcfg = fishpond.last[n]
         except IndexError:
            bot.automsg(public,nick,"Nothing")
            return