From 959ef89a96995aba40b8f12e093e041a71b36a28 Mon Sep 17 00:00:00 2001 From: CMDR furrycat Date: Mon, 10 Oct 2016 11:21:51 +0100 Subject: [PATCH] Handle URLs in announce create. --- bot.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bot.py b/bot.py index 6a65d80..deac1f0 100755 --- 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]: - # 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] -- 2.7.4