Use case-insensitive match rather than lowercase commands. Breaks bling and others.
authorCMDR furrycat <elite@furrycat.net>
Sun, 16 Oct 2016 09:26:54 +0000 (10:26 +0100)
committerCMDR furrycat <elite@furrycat.net>
Sun, 16 Oct 2016 09:26:54 +0000 (10:26 +0100)
bot.py

diff --git a/bot.py b/bot.py
index a69345c..58be246 100755 (executable)
--- a/bot.py
+++ b/bot.py
@@ -509,7 +509,7 @@ def do_commands(message, command, raw, non_admin):
   if command == 'avatar':
     # avatar
     url = None
-    m = re.match(r'\bavatar\s+(\S+)', raw.lower())
+    m = re.match(r'\bavatar\s+(\S+)', raw, re.IGNORECASE)
     if m is not None:
       url = m.group(1)
     elif len(message.attachments):
@@ -526,7 +526,7 @@ def do_commands(message, command, raw, non_admin):
   elif command == 'bling':
     # bling
     url = None
-    m = re.match(r'\bbling\s+(\S+)', raw.lower())
+    m = re.match(r'\bbling\s+(\S+)', raw, re.IGNORECASE)
     filename = message.author.name
     mentions = [message.author.mention] if not message.channel.is_private else None
     if m is not None:
@@ -565,7 +565,7 @@ def do_commands(message, command, raw, non_admin):
 
   elif command == 'debug':
     # debug
-    m = re.match(r'\bdebug\s+(o(?:ff|n))\b', raw.lower())
+    m = re.match(r'\bdebug\s+(o(?:ff|n))\b', raw, re.IGNORECASE)
     if m is None:
       yield from say(message.channel, 'Sorry!')
       return
@@ -588,7 +588,7 @@ def do_commands(message, command, raw, non_admin):
 
     args = {}
     limit = 100
-    m = re.match(r'\bdelete\s+(all|\d+)\b', raw.lower())
+    m = re.match(r'\bdelete\s+(all|\d+)\b', raw, re.IGNORECASE)
     if m is not None:
       if m.group(1) != 'all':
         limit = int(m.group(1))
@@ -597,7 +597,7 @@ def do_commands(message, command, raw, non_admin):
 
   elif command == 'dryrun':
     # dryrun
-    m = re.match(r'\bdryrun\s+(o(?:ff|n))\b', raw.lower())
+    m = re.match(r'\bdryrun\s+(o(?:ff|n))\b', raw, re.IGNORECASE)
     if m is None:
       yield from say(message.channel, 'Sorry!')
       return
@@ -630,7 +630,7 @@ def do_commands(message, command, raw, non_admin):
 
   elif command == 'idle':
     # idle
-    m = re.match(r'\bidle\s+(\d+)\b', raw.lower())
+    m = re.match(r'\bidle\s+(\d+)\b', raw, re.IGNORECASE)
     if m is None:
       yield from say(message.channel, 'Sorry!')
       return
@@ -639,7 +639,7 @@ def do_commands(message, command, raw, non_admin):
 
   elif command == 'rss':
     # rss
-    m = re.match(r'\brss\s+(\d+)\b', raw.lower())
+    m = re.match(r'\brss\s+(\d+)\b', raw, re.IGNORECASE)
     if m is None:
       yield from say(message.channel, 'Sorry!')
       return