Handle URLs in announce create.
authorCMDR furrycat <elite@furrycat.net>
Mon, 10 Oct 2016 10:21:51 +0000 (11:21 +0100)
committerCMDR furrycat <elite@furrycat.net>
Mon, 10 Oct 2016 10:21:51 +0000 (11:21 +0100)
bot.py

diff --git a/bot.py b/bot.py
index 6a65d80..deac1f0 100755 (executable)
--- a/bot.py
+++ b/bot.py
@@ -988,8 +988,8 @@ def show_announcement(message, id):
 @asyncio.coroutine
 def create_announcement(message, raw):
   # announcement create [params]: <text>
-  # We want to split by colon but don't want to count any which are part of dates.
-  m = re.match(r'(?:[^:]*\s+(?:at|from|to)\s+\d\d\d\d-?\d\d-?\d\d(?:T|\s+)\d\d:?\d\d:?\d\dZ?)+', raw)
+  # We want to split by colon but don't want to count any which are part of dates or URLs.
+  m = re.match(r'(?:[^:]*\s+(?:(?:at|from|to)\s+\d\d\d\d-?\d\d-?\d\d(?:T|\s+)\d\d:?\d\d:?\d\dZ?|sound\s+https?:\S+))+', raw, re.IGNORECASE)
   if m is not None:
     parts = raw[len(m.group(0)):].split(':')
     parts[0] = m.group(0) + parts[0]