chiark / gitweb /
Look for upper-case currency code
authorMatthew Vernon <matthewv@chiark.greenend.org.uk>
Mon, 23 Feb 2015 11:24:26 +0000 (11:24 +0000)
committerMatthew Vernon <matthewv@chiark.greenend.org.uk>
Mon, 23 Feb 2015 11:24:26 +0000 (11:24 +0000)
xe.com's output now has the currency in upper-case, so modify the
regexp to look for all-caps versions of our arguments.

commands.py

index 474a4420e4edfca1921431bf733b1a1fe05f8445..38769876bff1ff5a4a730f78f6f95c729952475c 100755 (executable)
@@ -256,7 +256,7 @@ def currencyq(bot, cmd, nick, conn, public):
     targ = ("http://www.xe.com/ucc/convert.cgi?From=%s&To=%s" % (args[0], args[1]))
     try:
         currencypage = urllib.urlopen(targ).read()
     targ = ("http://www.xe.com/ucc/convert.cgi?From=%s&To=%s" % (args[0], args[1]))
     try:
         currencypage = urllib.urlopen(targ).read()
-        match = re.search(r"(1&nbsp;%s&nbsp;=&nbsp;[\d\.]+&nbsp;%s)" % (args[0],args[1]),currencypage,re.MULTILINE)
+        match = re.search(r"(1&nbsp;%s&nbsp;=&nbsp;[\d\.]+&nbsp;%s)" % (args[0].upper(),args[1].upper()),currencypage,re.MULTILINE)
         if match == None:
             bot.automsg(public,nick,"Dear Chief Secretary, there is no money.")
         else:
         if match == None:
             bot.automsg(public,nick,"Dear Chief Secretary, there is no money.")
         else: