chiark / gitweb /
CVS stuff works now
authormatthew <matthew>
Sun, 3 Feb 2002 23:39:17 +0000 (23:39 +0000)
committermatthew <matthew>
Sun, 3 Feb 2002 23:39:17 +0000 (23:39 +0000)
acrobat-chiark-0.2.py

index e258636..0c60726 100755 (executable)
@@ -49,10 +49,6 @@ class Acrobat(SingleServerIRCBot):
                                     [(server, port)], nickname, nickname)
         self.channel = channel
         self.owner = owner
-        # version control magic
-        acrorevision="$Revision$"
-        acrorev1=re.sub(Revision$\([^$]*\)$,\1,acrorevision)
-        acrorev2=re.sub($\(.*\),\1,acrorev1)
         # load the karma db
         try:
             f = open("karmadump", "r")
@@ -138,16 +134,20 @@ class Acrobat(SingleServerIRCBot):
                             len(self.karma.dict.keys()))
     # query bot status
     def infoq(self, cmd, nick, conn, public):
+        # version control magic
+        acrorevision="$Revision$"
+        acrorev1=re.sub(r'\$Revision$Revision$')
+        acroversion=re.sub(r'(.*) \$',r'\1',acrorev1)
         if public == 1:
             conn.privmsg(self.channel,
-                         "I am Acrobat 0.2.1chiark, on %s, as nick %s." %
-                         (self.channel, self.connection.get_nickname()))
+                         "I am Acrobat %s, on %s, as nick %s." %
+                         (acroversion, self.channel, self.connection.get_nickname()))
             conn.privmsg(self.channel,
                          "My owner is %s; I have karma on %s items." %
                          (self.owner, len(self.karma.dict.keys())))
         else:
-            conn.notice(nick, "I am Acrobat 0.2.1chiark, on %s, as nick %s." %
-                        (self.channel, self.connection.get_nickname()))
+            conn.notice(nick, "I am Acrobat %s, on %s, as nick %s." %
+                        (acroversion, self.channel, self.connection.get_nickname()))
             conn.notice(nick, "My owner is %s; I have karma on %s items." %
                         (self.owner, len(self.karma.dict.keys())))